From owner-svn-src-all@freebsd.org Mon Mar 30 20:54:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 657D72670BA; Mon, 30 Mar 2020 20:54:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48rl7L6zbPz443L; Mon, 30 Mar 2020 20:54:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CD1222D78; Mon, 30 Mar 2020 20:15:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02UKFKUY076384; Mon, 30 Mar 2020 20:15:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02UKFJrs076381; Mon, 30 Mar 2020 20:15:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202003302015.02UKFJrs076381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 30 Mar 2020 20:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359460 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 359460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2020 20:54:09 -0000 Author: emaste Date: Mon Mar 30 20:15:19 2020 New Revision: 359460 URL: https://svnweb.freebsd.org/changeset/base/359460 Log: nlist: retire long-obsolete aout support Reviewed by: brooks, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24229 Modified: head/lib/libc/gen/Symbol.map head/lib/libc/gen/nlist.3 head/lib/libc/gen/nlist.c Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Mon Mar 30 20:08:26 2020 (r359459) +++ head/lib/libc/gen/Symbol.map Mon Mar 30 20:15:19 2020 (r359460) @@ -510,7 +510,6 @@ FBSDprivate_1.0 { /* __pw_match_entry; */ /* __pw_parse_entry; */ __fdnlist; /* used by libkvm */ - /* __aout_fdnlist; */ /* __elf_is_okay__; */ /* __elf_fdnlist; */ __opendir2; Modified: head/lib/libc/gen/nlist.3 ============================================================================== --- head/lib/libc/gen/nlist.3 Mon Mar 30 20:08:26 2020 (r359459) +++ head/lib/libc/gen/nlist.3 Mon Mar 30 20:15:19 2020 (r359460) @@ -69,7 +69,6 @@ if the file .Fa filename does not exist or is not executable, the returned value is \-1. .Sh SEE ALSO -.Xr a.out 5 , .Xr elf 5 .Sh HISTORY A Modified: head/lib/libc/gen/nlist.c ============================================================================== --- head/lib/libc/gen/nlist.c Mon Mar 30 20:08:26 2020 (r359459) +++ head/lib/libc/gen/nlist.c Mon Mar 30 20:15:19 2020 (r359460) @@ -47,10 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" -/* i386 is the only current FreeBSD architecture that used a.out format. */ -#ifdef __i386__ -#define _NLIST_DO_AOUT -#endif #define _NLIST_DO_ELF #ifdef _NLIST_DO_ELF @@ -59,7 +55,6 @@ __FBSDID("$FreeBSD$"); #endif int __fdnlist(int, struct nlist *); -int __aout_fdnlist(int, struct nlist *); int __elf_fdnlist(int, struct nlist *); int __elf_is_okay__(Elf_Ehdr *); @@ -79,9 +74,6 @@ nlist(const char *name, struct nlist *list) static struct nlist_handlers { int (*fn)(int fd, struct nlist *list); } nlist_fn[] = { -#ifdef _NLIST_DO_AOUT - { __aout_fdnlist }, -#endif #ifdef _NLIST_DO_ELF { __elf_fdnlist }, #endif @@ -102,100 +94,6 @@ __fdnlist(int fd, struct nlist *list) } #define ISLAST(p) (p->n_un.n_name == 0 || p->n_un.n_name[0] == 0) - -#ifdef _NLIST_DO_AOUT -int -__aout_fdnlist(int fd, struct nlist *list) -{ - struct nlist *p, *symtab; - caddr_t strtab, a_out_mmap; - off_t stroff, symoff; - u_long symsize; - int nent; - struct exec * exec; - struct stat st; - - /* check that file is at least as large as struct exec! */ - if ((_fstat(fd, &st) < 0) || (st.st_size < sizeof(struct exec))) - return (-1); - - /* Check for files too large to mmap. */ - if (st.st_size > SIZE_T_MAX) { - errno = EFBIG; - return (-1); - } - - /* - * Map the whole a.out file into our address space. - * We then find the string table withing this area. - * We do not just mmap the string table, as it probably - * does not start at a page boundary - we save ourselves a - * lot of nastiness by mmapping the whole file. - * - * This gives us an easy way to randomly access all the strings, - * without making the memory allocation permanent as with - * malloc/free (i.e., munmap will return it to the system). - */ - a_out_mmap = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0); - if (a_out_mmap == MAP_FAILED) - return (-1); - - exec = (struct exec *)a_out_mmap; - if (N_BADMAG(*exec)) { - munmap(a_out_mmap, (size_t)st.st_size); - return (-1); - } - - symoff = N_SYMOFF(*exec); - symsize = exec->a_syms; - stroff = symoff + symsize; - - /* find the string table in our mmapped area */ - strtab = a_out_mmap + stroff; - symtab = (struct nlist *)(a_out_mmap + symoff); - - /* - * clean out any left-over information for all valid entries. - * Type and value defined to be 0 if not found; historical - * versions cleared other and desc as well. Also figure out - * the largest string length so don't read any more of the - * string table than we have to. - * - * XXX clearing anything other than n_type and n_value violates - * the semantics given in the man page. - */ - nent = 0; - for (p = list; !ISLAST(p); ++p) { - p->n_type = 0; - p->n_other = 0; - p->n_desc = 0; - p->n_value = 0; - ++nent; - } - - while (symsize > 0) { - int soff; - - symsize-= sizeof(struct nlist); - soff = symtab->n_un.n_strx; - - - if (soff != 0 && (symtab->n_type & N_STAB) == 0) - for (p = list; !ISLAST(p); p++) - if (!strcmp(&strtab[soff], p->n_un.n_name)) { - p->n_value = symtab->n_value; - p->n_type = symtab->n_type; - p->n_desc = symtab->n_desc; - p->n_other = symtab->n_other; - if (--nent <= 0) - break; - } - symtab++; - } - munmap(a_out_mmap, (size_t)st.st_size); - return (nent); -} -#endif #ifdef _NLIST_DO_ELF static void elf_sym_to_nlist(struct nlist *, Elf_Sym *, Elf_Shdr *, int);