aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2002-09-17 01:49:00 +0000
committerPeter Wemm <peter@FreeBSD.org>2002-09-17 01:49:00 +0000
commit66422f5b7a1a6055f0b2358268eb902aab6e2e3e (patch)
tree7d8147c99f6bfb34b7cb47ad46e24a4f7dc93102 /lib/libc
parent4e6ef0845de37f8c4a29410d48d3847da78a9c9f (diff)
downloadsrc-66422f5b7a1a6055f0b2358268eb902aab6e2e3e.tar.gz
src-66422f5b7a1a6055f0b2358268eb902aab6e2e3e.zip
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
Notes
Notes: svn path=/head/; revision=103436
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/amd64/SYS.h6
-rw-r--r--lib/libc/gen/dlfcn.c79
-rw-r--r--lib/libc/gen/getobjformat.c84
-rw-r--r--lib/libc/gmon/gmon.c2
-rw-r--r--lib/libc/i386/SYS.h6
5 files changed, 8 insertions, 169 deletions
diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h
index 5a636f8b33b9..1483f9d8e763 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 4a3500d4aa65..ff1d9006c860 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 de5c9c161f99..7428f36b884b 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 34dc9360a766..95302202da5e 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 5a636f8b33b9..1483f9d8e763 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