[uClibc-cvs] svn commit: trunk/uClibc/ldso: include ldso

vapier at uclibc.org vapier at uclibc.org
Thu Jun 30 22:32:30 UTC 2005


Author: vapier
Date: 2005-06-30 16:32:29 -0600 (Thu, 30 Jun 2005)
New Revision: 10652

Log:
create generic ELF_* macros to hide 32/64 bit differences

Modified:
   trunk/uClibc/ldso/include/dl-elf.h
   trunk/uClibc/ldso/ldso/dl-hash.c
   trunk/uClibc/ldso/ldso/dl-startup.c


Changeset:
Modified: trunk/uClibc/ldso/include/dl-elf.h
===================================================================
--- trunk/uClibc/ldso/include/dl-elf.h	2005-06-30 22:29:02 UTC (rev 10651)
+++ trunk/uClibc/ldso/include/dl-elf.h	2005-06-30 22:32:29 UTC (rev 10652)
@@ -36,6 +36,26 @@
 extern void _dl_protect_relro (struct elf_resolve *l);
 
 /*
+ * Bitsize related settings for things ElfW()
+ * does not handle already
+ */
+#if __WORDSIZE == 64
+# define ELF_ST_BIND(val) ELF64_ST_TYPE(val)
+# define ELF_ST_TYPE(val) ELF64_ST_TYPE(val)
+# define ELF_R_SYM(i)     ELF64_R_SYM(i)
+# ifndef ELF_CLASS
+#  define ELF_CLASS ELFCLASS64
+# endif
+#else
+# define ELF_ST_BIND(val) ELF32_ST_TYPE(val)
+# define ELF_ST_TYPE(val) ELF32_ST_TYPE(val)
+# define ELF_R_SYM(i)     ELF32_R_SYM(i)
+# ifndef ELF_CLASS
+#  define ELF_CLASS ELFCLASS32
+# endif
+#endif
+
+/*
  * Datatype of a relocation on this platform
  */
 #ifdef ELF_USES_RELOCA

Modified: trunk/uClibc/ldso/ldso/dl-hash.c
===================================================================
--- trunk/uClibc/ldso/ldso/dl-hash.c	2005-06-30 22:29:02 UTC (rev 10651)
+++ trunk/uClibc/ldso/ldso/dl-hash.c	2005-06-30 22:32:29 UTC (rev 10652)
@@ -190,10 +190,10 @@
 				continue;
 			if (sym->st_value == 0)
 				continue;
-			if (ELF32_ST_TYPE(sym->st_info) > STT_FUNC)
+			if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
 				continue;
 
-			switch (ELF32_ST_BIND(sym->st_info)) {
+			switch (ELF_ST_BIND(sym->st_info)) {
 			case STB_WEAK:
 #if 0
 /* Perhaps we should support old style weak symbol handling

Modified: trunk/uClibc/ldso/ldso/dl-startup.c
===================================================================
--- trunk/uClibc/ldso/ldso/dl-startup.c	2005-06-30 22:29:02 UTC (rev 10651)
+++ trunk/uClibc/ldso/ldso/dl-startup.c	2005-06-30 22:32:29 UTC (rev 10652)
@@ -164,7 +164,7 @@
 	header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_ptr;
 
 	/* Check the ELF header to make sure everything looks ok.  */
-	if (!header || header->e_ident[EI_CLASS] != ELFCLASS32 ||
+	if (!header || header->e_ident[EI_CLASS] != ELF_CLASS ||
 			header->e_ident[EI_VERSION] != EV_CURRENT
 			/* Do not use an inline _dl_strncmp here or some arches
 			* will blow chunks, i.e. those that need to relocate all
@@ -255,7 +255,7 @@
 			rpnt = (ELF_RELOC *) (rel_addr + load_addr);
 			for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) {
 				reloc_addr = (unsigned long *) (load_addr + (unsigned long) rpnt->r_offset);
-				symtab_index = ELF32_R_SYM(rpnt->r_info);
+				symtab_index = ELF_R_SYM(rpnt->r_info);
 				symbol_addr = 0;
 				sym = NULL;
 				if (symtab_index) {




More information about the uClibc-cvs mailing list