diff options
author | peter <peter@FreeBSD.org> | 2002-09-17 01:49:00 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-09-17 01:49:00 +0000 |
commit | a51c9b66271f0551fb83b90a7db6c464eac2318b (patch) | |
tree | 7d8147c99f6bfb34b7cb47ad46e24a4f7dc93102 /lib | |
parent | 2a4cb24fb4a35753b66a2503614b874481e35535 (diff) | |
download | FreeBSD-src-a51c9b66271f0551fb83b90a7db6c464eac2318b.zip FreeBSD-src-a51c9b66271f0551fb83b90a7db6c464eac2318b.tar.gz |
Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports. As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL. It has already lasted WAY beyond
that.
Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.
Tested on: i386 (extensively), alpha
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 4 | ||||
-rw-r--r-- | lib/libc/amd64/SYS.h | 6 | ||||
-rw-r--r-- | lib/libc/gen/dlfcn.c | 79 | ||||
-rw-r--r-- | lib/libc/gen/getobjformat.c | 84 | ||||
-rw-r--r-- | lib/libc/gmon/gmon.c | 2 | ||||
-rw-r--r-- | lib/libc/i386/SYS.h | 6 | ||||
-rw-r--r-- | lib/libmd/Makefile | 2 | ||||
-rw-r--r-- | lib/libncurses/Makefile | 13 | ||||
-rw-r--r-- | lib/libpam/libpam/Makefile | 4 | ||||
-rw-r--r-- | lib/liby/Makefile | 25 | ||||
-rw-r--r-- | lib/ncurses/ncurses/Makefile | 13 |
11 files changed, 10 insertions, 228 deletions
diff --git a/lib/Makefile b/lib/Makefile index b9fae5c..922b66c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -32,8 +32,8 @@ SUBDIR= ${_csu} libcom_err libcrypt libkvm msun libmd \ libstand ${_libtelnet} libufs libugidfw libusbhid ${_libvgl} \ libwrap libxpg4 liby libz -.if exists(${.CURDIR}/csu/${MACHINE_ARCH}-${OBJFORMAT}) -_csu=csu/${MACHINE_ARCH}-${OBJFORMAT} +.if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) +_csu=csu/${MACHINE_ARCH}-elf .elif exists(${.CURDIR}/csu/${MACHINE_ARCH}/Makefile) _csu=csu/${MACHINE_ARCH} .else diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h index 5a636f8..1483f9d 100644 --- a/lib/libc/amd64/SYS.h +++ b/lib/libc/amd64/SYS.h @@ -58,8 +58,4 @@ /* gas messes up offset -- although we don't currently need it, do for BCS */ #define LCALL(x,y) .byte 0x9a ; .long y; .word x -#ifdef __ELF__ -#define KERNCALL int $0x80 /* Faster */ -#else -#define KERNCALL LCALL(7,0) /* The old way */ -#endif +#define KERNCALL int $0x80 diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 4a3500d..ff1d900 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -28,12 +28,8 @@ __FBSDID("$FreeBSD$"); /* - * Linkage to services provided by the dynamic linker. These are - * implemented differently in ELF and a.out, because the dynamic - * linkers have different interfaces. + * Linkage to services provided by the dynamic linker. */ -#ifdef __ELF__ - #include <dlfcn.h> #include <stddef.h> @@ -107,76 +103,3 @@ dlsym(void * __restrict handle, const char * __restrict name) _rtld_error(sorry); return NULL; } - -#else /* a.out format */ - -#include <sys/types.h> -#include <nlist.h> /* XXX - Required by link.h */ -#include <dlfcn.h> -#include <link.h> -#include <stddef.h> - -/* - * For a.out, entry to the dynamic linker is via these trampolines. - * They enter the dynamic linker through the ld_entry struct that was - * passed back from the dynamic linker at startup time. - */ - -/* GCC is needed because we use its __builtin_return_address construct. */ - -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif - -/* - * These variables are set by code in crt0.o. For compatibility with - * old executables, they must be common, not extern. - */ -struct ld_entry *__ldso_entry; /* Entry points to dynamic linker */ -int __ldso_version; /* Dynamic linker version number */ - -int -dladdr(const void *addr, Dl_info *dlip) -{ - if (__ldso_entry == NULL || __ldso_version < LDSO_VERSION_HAS_DLADDR) - return 0; - return (__ldso_entry->dladdr)(addr, dlip); -} - -int -dlclose(void *handle) -{ - if (__ldso_entry == NULL) - return -1; - return (__ldso_entry->dlclose)(handle); -} - -const char * -dlerror(void) -{ - if (__ldso_entry == NULL) - return "Service unavailable"; - return (__ldso_entry->dlerror)(); -} - -void * -dlopen(const char *name, int mode) -{ - if (__ldso_entry == NULL) - return NULL; - return (__ldso_entry->dlopen)(name, mode); -} - -void * -dlsym(void * __restrict handle, const char * __restrict name) -{ - if (__ldso_entry == NULL) - return NULL; - if (__ldso_version >= LDSO_VERSION_HAS_DLSYM3) { - void *retaddr = __builtin_return_address(0); /* __GNUC__ only */ - return (__ldso_entry->dlsym3)(handle, name, retaddr); - } else - return (__ldso_entry->dlsym)(handle, name); -} - -#endif /* __ELF__ */ diff --git a/lib/libc/gen/getobjformat.c b/lib/libc/gen/getobjformat.c index de5c9c1..7428f36 100644 --- a/lib/libc/gen/getobjformat.c +++ b/lib/libc/gen/getobjformat.c @@ -33,88 +33,12 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> -#define PATH_OBJFORMAT "/etc/objformat" - -static int copyformat(char *, const char *, size_t); - -static const char *known_formats[] = { OBJFORMAT_NAMES, NULL }; - -static int -copyformat(char *buf, const char *fmt, size_t bufsize) -{ - size_t len; - - len = strlen(fmt); - if (len > bufsize - 1) - return -1; - strcpy(buf, fmt); - return len; -} - int getobjformat(char *buf, size_t bufsize, int *argcp, char **argv) { - const char *fmt; - char **src, **dst; - const char *env; - FILE *fp; - fmt = NULL; - - if (argv != NULL) { - /* - * Scan for arguments setting known formats, e.g., "-elf". - * If "argcp" is non-NULL, delete these arguments from the - * list and update the argument count in "*argcp". - */ - for (dst = src = argv; *src != NULL; src++) { - if ((*src)[0] == '-') { - const char **p; - - for (p = known_formats; *p != NULL; p++) - if (strcmp(*src + 1, *p) == 0) - break; - if (*p != NULL) { - fmt = *p; - if (argcp == NULL) /* Don't delete */ - *dst++ = *src; - } else - *dst++ = *src; - } else - *dst++ = *src; - } - *dst = NULL; - if (argcp != NULL) - *argcp -= src - dst; - if (fmt != NULL) - return copyformat(buf, fmt, bufsize); - } - - /* Check the OBJFORMAT environment variable. */ - if ((env = getenv("OBJFORMAT")) != NULL) - return copyformat(buf, env, bufsize); - - /* Take a look at "/etc/objformat". */ - if ((fp = fopen(PATH_OBJFORMAT, "r")) != NULL) { - char line[1024]; - int found; - int len; - - found = len = 0; - while (fgets(line, sizeof line, fp) != NULL) { - if (strncmp(line, "OBJFORMAT=", 10) == 0) { - char *p = &line[10]; - - p[strcspn(p, " \t\n")] = '\0'; - len = copyformat(buf, p, bufsize); - found = 1; - } - } - fclose(fp); - if (found) - return len; - } - - /* As a last resort, use the compiled in default. */ - return copyformat(buf, OBJFORMAT_DEFAULT, bufsize); + if (bufsize < 4) + return -1; + strcpy(buf, "elf"); + return 3; } diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c index 34dc936..9530220 100644 --- a/lib/libc/gmon/gmon.c +++ b/lib/libc/gmon/gmon.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" -#if defined(__ELF__) && (defined(__i386__) || defined(__sparc64__)) +#if defined(__i386__) || defined(__sparc64__) extern char *minbrk asm (".minbrk"); #else extern char *minbrk asm ("minbrk"); diff --git a/lib/libc/i386/SYS.h b/lib/libc/i386/SYS.h index 5a636f8..1483f9d 100644 --- a/lib/libc/i386/SYS.h +++ b/lib/libc/i386/SYS.h @@ -58,8 +58,4 @@ /* gas messes up offset -- although we don't currently need it, do for BCS */ #define LCALL(x,y) .byte 0x9a ; .long y; .word x -#ifdef __ELF__ -#define KERNCALL int $0x80 /* Faster */ -#else -#define KERNCALL LCALL(7,0) /* The old way */ -#endif +#define KERNCALL int $0x80 diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile index 7256d6d..eec6b3b 100644 --- a/lib/libmd/Makefile +++ b/lib/libmd/Makefile @@ -32,7 +32,6 @@ CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ CFLAGS+= -I${.CURDIR} .PATH: ${.CURDIR}/${MACHINE_ARCH} -.if ${OBJFORMAT} == "elf" .if exists(${MACHINE_ARCH}/sha.S) SRCS+= sha.S CFLAGS+= -DSHA1_ASM -DELF @@ -41,7 +40,6 @@ CFLAGS+= -DSHA1_ASM -DELF SRCS+= rmd160.S CFLAGS+= -DRMD160_ASM -DELF .endif -.endif md2hl.c: mdXhl.c (echo '#define LENGTH 16'; \ diff --git a/lib/libncurses/Makefile b/lib/libncurses/Makefile index f024b91..f7d46ed 100644 --- a/lib/libncurses/Makefile +++ b/lib/libncurses/Makefile @@ -233,18 +233,6 @@ SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a .if !defined(NOPIC) -.if ${OBJFORMAT} == aout -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libcurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libtermcap.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libtermlib.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libmytinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libtinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -.else # no need for major at all, it's an ld-time redirection only SYMLINKS+=libncurses.so ${SHLIBDIR}/libcurses.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermcap.so @@ -252,7 +240,6 @@ SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermlib.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so .endif -.endif .if !defined(NOPROFILE) SYMLINKS+=libncurses_p.a ${LIBDIR}/libcurses_p.a SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermcap_p.a diff --git a/lib/libpam/libpam/Makefile b/lib/libpam/libpam/Makefile index 7326a90..76d8318 100644 --- a/lib/libpam/libpam/Makefile +++ b/lib/libpam/libpam/Makefile @@ -153,11 +153,7 @@ CLEANFILES += openpam_static.o CLEANFILES+= openpam_static_modules.o openpam_static_modules.o: openpam_static.o ${STATIC_MODULES} -.if ${OBJFORMAT} == elf ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} -.else - ${LD} -o ${.TARGET} -r -Bforcearchive ${.ALLSRC} -.endif # Headers INCS= ${HEADERS} ${ADD_HEADERS} diff --git a/lib/liby/Makefile b/lib/liby/Makefile index e66ea5d..9aa4154 100644 --- a/lib/liby/Makefile +++ b/lib/liby/Makefile @@ -6,31 +6,6 @@ SHLIB_MINOR= 0 SRCS= main.c yyerror.c -.if ${OBJFORMAT} != aout NOPIC= true -.endif - -# -# Before complaining about this, please *double-check* that you have -# updated the ldconfig path in /etc/rc to include /usr/lib/compat that -# was added in src/etc/rc rev 1.98. -# This is so that `ld' will not continue to generate binaries linked -# shared against liby, so that in a future release we can move this -# off to a compat dist (like compat22). -# -beforeinstall: - -rm -f ${DESTDIR}/usr/lib/compat/lib${LIB}.so \ - ${DESTDIR}${ORIG_SHLIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - ${DESTDIR}/usr/lib/compat/lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - ${DESTDIR}/usr/lib/compat/lib${LIB}.so.${SHLIB_MAJOR} .include <bsd.lib.mk> - -# This must follow the .include in case SHLIBDIR is defined there. -ORIG_SHLIBDIR:= ${SHLIBDIR} - -.if ${OBJFORMAT} == aout -# The ldconfig line in/etc/rc doesn't depend on ${LIBDIR} or ${SHLIBDIR}, -# so neither does this. -SHLIBDIR= /usr/lib/compat/aout -.endif diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index f024b91..f7d46ed 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -233,18 +233,6 @@ SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a .if !defined(NOPIC) -.if ${OBJFORMAT} == aout -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libcurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libtermcap.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libtermlib.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libmytinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -SYMLINKS+=libncurses.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ - libtinfo.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -.else # no need for major at all, it's an ld-time redirection only SYMLINKS+=libncurses.so ${SHLIBDIR}/libcurses.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermcap.so @@ -252,7 +240,6 @@ SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermlib.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so .endif -.endif .if !defined(NOPROFILE) SYMLINKS+=libncurses_p.a ${LIBDIR}/libcurses_p.a SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermcap_p.a |