svn commit: r359460 - head/lib/libc/gen
Ed Maste
emaste at FreeBSD.org
Mon Mar 30 20:54:09 UTC 2020
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 <unistd.h>
#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);
More information about the svn-src-all
mailing list