From dcea56a735ba509a482898266d7129b340734fec Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 27 Apr 2001 23:13:44 +0000 Subject: Get rid of the a.out header file --- ldso/util/ldconfig.c | 27 ++++++++++++++++++++++++++- 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 #include #include -#include #include #include #include @@ -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 #include #include -#include #include #include #include #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__ -- cgit v1.2.3