[uClibc-cvs] CVS uClibc/ldso/ldso/frv

CVS User andersen andersen at codepoet.org
Sat Dec 11 12:23:33 UTC 2004


Update of /var/cvs/uClibc/ldso/ldso/frv
In directory nail:/tmp/cvs-serv2771/ldso/ldso/frv

Modified Files:
	dl-inlines.h dl-startup.h dl-sysdep.h elfinterp.c 
Log Message:
Partial commit of a patch from Alexandre Oliva:

Here's an updated version of the patch I posted about a month ago.  It
leaves -nostdinc alone, and uses -print-file-name=include instead of
-print-search-dirs to figure out where GCC's internal headers are.

Please let me know whether there are any portions of this patch you'd
like me to break into smaller pieces, to rework, or to give up trying
to get into uClibc :-)  Thanks,



--- /var/cvs/uClibc/ldso/ldso/frv/dl-inlines.h	2004/08/26 23:39:02	1.1
+++ /var/cvs/uClibc/ldso/ldso/frv/dl-inlines.h	2004/12/11 12:23:30	1.2
@@ -414,11 +414,11 @@
   return _dl_stabilize_funcdesc (*entry);
 }
 
-inline static void *
-_dl_lookup_address (void *address)
+inline static void const *
+_dl_lookup_address (void const *address)
 {
   struct elf_resolve *rpnt;
-  struct funcdesc_value *fd;
+  struct funcdesc_value const *fd;
 
   /* Make sure we don't make assumptions about its alignment.  */
   asm ("" : "+r" (address));
@@ -427,7 +427,7 @@
     /* It's not a function descriptor.  */
     return address;
   
-  fd = (struct funcdesc_value *)address;
+  fd = (struct funcdesc_value const *)address;
 
   for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next)
     {
@@ -439,9 +439,9 @@
 
       address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0);
 
-      if (address && *(struct funcdesc_value **)address == fd)
+      if (address && *(struct funcdesc_value *const*)address == fd)
 	{
-	  address = (*(struct funcdesc_value **)address)->entry_point;
+	  address = (*(struct funcdesc_value *const*)address)->entry_point;
 	  break;
 	}
       else
--- /var/cvs/uClibc/ldso/ldso/frv/dl-startup.h	2004/02/18 08:12:30	1.2
+++ /var/cvs/uClibc/ldso/ldso/frv/dl-startup.h	2004/12/11 12:23:30	1.3
@@ -145,7 +145,3 @@
   /* _dl_dprintf(2, "entry point is (%x,%x)\n", dl_main_funcdesc->entry_point, dl_main_funcdesc->got_value); */ \
   return;								\
 } while (0)
-
-
-
-
--- /var/cvs/uClibc/ldso/ldso/frv/dl-sysdep.h	2004/09/23 07:05:33	1.6
+++ /var/cvs/uClibc/ldso/ldso/frv/dl-sysdep.h	2004/12/11 12:23:30	1.7
@@ -129,6 +129,16 @@
 #define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
   (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
 
+/* Make sure we only load libraries that use the same number of
+   general-purpose and floating-point registers the dynamic loader was
+   compiled for.  */
+#define DL_CHECK_REG_COUNT(flags) \
+  (((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_32 ? __FRV_GPR__ == 32 : 1) \
+   && ((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_64 ? __FRV_GPR__ == 64 : 1) \
+   && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_32 ? __FRV_FPR__ == 32 : 1) \
+   && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_64 ? __FRV_FPR__ == 64 : 1) \
+   && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_NONE ? __FRV_FPR__ == 0 : 1))
+
 /* We only support loading FDPIC independently-relocatable shared
    libraries.  It probably wouldn't be too hard to support loading
    shared libraries that require relocation by the same amount, but we
@@ -149,6 +159,14 @@
       _dl_close(infile); \
       return NULL; \
     } \
+\
+  if (! DL_CHECK_REG_COUNT ((epnt)->e_flags)) \
+    { \
+      _dl_internal_error_number = LD_ERROR_NOTDYN; \
+      _dl_dprintf(2, "%s: '%s' assumes different register counts" \
+		  "\n", (_dl_progname), (libname)); \
+      _dl_close(infile); \
+    } \
 } \
 while (0)  
 
@@ -172,6 +190,14 @@
  		       (TPNT)->loadaddr.got_value)			     \
    : DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr))
 
+#define DL_GET_READY_TO_RUN_EXTRA_PARMS \
+  , struct elf32_fdpic_loadmap *dl_boot_progmap
+#define DL_GET_READY_TO_RUN_EXTRA_ARGS \
+  , dl_boot_progmap
+
+	  
+
+
 #ifdef __USE_GNU
 # include <link.h>
 #else
--- /var/cvs/uClibc/ldso/ldso/frv/elfinterp.c	2004/09/23 07:00:39	1.7
+++ /var/cvs/uClibc/ldso/ldso/frv/elfinterp.c	2004/12/11 12:23:30	1.8
@@ -153,10 +153,11 @@
 	  DL_RELOC_ADDR (this_reloc->r_offset, tpnt->loadaddr);
 
 	/* Get the address to be used to fill in the GOT entry.  */
-	new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, 0,
+	new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, NULL, 0,
 				     &new_tpnt);
 	if (!new_addr) {
-		new_addr = _dl_find_hash_mod(symname, NULL, 0, &new_tpnt);
+		new_addr = _dl_find_hash_mod(symname, NULL, NULL, 0,
+					     &new_tpnt);
 		if (!new_addr) {
 			_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
 				    _dl_progname, symname);
@@ -278,7 +279,7 @@
 	} else {
 
 		symbol_addr = (unsigned long)
-		  _dl_find_hash_mod(symname, scope, 0, &symbol_tpnt);
+		  _dl_find_hash_mod(symname, scope, NULL, 0, &symbol_tpnt);
 
 		/*
 		 * We want to allow undefined references to weak symbols - this might



More information about the uClibc-cvs mailing list