svn commit: branches/uClibc-nptl/ldso/ldso: bfin i386 powerpc sparc x86_64

carmelo at uclibc.org carmelo at uclibc.org
Wed Mar 5 16:20:26 UTC 2008


Author: carmelo
Date: 2008-03-05 08:20:24 -0800 (Wed, 05 Mar 2008)
New Revision: 21170

Log:
Synchronize ldso tree with trunk. Only architectures
that don't support TLS yet in the nptl branch.
Just to speed-up final merge.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>


Modified:
   branches/uClibc-nptl/ldso/ldso/bfin/dl-inlines.h
   branches/uClibc-nptl/ldso/ldso/bfin/dl-startup.h
   branches/uClibc-nptl/ldso/ldso/bfin/dl-sysdep.h
   branches/uClibc-nptl/ldso/ldso/bfin/elfinterp.c
   branches/uClibc-nptl/ldso/ldso/i386/dl-startup.h
   branches/uClibc-nptl/ldso/ldso/i386/dl-sysdep.h
   branches/uClibc-nptl/ldso/ldso/i386/resolve.S
   branches/uClibc-nptl/ldso/ldso/powerpc/elfinterp.c
   branches/uClibc-nptl/ldso/ldso/sparc/dl-startup.h
   branches/uClibc-nptl/ldso/ldso/sparc/dl-sysdep.h
   branches/uClibc-nptl/ldso/ldso/x86_64/dl-startup.h
   branches/uClibc-nptl/ldso/ldso/x86_64/resolve.S


Changeset:
Modified: branches/uClibc-nptl/ldso/ldso/bfin/dl-inlines.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/bfin/dl-inlines.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/bfin/dl-inlines.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -18,7 +18,7 @@
 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
 USA.  */
 
-#include <bits/bfin_sram.h>
+#include <bfin_sram.h>
 
 #ifndef _dl_assert
 # define _dl_assert(expr)
@@ -463,6 +463,17 @@
       struct elf32_fdpic_loadseg *segdata;
       ssize_t offs;
       segdata = loadaddr.map->segs + i;
+
+      /* FIXME:
+        A more cleaner way is to add type for struct elf32_fdpic_loadseg,
+        and release the memory according to the type.
+        Currently, we hardcode the memory address of L1 SRAM.  */
+      if ((segdata->addr & 0xff800000) == 0xff800000)
+       {
+         _dl_sram_free ((void *)segdata->addr);
+         continue;
+       }
+
       offs = (segdata->p_vaddr & ADDR_ALIGN);
       _dl_munmap ((void*)segdata->addr - offs,
 		  segdata->p_memsz + offs);
@@ -493,7 +504,15 @@
       && !(ppnt->p_flags & PF_X))
     return 1;
 
-  return 0;	
+  /* 0xff700000, 0xff800000, 0xff900000 and 0xffa00000 are also used in
+     GNU ld and linux kernel. They need to be keep synchronized.  */
+  if (ppnt->p_vaddr == 0xff700000
+      || ppnt->p_vaddr == 0xff800000
+      || ppnt->p_vaddr == 0xff900000
+      || ppnt->p_vaddr == 0xffa00000)
+    return 1;
+
+  return 0;
 }
 
 inline static char *
@@ -505,7 +524,7 @@
   char *status, *tryaddr, *l1addr;
   size_t size;
 
-  if ((epnt->e_flags & EF_BFIN_CODE_IN_L1)
+  if (((epnt->e_flags & EF_BFIN_CODE_IN_L1) || ppnt->p_vaddr == 0xffa00000)
       && !(ppnt->p_flags & PF_W)
       && (ppnt->p_flags & PF_X)) {
     status = (char *) _dl_mmap
@@ -522,20 +541,32 @@
       _dl_dma_memcpy (l1addr, status + (ppnt->p_vaddr & ADDR_ALIGN), ppnt->p_filesz);
     _dl_munmap (status, size);
     if (l1addr == NULL)
-      return NULL;
+      _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
     return l1addr;
   }
 
-  if ((epnt->e_flags & EF_BFIN_DATA_IN_L1)
+  if (((epnt->e_flags & EF_BFIN_DATA_IN_L1)
+       || ppnt->p_vaddr == 0xff700000
+       || ppnt->p_vaddr == 0xff800000
+       || ppnt->p_vaddr == 0xff900000)
       && (ppnt->p_flags & PF_W)
       && !(ppnt->p_flags & PF_X)) {
-    l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_SRAM);
-    if (l1addr == NULL
-	|| (_DL_PREAD (infile, l1addr, ppnt->p_filesz, ppnt->p_offset)
-	    != ppnt->p_filesz))
-      return NULL;
-    if (ppnt->p_filesz < ppnt->p_memsz)
-      _dl_memset (l1addr + ppnt->p_filesz, 0, ppnt->p_memsz - ppnt->p_filesz);
+    if (ppnt->p_vaddr == 0xff800000)
+      l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_A_SRAM);
+    else if (ppnt->p_vaddr == 0xff900000)
+      l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_B_SRAM);
+    else
+      l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_SRAM);
+    if (l1addr == NULL) {
+      _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
+    } else {
+      if (_DL_PREAD (infile, l1addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) {
+        _dl_sram_free (l1addr);
+        return NULL;
+      }
+      if (ppnt->p_filesz < ppnt->p_memsz)
+       _dl_memset (l1addr + ppnt->p_filesz, 0, ppnt->p_memsz - ppnt->p_filesz);
+    }
     return l1addr;
   }
 

Modified: branches/uClibc-nptl/ldso/ldso/bfin/dl-startup.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/bfin/dl-startup.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/bfin/dl-startup.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -86,7 +86,8 @@
     "	.size	__dl_boot,.-__dl_boot\n"
 );
 
-#define DL_BOOT(X)   \
+#undef DL_START
+#define DL_START(X)   \
 static void  __attribute__ ((used)) \
 _dl_start (Elf32_Addr dl_boot_got_pointer, \
 	   struct elf32_fdpic_loadmap *dl_boot_progmap, \
@@ -105,17 +106,6 @@
 #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1)
 
 /*
- * Compute the GOT address.  On several platforms, we use assembly
- * here.  on FR-V FDPIC, there's no way to compute the GOT address,
- * since the offset between text and data is not fixed, so we arrange
- * for the assembly _dl_boot to pass this value as an argument to
- * _dl_boot.  */
-#define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer)
-
-#define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \
-  ((dpnt) = dl_boot_ldso_dyn_pointer)
-
-/*
  * Here is a macro to perform a relocation.  This is only used when
  * bootstrapping the dynamic loader.  RELP is the relocation that we
  * are performing, REL is the pointer to the address we are relocating.

Modified: branches/uClibc-nptl/ldso/ldso/bfin/dl-sysdep.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/bfin/dl-sysdep.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/bfin/dl-sysdep.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -34,6 +34,8 @@
 
 #define DL_NO_COPY_RELOCS
 
+#define HAVE_DL_INLINES_H
+
 /*
  * Initialization sequence for a GOT.  Copy the resolver function
  * descriptor and the pointer to the elf_resolve/link_map data
@@ -93,7 +95,7 @@
 #define DL_LOADADDR_TYPE struct elf32_fdpic_loadaddr
 
 #define DL_RELOC_ADDR(LOADADDR, ADDR) \
-  (__reloc_pointer ((void*)(ADDR), (LOADADDR).map))
+    ((ElfW(Addr))__reloc_pointer ((void*)(ADDR), (LOADADDR).map))
 
 #define DL_ADDR_TO_FUNC_PTR(ADDR, LOADADDR) \
   ((void(*)(void)) _dl_funcdesc_for ((void*)(ADDR), (LOADADDR).got_value))
@@ -136,6 +138,17 @@
 #define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
   (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
 
+/*
+ * Compute the GOT address.  On several platforms, we use assembly
+ * here.  on FR-V FDPIC, there's no way to compute the GOT address,
+ * since the offset between text and data is not fixed, so we arrange
+ * for the assembly _dl_boot to pass this value as an argument to
+ * _dl_boot.  */
+#define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer)
+
+#define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \
+  ((dpnt) = dl_boot_ldso_dyn_pointer)
+
 /* 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
@@ -176,7 +189,7 @@
 #define DL_FIND_HASH_VALUE(TPNT, TYPE_CLASS, SYM) \
   (((TYPE_CLASS) & ELF_RTYPE_CLASS_DLSYM) \
    && ELF32_ST_TYPE((SYM)->st_info) == STT_FUNC \
-   ? _dl_funcdesc_for (DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value),    \
+   ? _dl_funcdesc_for ((void *)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value), \
  		       (TPNT)->loadaddr.got_value)			     \
    : DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value))
 

Modified: branches/uClibc-nptl/ldso/ldso/bfin/elfinterp.c
===================================================================
--- branches/uClibc-nptl/ldso/ldso/bfin/elfinterp.c	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/bfin/elfinterp.c	2008-03-05 16:20:24 UTC (rev 21170)
@@ -72,11 +72,9 @@
 	got_entry = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, this_reloc->r_offset);
 
 	/* Get the address to be used to fill in the GOT entry.  */
-	new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, NULL, 0,
-				     &new_tpnt);
+	new_addr = _dl_lookup_hash(symname, tpnt->symbol_scope, NULL, 0, &new_tpnt);
 	if (!new_addr) {
-		new_addr = _dl_find_hash_mod(symname, NULL, NULL, 0,
-					     &new_tpnt);
+		new_addr = _dl_lookup_hash(symname, NULL, NULL, 0, &new_tpnt);
 		if (!new_addr) {
 			_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
 				    _dl_progname, symname);
@@ -188,7 +186,7 @@
 	} else {
 
 		symbol_addr = (unsigned long)
-		  _dl_find_hash_mod(symname, scope, NULL, 0, &symbol_tpnt);
+		  _dl_lookup_hash(symname, scope, NULL, 0, &symbol_tpnt);
 
 		/*
 		 * We want to allow undefined references to weak symbols - this might
@@ -346,7 +344,7 @@
   return 0;
 }
 
-#ifndef LIBDL
+#ifndef IS_IN_libdl
 # include "../../libc/sysdeps/linux/bfin/crtreloc.c"
 #endif
 

Modified: branches/uClibc-nptl/ldso/ldso/i386/dl-startup.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/i386/dl-startup.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/i386/dl-startup.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -5,7 +5,6 @@
  */
 __asm__ (
     "	.text\n"
-    "	.align 16\n"
     "	.globl	_start\n"
     "	.type	_start, at function\n"
     "_start:\n"

Modified: branches/uClibc-nptl/ldso/ldso/i386/dl-sysdep.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/i386/dl-sysdep.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/i386/dl-sysdep.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -59,7 +59,6 @@
 	/* It doesn't matter what variable this is, the reference never makes
 	   it to assembly.  We need a dummy reference to some global variable
 	   via the GOT to make sure the compiler initialized %ebx in time.  */
-	extern int _dl_errno;
 	Elf32_Addr addr;
 	__asm__ ("leal _dl_start at GOTOFF(%%ebx), %0\n"
 	     "subl _dl_start at GOT(%%ebx), %0"
@@ -79,62 +78,3 @@
 		*reloc_addr += load_off;
 	} while (--relative_count);
 }
-
-/*
- * These were taken from the 'dl-sysdep.h' files in the 'nptl' directory
- * in glibc.
- */
-#if USE_TLS
-# ifdef CONFIG_686
-/* Traditionally system calls have been made using int $0x80.  A
-   second method was introduced which, if possible, will use the
-   sysenter/syscall instructions.  To signal the presence and where to
-   find the code the kernel passes an AT_SYSINFO value in the
-   auxiliary vector to the application.  */
-#  define NEED_DL_SYSINFO	1
-#  define USE_DL_SYSINFO	1
-
-#  if defined NEED_DL_SYSINFO && !defined __ASSEMBLER__
-extern void _dl_sysinfo_int80 (void) attribute_hidden;
-#   define DL_SYSINFO_DEFAULT (uintptr_t) _dl_sysinfo_int80
-#   define DL_SYSINFO_IMPLEMENTATION \
-  asm (".text\n\t"							      \
-       ".type _dl_sysinfo_int80, at function\n\t"				      \
-       ".hidden _dl_sysinfo_int80\n"					      \
-       CFI_STARTPROC "\n"						      \
-       "_dl_sysinfo_int80:\n\t"						      \
-       "int $0x80;\n\t"							      \
-       "ret;\n\t"							      \
-       CFI_ENDPROC "\n"							      \
-       ".size _dl_sysinfo_int80,.-_dl_sysinfo_int80\n\t"		      \
-       ".previous");
-#  endif
-# else
-/* Traditionally system calls have been made using int $0x80.  A
-   second method was introduced which, if possible, will use the
-   sysenter/syscall instructions.  To signal the presence and where to
-   find the code the kernel passes an AT_SYSINFO value in the
-   auxiliary vector to the application.
-   sysenter/syscall is not useful on i386 through i586, but the dynamic
-   linker and dl code in libc.a has to be able to load i686 compiled
-   libraries.  */
-#  define NEED_DL_SYSINFO	1
-#  undef USE_DL_SYSINFO
-
-#  if defined NEED_DL_SYSINFO && !defined __ASSEMBLER__
-extern void _dl_sysinfo_int80 (void) attribute_hidden;
-#  define DL_SYSINFO_DEFAULT (uintptr_t) _dl_sysinfo_int80
-#  define DL_SYSINFO_IMPLEMENTATION \
-  asm (".text\n\t"							      \
-       ".type _dl_sysinfo_int80, at function\n\t"				      \
-       ".hidden _dl_sysinfo_int80\n\t"					      \
-       CFI_STARTPROC "\n"						      \
-       "_dl_sysinfo_int80:\n\t"						      \
-       "int $0x80;\n\t"							      \
-       "ret;\n\t"							      \
-       CFI_ENDPROC "\n"							      \
-       ".size _dl_sysinfo_int80,.-_dl_sysinfo_int80\n\t"		      \
-       ".previous;");
-#  endif
-# endif /* CONFIG_686 */
-#endif /* USE_TLS */

Modified: branches/uClibc-nptl/ldso/ldso/i386/resolve.S
===================================================================
--- branches/uClibc-nptl/ldso/ldso/i386/resolve.S	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/i386/resolve.S	2008-03-05 16:20:24 UTC (rev 21170)
@@ -21,7 +21,6 @@
  */
 
 .text
-.align 4
 
 .globl _dl_linux_resolve
 .type	_dl_linux_resolve, at function

Modified: branches/uClibc-nptl/ldso/ldso/powerpc/elfinterp.c
===================================================================
--- branches/uClibc-nptl/ldso/ldso/powerpc/elfinterp.c	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/powerpc/elfinterp.c	2008-03-05 16:20:24 UTC (rev 21170)
@@ -213,7 +213,7 @@
 		 * here, so all bases should be covered.
 		 */
 		if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))
-			return -1;
+			return 1;
 	}
 #if defined (__SUPPORT_LD_DEBUG__)
 	old_val = *reloc_addr;

Modified: branches/uClibc-nptl/ldso/ldso/sparc/dl-startup.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/sparc/dl-startup.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/sparc/dl-startup.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -9,6 +9,7 @@
 	.global _start\n\
 	.type   _start,%function\n\
 	.align 32\n\
+	.register %g2, #scratch\n\
 _start:\n\
 	/* Allocate space for functions to drop their arguments. */\n\
 	sub	%sp, 6*4, %sp\n\

Modified: branches/uClibc-nptl/ldso/ldso/sparc/dl-sysdep.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/sparc/dl-sysdep.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/sparc/dl-sysdep.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -83,10 +83,16 @@
 #endif
 
 /* 4096 bytes alignment */
+#if defined(__sparc_v9__)
 /* ...but 8192 is required for mmap() on sparc64 kernel */
 #define PAGE_ALIGN 0xffffe000
 #define ADDR_ALIGN 0x1fff
 #define OFFS_ALIGN 0x7fffe000
+#elif defined(__sparc_v8__)
+#define PAGE_ALIGN 0xfffff000
+#define ADDR_ALIGN 0xfff
+#define OFFS_ALIGN 0x7ffff000
+#endif
 
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
    PLT entries should not be allowed to define the value.

Modified: branches/uClibc-nptl/ldso/ldso/x86_64/dl-startup.h
===================================================================
--- branches/uClibc-nptl/ldso/ldso/x86_64/dl-startup.h	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/x86_64/dl-startup.h	2008-03-05 16:20:24 UTC (rev 21170)
@@ -8,7 +8,6 @@
  */
 __asm__ (
 	"	.text\n"
-	"	.align 16\n"
 	"	.global _start\n"
 	"	.type   _start,%function\n"
 	"_start:\n"

Modified: branches/uClibc-nptl/ldso/ldso/x86_64/resolve.S
===================================================================
--- branches/uClibc-nptl/ldso/ldso/x86_64/resolve.S	2008-03-05 14:37:55 UTC (rev 21169)
+++ branches/uClibc-nptl/ldso/ldso/x86_64/resolve.S	2008-03-05 16:20:24 UTC (rev 21170)
@@ -26,7 +26,6 @@
 
 .global _dl_linux_resolve
 .type   _dl_linux_resolve,%function
-.align 16
 
 _dl_linux_resolve:
 	subq $56,%rsp




More information about the uClibc-cvs mailing list