diff options
-rw-r--r-- | ldso/util/ldconfig.c | 27 | ||||
-rw-r--r-- | ldso/util/ldd.c | 30 |
2 files changed, 55 insertions, 2 deletions
diff --git a/ldso/util/ldconfig.c b/ldso/util/ldconfig.c index 2b3d50c8e..b7f976890 100644 --- a/ldso/util/ldconfig.c +++ b/ldso/util/ldconfig.c @@ -32,7 +32,6 @@ #include <getopt.h> #include <dirent.h> #include <unistd.h> -#include <a.out.h> #include <link.h> #include <elf.h> #include <sys/stat.h> @@ -43,6 +42,32 @@ #include "../config.h" #include "readelf.h" +struct exec +{ + unsigned long a_info; /* Use macros N_MAGIC, etc for access */ + unsigned a_text; /* length of text, in bytes */ + unsigned a_data; /* length of data, in bytes */ + unsigned a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned a_syms; /* length of symbol table data in file, in bytes */ + unsigned a_entry; /* start address */ + unsigned a_trsize; /* length of relocation info for text, in bytes */ + unsigned a_drsize; /* length of relocation info for data, in bytes */ +}; + +#if !defined (N_MAGIC) +#define N_MAGIC(exec) ((exec).a_info & 0xffff) +#endif +/* Code indicating object file or impure executable. */ +#define OMAGIC 0407 +/* Code indicating pure executable. */ +#define NMAGIC 0410 +/* Code indicating demand-paged executable. */ +#define ZMAGIC 0413 +/* This indicates a demand-paged executable with the header in the text. + The first page is unmapped to help trap NULL pointer references */ +#define QMAGIC 0314 +/* Code indicating core file. */ +#define CMAGIC 0421 #ifdef __GNUC__ void warn(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); void error(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); diff --git a/ldso/util/ldd.c b/ldso/util/ldd.c index 640da41f0..a0b0338eb 100644 --- a/ldso/util/ldd.c +++ b/ldso/util/ldd.c @@ -21,13 +21,41 @@ #include <string.h> #include <getopt.h> #include <unistd.h> -#include <a.out.h> #include <errno.h> #include <sys/wait.h> #include <linux/elf.h> #include "../config.h" #include "readelf.h" +struct exec +{ + unsigned long a_info; /* Use macros N_MAGIC, etc for access */ + unsigned a_text; /* length of text, in bytes */ + unsigned a_data; /* length of data, in bytes */ + unsigned a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned a_syms; /* length of symbol table data in file, in bytes */ + unsigned a_entry; /* start address */ + unsigned a_trsize; /* length of relocation info for text, in bytes */ + unsigned a_drsize; /* length of relocation info for data, in bytes */ +}; + +#if !defined (N_MAGIC) +#define N_MAGIC(exec) ((exec).a_info & 0xffff) +#endif +/* Code indicating object file or impure executable. */ +#define OMAGIC 0407 +/* Code indicating pure executable. */ +#define NMAGIC 0410 +/* Code indicating demand-paged executable. */ +#define ZMAGIC 0413 +/* This indicates a demand-paged executable with the header in the text. + The first page is unmapped to help trap NULL pointer references */ +#define QMAGIC 0314 +/* Code indicating core file. */ +#define CMAGIC 0421 + + + extern int uselib(const char *library); #ifdef __GNUC__ |