[prev in list] [next in list] [prev in thread] [next in thread]
List: uclibc-cvs
Subject: [uClibc-cvs] svn commit: trunk/uClibc: extra/Configs ldso/ldso libc/misc/inter etc...
From: jocke () uclibc ! org (jocke () uclibc ! org)
Date: 2005-05-28 17:44:11
Message-ID: 20050528234409.2070B865305 () codepoet ! org
[Download RAW message or body]
Author: jocke
Date: 2005-05-28 17:44:06 -0600 (Sat, 28 May 2005)
New Revision: 10434
Log:
Add Peter Mazinger fini/crt compat patch. Select DL_FINI_CRT_COMPAT to
be able to run apps built with 0.9.27. This also renames
__uClibc_start_main to __uClibc_main.
This compat option should be removed some time after 0.9.28 is released.
Let me know if you don't like this change.
Modified:
trunk/uClibc/Rules.mak
trunk/uClibc/extra/Configs/Config.in
trunk/uClibc/ldso/ldso/Makefile
trunk/uClibc/ldso/ldso/ldso.c
trunk/uClibc/libc/misc/internals/__uClibc_main.c
trunk/uClibc/libc/stdlib/atexit.c
trunk/uClibc/libc/sysdeps/linux/arm/Makefile
trunk/uClibc/libc/sysdeps/linux/arm/crt0.S
trunk/uClibc/libc/sysdeps/linux/i386/crt1.S
trunk/uClibc/libc/sysdeps/linux/mips/crt1.S
trunk/uClibc/libc/sysdeps/linux/powerpc/crt1.S
Changeset:
Modified: trunk/uClibc/Rules.mak
===================================================================
--- trunk/uClibc/Rules.mak 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/Rules.mak 2005-05-28 23:44:06 UTC (rev 10434)
@@ -307,6 +307,10 @@
CFLAGS += $(PICFLAG)
endif
+ifeq ($(DL_FINI_CRT_COMPAT),y)
+CFLAGS += -D_DL_FINI_CRT_COMPAT
+endif
+
ASFLAGS = $(CFLAGS)
ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
ASFLAGS += $(call check_as,--noexecstack)
Modified: trunk/uClibc/extra/Configs/Config.in
===================================================================
--- trunk/uClibc/extra/Configs/Config.in 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/extra/Configs/Config.in 2005-05-28 23:44:06 UTC (rev 10434)
@@ -264,6 +264,13 @@
WARNING: Changing the default prefix could cause problems with
binutils' ld !
+config DL_FINI_CRT_COMPAT
+ bool "uClibc 0.9.27 compatibility"
+ default n
+ help
+ Allows to update a 0.9.27 based system to new crt/fini handling.
+ After rebuilding all apps, this option can be disabled.
+
config UCLIBC_CTOR_DTOR
bool "Support global constructors and destructors"
default y
Modified: trunk/uClibc/ldso/ldso/Makefile
===================================================================
--- trunk/uClibc/ldso/ldso/Makefile 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/ldso/ldso/Makefile 2005-05-28 23:44:06 UTC (rev 10434)
@@ -28,6 +28,10 @@
endif
XXFLAGS=$(XWARNINGS) $(SSP_DISABLE_FLAGS)
+ifeq ($(DL_FINI_CRT_COMPAT),y)
+XXFLAGS+=-D_DL_FINI_CRT_COMPAT
+endif
+
ifeq ($(DODEBUG),y)
# Not really much point in including debugging info, since gdb
# can't really debug ldso, since gdb requires help from ldso to
Modified: trunk/uClibc/ldso/ldso/ldso.c
===================================================================
--- trunk/uClibc/ldso/ldso/ldso.c 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/ldso/ldso/ldso.c 2005-05-28 23:44:06 UTC (rev 10434)
@@ -806,7 +806,17 @@
(*dl_elf_func) ();
}
}
+#ifdef _DL_FINI_CRT_COMPAT
+ /* arches that have moved their ldso FINI handling should skip this part */
+ {
+ int (*_dl_atexit) (void *) = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit",
+ _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT);
+ if (_dl_atexit)
+ (*_dl_atexit) (_dl_fini);
+ }
+#endif
+
/* Find the real malloc function and make ldso functions use that from now on */
_dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash("malloc",
_dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT);
Modified: trunk/uClibc/libc/misc/internals/__uClibc_main.c
===================================================================
--- trunk/uClibc/libc/misc/internals/__uClibc_main.c 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/misc/internals/__uClibc_main.c 2005-05-28 23:44:06 UTC (rev 10434)
@@ -164,7 +164,7 @@
* are initialized, just before we call the application's main function.
*/
void __attribute__ ((__noreturn__))
-__uClibc_start_main(int (*main)(int, char **, char **), int argc,
+__uClibc_main(int (*main)(int, char **, char **), int argc,
char **argv, void (*app_init)(void), void (*app_fini)(void),
void (*rtld_fini)(void), void *stack_end)
{
@@ -253,3 +253,13 @@
*/
exit(main(argc, argv, __environ));
}
+
+#ifdef _DL_FINI_CRT_COMPAT
+extern int weak_function main(int argc, char **argv, char **envp);
+void __attribute__ ((__noreturn__))
+__uClibc_start_main(int argc, char **argv, char **envp,
+ void (*app_fini)(void), void (*app_init)(void))
+{
+ __uClibc_main(main, argc, argv, app_init, app_fini, NULL, NULL);
+}
+#endif
Modified: trunk/uClibc/libc/stdlib/atexit.c
===================================================================
--- trunk/uClibc/libc/stdlib/atexit.c 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/stdlib/atexit.c 2005-05-28 23:44:06 UTC (rev 10434)
@@ -239,8 +239,10 @@
if (__app_fini != NULL)
(__app_fini)();
#endif
+#ifndef _DL_FINI_CRT_COMPAT
if (__rtld_fini != NULL)
(__rtld_fini)();
+#endif
/* If we are using stdio, try to shut it down. At the very least,
* this will attempt to commit all buffered writes. It may also
Modified: trunk/uClibc/libc/sysdeps/linux/arm/Makefile
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/arm/Makefile 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/sysdeps/linux/arm/Makefile 2005-05-28 23:44:06 UTC (rev 10434)
@@ -20,7 +20,7 @@
include $(TOPDIR)Rules.mak
CRT0_SRC = crt0.S
-CRT0_OBJ = crt0.o crt1.o
+CRT0_OBJ = crt1.o
SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
@@ -41,11 +41,6 @@
echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
$(INSTALL) -d $(TOPDIR)lib/
cp $(CRT0_OBJ) $(SCRT0_OBJ) $(TOPDIR)lib/
-ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
- $(RM) $(TOPDIR)lib/Scrt0.o
-else
- mv $(TOPDIR)lib/Scrt0.o $(TOPDIR)lib/Scrt1.o
-endif
$(CRT0_OBJ): $(CRT0_SRC)
$(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
Modified: trunk/uClibc/libc/sysdeps/linux/arm/crt0.S
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/arm/crt0.S 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/sysdeps/linux/arm/crt0.S 2005-05-28 23:44:06 UTC (rev 10434)
@@ -51,13 +51,9 @@
.text
.global _start
.type _start,%function
-#if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__
- .type __uClibc_main,%function
-#else
.weak _init
.weak _fini
.type __uClibc_start_main,%function
-#endif
/* Stick in a dummy reference to main(), so that if an application
* is linking when the main() function is in a static library (.a)
* we can be sure that main() actually gets linked in */
@@ -92,7 +88,6 @@
ldr r2,[sp, #8]
#endif
-#if (defined L_crt1 ) && defined __UCLIBC_CTOR_DTOR__
#ifdef __PIC__
/* Store the address of _init in r3 as an argument to main() */
adr r5, .L_init
@@ -113,14 +108,11 @@
/* Ok, now run uClibc's main() -- shouldn't return */
bl __uClibc_start_main
-#else
- bl __uClibc_main
-#endif
/* Crash if somehow `exit' returns anyways. */
bl abort
-#if (defined L_crt1 ) && defined __UCLIBC_CTOR_DTOR__ && defined __PIC__
+#ifdef __PIC__
.L_init:
.word _init - .L_init
.word _fini - .L_init
Modified: trunk/uClibc/libc/sysdeps/linux/i386/crt1.S
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/i386/crt1.S 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/sysdeps/linux/i386/crt1.S 2005-05-28 23:44:06 UTC (rev 10434)
@@ -60,7 +60,7 @@
.type _init,%function
.type _fini,%function
.type main,%function
- .type __uClibc_start_main,%function
+ .type __uClibc_main,%function
_start:
/* Clear the frame pointer. The ABI suggests this be done, to mark
the outermost frame obviously. */
@@ -105,7 +105,7 @@
/* Call the user's main function, and exit with its value.
But let the libc call main. */
- call __uClibc_start_main@PLT
+ call __uClibc_main@PLT
#else
/* Push address of our own entry points to .fini and .init. */
pushl $_fini
@@ -118,7 +118,7 @@
/* Call the user's main function, and exit with its value.
But let the libc call main. */
- call __uClibc_start_main
+ call __uClibc_main
#endif
hlt /* Crash if somehow `exit' does return. */
Modified: trunk/uClibc/libc/sysdeps/linux/mips/crt1.S
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/mips/crt1.S 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/sysdeps/linux/mips/crt1.S 2005-05-28 23:44:06 UTC (rev 10434)
@@ -36,7 +36,6 @@
02111-1307 USA. */
-#include <features.h>
#include <sys/regdef.h>
@@ -65,7 +64,7 @@
/* We need to call:
- __uClibc_start_main (int (*main) (int, char **, char **), int argc,
+ __uClibc_main (int (*main) (int, char **, char **), int argc,
char **argv, void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void), void *stack_end)
*/
@@ -76,7 +75,7 @@
.type _init,%function
.type _fini,%function
.type main,%function
- .type __uClibc_start_main,%function
+ .type __uClibc_main,%function
__start:
#ifdef __PIC__
@@ -108,9 +107,9 @@
sw $8, 16($29) /* fini */
sw $2, 20($29) /* rtld_fini */
sw $29, 24($29) /* stack_end */
- jal __uClibc_start_main
+ jal __uClibc_main
hlt:
- /* Crash if somehow `__uClibc_start_main' returns anyway. */
+ /* Crash if somehow `__uClibc_main' returns anyway. */
b hlt
.size __start,.-__start
Modified: trunk/uClibc/libc/sysdeps/linux/powerpc/crt1.S
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/powerpc/crt1.S 2005-05-28 23:36:38 UTC (rev 10433)
+++ trunk/uClibc/libc/sysdeps/linux/powerpc/crt1.S 2005-05-28 23:44:06 UTC (rev 10434)
@@ -31,15 +31,13 @@
#define r13 13
#define r31 31
-#include <features.h>
-
.text
.globl _start
.type _start,%function
.type _init,%function
.type _fini,%function
.type main,%function
- .type __uClibc_start_main,%function
+ .type __uClibc_main,%function
_start:
mr r10,r1 /* Save the stack pointer */
@@ -64,7 +62,7 @@
lwz r6,_init@got(r31)
lwz r7,_fini@got(r31)
lwz r3,main@got(r31)
- b __uClibc_start_main@plt
+ b __uClibc_main@plt
# else
lis r6,_init@ha # load top 16 bits
addi r6,r6,_init@l # load bottom 16 bits
@@ -72,8 +70,9 @@
addi r7,r7,_fini@l # load bottom 16 bits
lis r3,main@ha # load top 16 bits
addi r3,r3,main@l # load bottom 16 bits
- b __uClibc_start_main
+ b __uClibc_main
# endif
+
.size _start,.-_start
/* Define a symbol for the first piece of initialized data. */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic