[uClibc] RE: [uClibc-cvs] svn commit: trunk/uClibc/ldso/ldso:armcris i386 m68k mips powerpc sh sh64 etc...

Joakim Tjernlund joakim.tjernlund at lumentis.se
Tue Mar 15 15:13:35 UTC 2005


> 
> > 
> > > -----Original Message-----
> > > From: uclibc-bounces at uclibc.org 
> > > [mailto:uclibc-bounces at uclibc.org] On Behalf Of Joakim Tjernlund
> > > Sent: Tuesday, March 15, 2005 09:41
> > > To: uclibc at uclibc.org
> > > Subject: [uClibc] RE: [uClibc-cvs] svn commit: 
> > > trunk/uClibc/ldso/ldso: armcris i386 m68k mips powerpc sh sh64 etc...
> > > 
> > > > On Mon Mar 14, 2005 at 06:25:10AM -0700, jocke at uclibc.org wrote:
> > > > > I probably broke one or two archs(only tested PPC) so please
> > > > > try and report problems. For a report to be useful you need
> > > > > to enable __SUPPORT_LD_DEBUG_EARLY__ and __SUPPORT_LD_DEBUG__
> > > > 
> > > > I can confirm that at least mips and x86 are broken...
> > > [SNIP]
> > > 
> > > x86, MIPS and PPC should be OK now. No reports on the other
> > > arches CRIS, ARM, SPARC, M68K, SH and SH64 (Hint hint :)
> > 
> > I have made CRIS compile agin (r10007). I have, however, no 
> > idea if the change is actually correct, since it seems that
> > elf_machine_load_address() is never called (I tried changing
> > it to return 0x12345678 and everything still worked)...
> 
> Good, but I think your change is wrong. The elf_machine_load_address() will
> be called when you execute ldso directly(/lib/ld-uClibc.so.0). This is a
> preparation for beeing able to do "/lib/ld-uClibc.so.0 /bin/ls". Just
> try running /lib/ld-uClibc.so.0 with __SUPPORT_LD_DEBUG_EARLY__ enabled. You should
> end up with:
> "Cool, we managed to make a function call."
> before is SEGVs.
> 
> I think you should add back _dl_boot in elf_machine_load_address() but you probably
> need to define "extern void _dl_boot(void)" somewhere in dl-sysdep.h.
> I tried to add a "extern void _dl_boot(void)" into ldso.c, but it turns out that
> _dl_boot differs between archs.

I think something like this is needed:
OK, to commit?

Index: arm/dl-startup.h
===================================================================
--- arm/dl-startup.h	(revision 10009)
+++ arm/dl-startup.h	(working copy)
@@ -4,7 +4,7 @@
  * Copyright (C) 2000-2004 by Erik Andersen <andersen at codepoet.org>
  */
 
-void* _dl_boot(void);
+void _dl_boot(void);
 /* Overrive the default _dl_boot function, and replace it with a bit of asm.
  * Then call the real _dl_boot function, which is now named _dl_boot2. */
 asm(""						\
Index: powerpc/dl-startup.h
===================================================================
--- powerpc/dl-startup.h	(revision 10009)
+++ powerpc/dl-startup.h	(working copy)
@@ -2,6 +2,7 @@
  * will work as expected and cope with whatever platform specific wierdness is
  * needed for this architecture.  */
 
+void _dl_boot(void);
 /* Overrive the default _dl_boot function, and replace it with a bit of asm.
  * Then call the real _dl_boot function, which is now named _dl_boot2. */
 asm(
Index: ldso.c
===================================================================
--- ldso.c	(revision 10009)
+++ ldso.c	(working copy)
@@ -129,6 +129,11 @@
 		_dl_progname = argv[0];
 	}
 
+	if (_dl_boot == (void *) auxvt[AT_ENTRY].a_un.a_fcn) {
+		_dl_dprintf(2, "Standalone exection is not supported yet\n");
+		_dl_exit(1);
+	}
+
 	/* Start to build the tables of the modules that are required for
 	 * this beast to run.  We start with the basic executable, and then
 	 * go from there.  Eventually we will run across ourself, and we
Index: sh64/dl-startup.h
===================================================================
--- sh64/dl-startup.h	(revision 10009)
+++ sh64/dl-startup.h	(working copy)
@@ -2,7 +2,7 @@
  * will work as expected and cope with whatever platform specific wierdness is
  * needed for this architecture.
  */
-
+void _dl_boot(void);
 asm("" \
 "	.section .text..SHmedia32,\"ax\"\n"				\
 "	.globl _dl_boot\n"						\
Index: m68k/dl-startup.h
===================================================================
--- m68k/dl-startup.h	(revision 10009)
+++ m68k/dl-startup.h	(working copy)
@@ -1,7 +1,7 @@
 /*
  * Architecture specific code used by dl-startup.c
  */
-
+void _dl_boot(unsigned long args);
 /* For m68k we do not need any special setup so go right to _dl_boot() */
 #define DL_BOOT(X) __attribute_used__ void _dl_boot (X)
 
Index: i386/dl-startup.h
===================================================================
--- i386/dl-startup.h	(revision 10009)
+++ i386/dl-startup.h	(working copy)
@@ -3,7 +3,7 @@
  * Architecture specific code used by dl-startup.c
  * Copyright (C) 2000-2004 by Erik Andersen <andersen at codepoet.org>
  */
-
+void _dl_boot(unsigned long args);
 /* For x86 we do not need any special setup so go right to _dl_boot() */
 #define DL_BOOT(X) __attribute_used__ void _dl_boot (X)
 
Index: frv/dl-startup.h
===================================================================
--- frv/dl-startup.h	(revision 10009)
+++ frv/dl-startup.h	(working copy)
@@ -38,7 +38,7 @@
    _GLOBAL_OFFSET_TABLE_ as the last ROFIXUP entry, and that
    __self_reloc returns the relocated pointer to us, so that we can
    use this value to initialize the PIC register.  */
-
+void _dl_boot(void);
 asm("" \
 "	.text\n"			\
 "	.global	_dl_boot\n"		\
Index: cris/dl-startup.h
===================================================================
--- cris/dl-startup.h	(revision 10009)
+++ cris/dl-startup.h	(working copy)
@@ -4,6 +4,7 @@
 
 /* This code fixes the stack pointer so that the dynamic linker
  * can find argc, argv and auxvt (Auxillary Vector Table).  */
+void _dl_boot(void);
 asm(""					\
 "	.text\n"			\
 "	.globl _dl_boot\n"		\
Index: cris/dl-sysdep.h
===================================================================
--- cris/dl-sysdep.h	(revision 10009)
+++ cris/dl-sysdep.h	(working copy)
@@ -105,8 +105,8 @@
 {
 	Elf32_Addr gotaddr_diff;
 
-	__asm__ ("sub.d [$r0+_dl_parse:GOT16],$r0,%0\n\t"
-	         "add.d _dl_parse:GOTOFF,%0" : "=r" (gotaddr_diff));
+	__asm__ ("sub.d [$r0+_dl_boot:GOT16],$r0,%0\n\t"
+	         "add.d _dl_boot:GOTOFF,%0" : "=r" (gotaddr_diff));
 	return gotaddr_diff;
 }
 
Index: mips/dl-startup.h
===================================================================
--- mips/dl-startup.h	(revision 10009)
+++ mips/dl-startup.h	(working copy)
@@ -2,7 +2,7 @@
  * will work as expected and cope with whatever platform specific wierdness is
  * needed for this architecture.
  */
-
+void _dl_boot(void);
 asm("" \
 "	.text\n"			\
 "	.globl	_dl_boot\n"		\
Index: sparc/dl-startup.h
===================================================================
--- sparc/dl-startup.h	(revision 10009)
+++ sparc/dl-startup.h	(working copy)
@@ -3,7 +3,7 @@
  * needed for this architecture.  See arm/boot1_arch.h for an example of what
  * can be done.
  */
-
+void _dl_boot(unsigned long args);
 #define DL_BOOT(X) __attribute_used__ void _dl_boot (X)
 
 
Index: sh/dl-startup.h
===================================================================
--- sh/dl-startup.h	(revision 10009)
+++ sh/dl-startup.h	(working copy)
@@ -1,7 +1,7 @@
 /* Any assmbly language/system dependent hacks needed to setup boot1.c so it
  * will work as expected and cope with whatever platform specific wierdness is
  * needed for this architecture.  */
-
+void _dl_boot(void);
 asm("" \
 "	.text\n"			\
 "	.globl	_dl_boot\n"		\




More information about the uClibc mailing list