aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-10 10:18:47 +0000
committerRoland McGrath <roland@gnu.org>1996-06-10 10:18:47 +0000
commit266180eb985e14fa9f77cfd3b41e9211e9986162 (patch)
tree666ad4e19f0e046ebc3fdbade19c7520b7061b1f
parent564210fe2fdf88dd0800590b256cdb0751da1dec (diff)
downloadglibc-266180eb985e14fa9f77cfd3b41e9211e9986162.tar.xz
glibc-266180eb985e14fa9f77cfd3b41e9211e9986162.zip
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
-rw-r--r--ChangeLog108
-rw-r--r--elf/Makefile36
-rw-r--r--elf/dl-deps.c27
-rw-r--r--elf/dl-init.c2
-rw-r--r--elf/dl-load.c133
-rw-r--r--elf/dl-lookup.c103
-rw-r--r--elf/dl-minimal.c17
-rw-r--r--elf/dl-open.c45
-rw-r--r--elf/dl-reloc.c28
-rw-r--r--elf/dl-runtime.c24
-rw-r--r--elf/dl-support.c51
-rw-r--r--elf/dl-symbol.c33
-rw-r--r--elf/dladdr.c8
-rw-r--r--elf/dlclose.c6
-rw-r--r--elf/dlsym.c4
-rw-r--r--elf/do-rel.h24
-rw-r--r--elf/dynamic-link.h6
-rw-r--r--elf/elf.h242
-rw-r--r--elf/elf_hash.c4
-rw-r--r--elf/libelf.h283
-rw-r--r--elf/link.h47
-rw-r--r--elf/linux-compat.c4
-rw-r--r--elf/rtld.c42
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c12
24 files changed, 667 insertions, 622 deletions
diff --git a/ChangeLog b/ChangeLog
index 295384bc0b..16f8c5b832 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,111 @@
+Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open.
+ (__close, __mmap): Likewise define with __ names now.
+
+Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * elf/dl-support.c: New file.
+ * elf/Makefile (CFLAGS-dl-support.c): New variable.
+ (routines, elide-routines.so): Add dl-support.
+
+ * elf/dl-minimal.c (_dl_pagesize): Remove common defn.
+ * elf/dl-load.c (_dl_pagesize): Define it here.
+ (_dl_map_object_from_fd): Initialize it if zero.
+ * elf/link.h (_dl_pagesize): Remove const.
+
+Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * elf/Makefile (routines): Add dl-symbol.
+ * elf/dl-lookup.c (_dl_symbol_value): Moved to ...
+ * elf/dl-symbol.c: New file.
+
+ * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types.
+ (Elf32_Section, Elf64_Section): New types, 16 bits.
+ (Elf32_Sym, Elf64_Sym): Use it.
+
+ * elf/dl-deps.c (_dl_open): Moved to ...
+ * elf/dl-open.c: New file.
+ * Makefile (routines): Add dl-open.
+
+ * elf/Makefile (dl-routines): New variable.
+ (routines): Add $(dl-routines).
+ (elide-routines.so): New variable, set to $(dl-routines).
+ (libdl-inhibit-o): Variable removed; build all flavors of -ldl.
+ (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to
+ $(dl-routines).
+
+ * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage.
+
+ * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND.
+
+ * elf/dl-load.c (open_path): Use __ names for open and close. Avoid
+ using strdup.
+ (_dl_map_object): Likewise.
+ (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect.
+ * elf/dl-minimal.c (malloc): Likewise.
+ * elf/dl-reloc.c (_dl_relocate_object): Likewise.
+
+ * elf/dl-minimal.c (_dl_pagesize): New variable.
+ (malloc): Use that instead of a static variable.
+ * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of
+ calling getpagesize.
+ * elf/dl-load.c (_dl_map_object_from_fd): Likewise.
+ * elf/link.h: Declare _dl_pagesize.
+
+ * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug.
+
+ * elf/link.h (struct link_map): Use Half for l_phnum instead of Word.
+ * elf/rtld.c (dl_main): Use Half for phdr count arg.
+ (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg.
+
+ * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to
+ extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against
+ native wordsize, either 32 or 64.
+
+ * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a
+ char is always a byte, no need for a typedef. Section indices are
+ 16-bit quantities in elf64, which already have a typedef Elf64_Half.
+
+ Remove partial -lelf implementation. There is now a
+ separately-distributed `libelf' package that implements it.
+ * elf/dl-lookup.c: Don't #include <libelf.h> any more.
+ (_dl_elf_hash): New function, moved from
+ libelf.h:elf_hash.
+ (_dl_lookup_symbol): Use it instead of elf_hash.
+ * elf/libelf.h: File removed.
+ * elf/elf_hash.c: File removed.
+ * elf/Makefile (headers): Remove libelf.h.
+ (extra-libs): Remove libelf.
+ (libelf-routines): Variable removed.
+
+ * elf/Makefile (libdl.so): Remove commands from this target. The
+ implicit rule commands are correct, this explicit rule just serves to
+ add some dependencies.
+
+ * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of
+ ELF32_ST_TYPE. Likewise ST_BIND.
+ * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM.
+
+ * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type
+ naming.
+ (ELFW): New macro, likewise for ELFXX_* macro naming.
+ (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF.
+
+Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c,
+ elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c,
+ elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c,
+ elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to
+ `ElfW(XXX)' for wordsize-independence.
+
+Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu>
+
+ * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts.
+ (Elf64_auxv_t): New type.
+ (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
+
Mon Jun 10 02:22:24 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/configure.in: New file, start with configure.
diff --git a/elf/Makefile b/elf/Makefile
index b144e903e6..34be12e769 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -20,18 +20,25 @@
subdir := elf
-headers := elf.h libelf.h link.h dlfcn.h
-routines := init-first
+headers = elf.h link.h dlfcn.h
+routines = init-first $(dl-routines) dl-open dl-symbol dl-support
+
+# The core dynamic linking functions are in libc for the static and
+# profiled libraries.
+dl-routines = $(addprefix dl-,load lookup object reloc deps \
+ runtime error init fini)
+# But they are absent from the shared libc, because that code is in ld.so.
+elide-routines.so = $(dl-routines) dl-support
+
+# ld.so uses those routines, plus some special stuff for being the program
+# interpreter and operating independent of libc.
+rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal
+distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
+ soinit.c sofini.c ldd.sh.in linux-compat.c
-extra-libs = libelf libdl
-libelf-routines := elf_hash
+extra-libs = libdl
libdl-routines := dlopen dlclose dlsym dlerror dladdr
-libdl-inhibit-o = $(filter-out .so,$(object-suffixes)) # Build only shared.
-rtld-routines := rtld $(addprefix dl-,minimal load lookup object reloc \
- deps runtime sysdep error init fini)
-distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
- soinit.c sofini.c ldd.sh.in linux-compat.c
all: # Make this the default target; it will be defined in Rules.
@@ -43,7 +50,7 @@ generated = librtld.so dl-allobjs.so
install-others = $(slibdir)/$(rtld-installed-name)
install-bin = ldd
-# Make sure these things is built in the `make lib' pass so it can be used
+# Make sure these things are built in the `make lib' pass so they can be used
# to run programs during the `make others' pass.
lib-noranlib: $(objpfx)ld.so $(addprefix $(objpfx),$(extra-objs))
@@ -81,16 +88,17 @@ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $^
endef
+# The dl code in the static libc needs a default library path.
+CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
+
# The Linux-compatible dynamic linker shared object is just the same
# with one object file of compatibility initialization code added.
$(objpfx)ld-linux.so.1: $(objpfx)linux-compat.so
+# Specify the dependencies of libdl.so; its commands come from the generic
+# rule to build a shared library.
$(objpfx)libdl.so: $(objpfx)libdl_pic.a $(common-objpfx)libc.so $(objpfx)ld.so
- $(patsubst %/,cd %;,$(objpfx)) \
- $(LINK.o) -shared -o $(@:$(objpfx)%=%) \
- $(LDFLAGS.so) $(LDFLAGS-dl.so) \
- -Wl,--whole-archive $(^:$(objpfx)%=%) $(no-whole-archive)
$(slibdir)/$(rtld-installed-name): $(objpfx)ld.so; $(do-install-program)
$(slibdir)/ld-linux.so.1: $(objpfx)ld-linux.so.1; $(do-install-program)
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 92403d4110..7e3b259362 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -56,7 +56,7 @@ _dl_map_object_deps (struct link_map *map)
{
const char *strtab
= ((void *) l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);
- const Elf32_Dyn *d;
+ const ElfW(Dyn) *d;
for (d = l->l_ld; d->d_tag != DT_NULL; ++d)
if (d->d_tag == DT_NEEDED)
{
@@ -97,28 +97,3 @@ _dl_map_object_deps (struct link_map *map)
scanp->map->l_reserved = 0;
}
}
-
-
-struct link_map *
-_dl_open (struct link_map *parent, const char *file, int mode)
-{
- struct link_map *new, *l;
- Elf32_Addr init;
-
- /* Load the named object. */
- new = _dl_map_object (parent, file);
-
- /* Load that object's dependencies. */
- _dl_map_object_deps (new);
-
- /* Relocate the objects loaded. */
- for (l = new; l; l = l->l_next)
- if (! l->l_relocated)
- _dl_relocate_object (l, (mode & RTLD_BINDING_MASK) == RTLD_LAZY);
-
- /* Run the initializer functions of new objects. */
- while (init = _dl_init_next (new))
- (*(void (*) (void)) init) ();
-
- return new;
-}
diff --git a/elf/dl-init.c b/elf/dl-init.c
index ee99ce3dec..66ef83e28b 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -24,7 +24,7 @@ Cambridge, MA 02139, USA. */
/* Run initializers for MAP and its dependencies, in inverse dependency
order (that is, leaf nodes first). */
-Elf32_Addr
+ElfW(Addr)
_dl_init_next (struct link_map *map)
{
unsigned int i;
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 8103c7af2a..c6acc8c222 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -60,6 +60,7 @@ Cambridge, MA 02139, USA. */
#define STRING(x) #x
int _dl_zerofd = -1;
+size_t _dl_pagesize;
/* Try to open NAME in one of the directories in DIRPATH.
@@ -82,31 +83,48 @@ open_path (const char *name, size_t namelen,
return -1;
}
- buf = alloca (strlen (dirpath) + 1 + namelen);
+ buf = __alloca (strlen (dirpath) + 1 + namelen);
do
{
+ size_t buflen;
+
dirpath = p;
p = strpbrk (dirpath, ":;");
if (p == NULL)
p = strchr (dirpath, '\0');
if (p == dirpath)
- /* Two adjacent colons, or a colon at the beginning or the end of
- the path means to search the current directory. */
- (void) memcpy (buf, name, namelen);
+ {
+ /* Two adjacent colons, or a colon at the beginning or the end of
+ the path means to search the current directory. */
+ (void) memcpy (buf, name, namelen);
+ buflen = namelen;
+ }
else
{
/* Construct the pathname to try. */
(void) memcpy (buf, dirpath, p - dirpath);
buf[p - dirpath] = '/';
(void) memcpy (&buf[(p - dirpath) + 1], name, namelen);
+ buflen = p - dirpath + 1 + namelen;
}
- fd = open (buf, O_RDONLY);
+ fd = __open (buf, O_RDONLY);
if (fd != -1)
{
- *realname = strdup (buf);
- return fd;
+ *realname = malloc (buflen);
+ if (*realname)
+ {
+ memcpy (*realname, buf, buflen);
+ return fd;
+ }
+ else
+ {
+ /* No memory for the name, we certainly won't be able
+ to load and link it. */
+ __close (fd);
+ return -1;
+ }
}
if (errno != ENOENT && errno != EACCES)
/* The file exists and is readable, but something went wrong. */
@@ -117,7 +135,6 @@ open_path (const char *name, size_t namelen,
return -1;
}
-
/* Map in the shared object file NAME. */
struct link_map *
@@ -163,9 +180,19 @@ _dl_map_object (struct link_map *loader, const char *name)
}
else
{
- fd = open (name, O_RDONLY);
+ fd = __open (name, O_RDONLY);
if (fd != -1)
- realname = strdup (name);
+ {
+ size_t len = strlen (name) + 1;
+ realname = malloc (len);
+ if (realname)
+ memcpy (realname, name, len);
+ else
+ {
+ __close (fd);
+ fd = -1;
+ }
+ }
}
if (fd == -1)
@@ -182,25 +209,24 @@ struct link_map *
_dl_map_object_from_fd (const char *name, int fd, char *realname)
{
struct link_map *l = NULL;
- const size_t pagesize = getpagesize ();
void *file_mapping = NULL;
size_t mapping_size = 0;
#define LOSE(s) lose (0, (s))
void lose (int code, const char *msg)
{
- (void) close (fd);
+ (void) __close (fd);
if (file_mapping)
- munmap (file_mapping, mapping_size);
+ __munmap (file_mapping, mapping_size);
_dl_signal_error (code, l ? l->l_name : name, msg);
}
- inline caddr_t map_segment (Elf32_Addr mapstart, size_t len,
+ inline caddr_t map_segment (ElfW(Addr) mapstart, size_t len,
int prot, int fixed, off_t offset)
{
- caddr_t mapat = mmap ((caddr_t) mapstart, len, prot,
- fixed|MAP_COPY|MAP_FILE,
- fd, offset);
+ caddr_t mapat = __mmap ((caddr_t) mapstart, len, prot,
+ fixed|MAP_COPY|MAP_FILE,
+ fd, offset);
if (mapat == (caddr_t) -1)
lose (errno, "failed to map segment from shared object");
return mapat;
@@ -213,11 +239,11 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
{
void *result;
if (file_mapping)
- munmap (file_mapping, mapping_size);
- mapping_size = (location + size + 1 + pagesize - 1);
- mapping_size &= ~(pagesize - 1);
- result = mmap (file_mapping, mapping_size, PROT_READ,
- MAP_COPY|MAP_FILE, fd, 0);
+ __munmap (file_mapping, mapping_size);
+ mapping_size = (location + size + 1 + _dl_pagesize - 1);
+ mapping_size &= ~(_dl_pagesize - 1);
+ result = __mmap (file_mapping, mapping_size, PROT_READ,
+ MAP_COPY|MAP_FILE, fd, 0);
if (result == (void *) -1)
lose (errno, "cannot map file data");
file_mapping = result;
@@ -225,9 +251,9 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
return file_mapping + location;
}
- const Elf32_Ehdr *header;
- const Elf32_Phdr *phdr;
- const Elf32_Phdr *ph;
+ const ElfW(Ehdr) *header;
+ const ElfW(Phdr) *phdr;
+ const ElfW(Phdr) *ph;
int type;
/* Look again to see if the real name matched another already loaded. */
@@ -236,12 +262,15 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
{
/* The object is already loaded.
Just bump its reference count and return it. */
- close (fd);
+ __close (fd);
free (realname);
++l->l_opencount;
return l;
}
+ if (_dl_pagesize == 0)
+ _dl_pagesize = __getpagesize ();
+
/* Map in the first page to read the header. */
header = map (0, sizeof *header);
@@ -260,8 +289,10 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
#endif
)
LOSE ("invalid ELF header");
- if (header->e_ident[EI_CLASS] != ELFCLASS32)
- LOSE ("ELF file class not 32-bit");
+#define ELF32_CLASS ELFCLASS32
+#define ELF64_CLASS ELFCLASS64
+ if (header->e_ident[EI_CLASS] != ELFW(CLASS))
+ LOSE ("ELF file class not " STRING(__ELF_WORDSIZE) "-bit");
if (header->e_ident[EI_DATA] != byteorder)
LOSE ("ELF file data encoding not " byteorder_name);
if (header->e_ident[EI_VERSION] != EV_CURRENT)
@@ -270,7 +301,7 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
LOSE ("ELF file version not " STRING(EV_CURRENT));
if (! elf_machine_matches_host (header->e_machine))
LOSE ("ELF file machine architecture not " ELF_MACHINE_NAME);
- if (header->e_phentsize != sizeof (Elf32_Phdr))
+ if (header->e_phentsize != sizeof (ElfW(Phdr)))
LOSE ("ELF file's phentsize not the expected size");
/* Enter the new object in the list of loaded objects. */
@@ -289,13 +320,13 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname)
l->l_entry = header->e_entry;
type = header->e_type;
l->l_phnum = header->e_phnum;
- phdr = map (header->e_phoff, l->l_phnum * sizeof (Elf32_Phdr));
+ phdr = map (header->e_phoff, l->l_phnum * sizeof (ElfW(Phdr)));
{
/* Scan the program header table, collecting its load commands. */
struct loadcmd
{
- Elf32_Addr mapstart, mapend, dataend, allocend;
+ ElfW(Addr) mapstart, mapend, dataend, allocend;
off_t mapoff;
int prot;
} loadcmds[l