This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 2.1.2pre1 outlook


>I think we need a patch to make the dynamic linker work with the ELF OSABI 
>value that the new ARM binutils uses.  I'll send one shortly.

Here's that patch.  It's against the 2.1 branch; if it's OK we should also 
install something morally equivalent in the mainline.

p.

1999-07-15  Philip Blundell  <pb@nexus.co.uk>

	* elf/dl-load.c (_dl_map_object_from_fd): Use ELF_ABI_RECOGNIZED
	to decide whether an object's ABI is acceptable.
	(ELF_ABI_RECOGNIZED): New macro; provide default definition.
	* sysdeps/arm/dl-machine.h (ELF_ABI_RECOGNIZED): Define.

--- elf/dl-load.c	1999/06/17 10:41:12	1.103.2.1
+++ elf/dl-load.c	1999/07/15 17:05:16
@@ -58,6 +58,12 @@
 #define MAP_BASE_ADDR(l)	0
 #endif
 
+/* By default we accept only ELFOSABI_SYSV and an ABI version of 0.  But
+   some systems may wish to do this differently.  */
+#ifndef ELF_ABI_RECOGNIZED
+#define ELF_ABI_RECOGNIZED(_h)		\
+	((_h)[EI_OSABI] == ELFOSABI_SYSV && (_h)[EI_ABIVERSION] == 0)
+#endif
 
 #include <endian.h>
 #if BYTE_ORDER == BIG_ENDIAN
@@ -663,9 +669,7 @@
     [EI_MAG3] = ELFMAG3,
     [EI_CLASS] = ELFW(CLASS),
     [EI_DATA] = byteorder,
-    [EI_VERSION] = EV_CURRENT,
-    [EI_OSABI] = ELFOSABI_SYSV,
-    [EI_ABIVERSION] = 0
+    [EI_VERSION] = EV_CURRENT
   };
   struct link_map *l = NULL;
 
@@ -721,7 +725,7 @@
   header = (void *) readbuf;
 
   /* Check the header for basic validity.  */
-  if (memcmp (header->e_ident, expected, EI_PAD) != 0)
+  if (memcmp (header->e_ident, expected, EI_OSABI) != 0)
     {
       /* Something is wrong.  */
       if (*(Elf32_Word *) &header->e_ident !=
@@ -746,10 +750,6 @@
 	LOSE (0, "ELF file version ident not " STRING(EV_CURRENT));
       /* XXX We should be able so set system specific versions which are
 	 allowed here.  */
-      if (header->e_ident[EI_OSABI] != ELFOSABI_SYSV)
-	LOSE (0, "ELF file OS ABI not " STRING(ELFOSABI_SYSV));
-      if (header->e_ident[EI_ABIVERSION] != 0)
-	LOSE (0, "ELF file ABI version not 0");
       LOSE (0, "internal error");
     }
 
@@ -759,6 +759,8 @@
     LOSE (0, "ELF file machine architecture not " ELF_MACHINE_NAME);
   if (header->e_phentsize != sizeof (ElfW(Phdr)))
     LOSE (0, "ELF file's phentsize not the expected size");
+  if (! ELF_ABI_RECOGNIZED (header->e_ident))
+    LOSE (0, "ELF file ABI not recognized");
 
 #ifndef MAP_ANON
 # define MAP_ANON 0
--- sysdeps/arm/dl-machine.h	1999/06/13 09:23:47	1.12.2.1
+++ sysdeps/arm/dl-machine.h	1999/07/15 17:05:41
@@ -454,3 +454,8 @@
 }
 
 #endif /* RESOLVE */
+
+/* We have unusual requirements for ABI acceptance.  */
+#define ELF_ABI_RECOGNIZED(_h)						\
+	(((_h)[EI_OSABI] == ELFOSABI_SYSV && (_h)[EI_ABIVERSION] == 0)  \
+	|| ((_h)[EI_OSABI] == ELFOSABI_ARM && (_h)[EI_ABIVERSION] == 0))



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]