From cd411309b5af27b1a02f324174d1caad98bc0927 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 14 May 2004 10:51:16 +0000 Subject: __data_start needs to be added to all crt0.S files that don't currently have it. It is used by the boehm gc, amoung other things. --- libc/sysdeps/linux/arm/crt0.S | 29 +++++++++++++++++++---------- libc/sysdeps/linux/cris/crt0.S | 12 ++++++------ libc/sysdeps/linux/e1/crt0.S | 9 +++++++++ libc/sysdeps/linux/frv/crt0.S | 13 +++++++++++-- libc/sysdeps/linux/h8300/crt0.S | 11 ++++++++++- libc/sysdeps/linux/i386/crt0.S | 12 ++++++++---- libc/sysdeps/linux/i960/crt0.S | 21 +++++++++++++++------ libc/sysdeps/linux/m68k/crt0.S | 9 +++++++++ libc/sysdeps/linux/microblaze/crt0.S | 13 +++++++++++-- libc/sysdeps/linux/mips/crt0.S | 11 ++++++++--- libc/sysdeps/linux/powerpc/crt0.S | 9 ++++++--- libc/sysdeps/linux/sh/crt0.S | 17 +++++++++++++---- libc/sysdeps/linux/sh64/crt0.S | 10 +++++++++- libc/sysdeps/linux/v850/crt0.S | 13 +++++++++++-- 14 files changed, 145 insertions(+), 44 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/arm/crt0.S b/libc/sysdeps/linux/arm/crt0.S index 84bc8cd74..6704a81e2 100644 --- a/libc/sysdeps/linux/arm/crt0.S +++ b/libc/sysdeps/linux/arm/crt0.S @@ -18,7 +18,7 @@ NULL env[0...N] environment variables (pointers) NULL - + When we are done here, we want a1=argc a2=argv[0] @@ -76,7 +76,7 @@ _start: /* Copy argv pointer into r1 -- which its final resting place */ mov r1, sp - /* Skip to the end of argv and put a pointer to whatever + /* Skip to the end of argv and put a pointer to whatever we find there (hopefully the environment) in r2 */ add r2, r1, r0, lsl #2 add r2, r2, #4 @@ -114,16 +114,25 @@ _start: */ .section ".note.ABI-tag", "a" .align 4 - .long 1f - 0f - .long 3f - 2f - .long 1 -0: .asciz "GNU" -1: .align 4 -2: .long 0 - .long 2,0,0 -3: .align 4 + .long 1f - 0f + .long 3f - 2f + .long 1 +0: .asciz "GNU" +1: .align 4 +2: .long 0 + .long 2,0,0 +3: .align 4 #if defined L_gcrt1 && defined __UCLIBC_PROFILING__ # include "./gmon-start.S" #endif + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/cris/crt0.S b/libc/sysdeps/linux/cris/crt0.S index b2f8d02a2..5b5834028 100644 --- a/libc/sysdeps/linux/cris/crt0.S +++ b/libc/sysdeps/linux/cris/crt0.S @@ -61,12 +61,12 @@ _start: 0: ba 0b nop - - ;; Define a symbol for the first piece of initialized data. - .data - .globl __data_start +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start __data_start: - .long 0 - .weak data_start + .long 0 + .weak data_start data_start = __data_start + diff --git a/libc/sysdeps/linux/e1/crt0.S b/libc/sysdeps/linux/e1/crt0.S index 3e63f5939..9d5e98d30 100644 --- a/libc/sysdeps/linux/e1/crt0.S +++ b/libc/sysdeps/linux/e1/crt0.S @@ -6,3 +6,12 @@ .global __start __start: call L1, 0, __uClibc_start + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/frv/crt0.S b/libc/sysdeps/linux/frv/crt0.S index 8a425158f..bd1030963 100644 --- a/libc/sysdeps/linux/frv/crt0.S +++ b/libc/sysdeps/linux/frv/crt0.S @@ -57,7 +57,7 @@ _start: setlo #gprello(.Lcall), gr5 sub.p gr4, gr5, gr4 /* gr4 now holds the _gp address. */ - + mov gr16, gr8 sethi.p #gprelhi(__ROFIXUP_LIST__), gr9 sethi #gprelhi(__ROFIXUP_END__), gr10 @@ -99,7 +99,7 @@ _start: #else mov.p gr17, gr15 call __uClibc_main -#endif +#endif /* Crash if somehow `exit' returns anyways. */ jmpl @(gr0,gr0) @@ -108,3 +108,12 @@ _start: #if defined L_gcrt1 && defined __UCLIBC_PROFILING__ # include "./gmon-start.S" #endif + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/h8300/crt0.S b/libc/sysdeps/linux/h8300/crt0.S index b94551b9d..dc7dc8b6d 100644 --- a/libc/sysdeps/linux/h8300/crt0.S +++ b/libc/sysdeps/linux/h8300/crt0.S @@ -37,7 +37,7 @@ _start: /* put here so that references to _start work with elf-PIC */ mov.l @(4,sp),er1 /* argv */ mov.l @(8,sp),er2 /* envp */ jsr @___uClibc_main - + /* If that didn't kill us, ... */ __exit: mov.l er0,er1 @@ -58,3 +58,12 @@ empty_func: .set atexit,empty_func #endif + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/i386/crt0.S b/libc/sysdeps/linux/i386/crt0.S index 3fd7a5e1f..213df9094 100644 --- a/libc/sysdeps/linux/i386/crt0.S +++ b/libc/sysdeps/linux/i386/crt0.S @@ -92,7 +92,7 @@ _start: pushl $_init #endif - /* Push envp, argc, and argc arguments to __uClibc_start_main() on the stack */ + /* Push envp, argc, and argc arguments to __uClibc_start_main() on the stack */ pushl %eax /* Environment pointer */ pushl %ebx /* Argument pointer */ pushl %ecx /* And the argument count */ @@ -104,7 +104,7 @@ _start: call __uClibc_start_main #endif #else - /* Push envp, argc, and argc arguments to __uClibc_start_main() on the stack */ + /* Push envp, argc, and argc arguments to __uClibc_start_main() on the stack */ pushl %eax /* Environment pointer */ pushl %ebx /* Argument pointer */ pushl %ecx /* And the argument count */ @@ -120,10 +120,14 @@ _start: hlt .size _start,.-_start - .section ".data" - .globl __data_start + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start __data_start: .long 0 + .weak data_start + data_start = __data_start #if defined L_gcrt1 && defined __UCLIBC_PROFILING__ # include "./gmon-start.S" diff --git a/libc/sysdeps/linux/i960/crt0.S b/libc/sysdeps/linux/i960/crt0.S index b235e5c50..b167ad71a 100644 --- a/libc/sysdeps/linux/i960/crt0.S +++ b/libc/sysdeps/linux/i960/crt0.S @@ -1,5 +1,5 @@ # -# clone.S, part of the i960 support for the uClibc library. +# crt0.S, part of the i960 support for the uClibc library. # # Copyright (C) 2002 by Okiok Data Ltd. http://www.okiok.com/ # @@ -19,7 +19,7 @@ # /* - * + * * The behavior in this file is tightly coupled with how the linux kernel sets things up * on the stack before calling us. * @@ -28,7 +28,7 @@ * * ^ * | <- sp somewhere around here, after being aligned. - * | + * | * |envp -> envp[0] * |argv -> argv[0] * |argc <- g13 @@ -37,13 +37,22 @@ * create_flat_tables_stack_grows_up in fs/binfmt_flat.c * * I believe having to use this register could probably be avoided. - * + * */ - + .globl start start: mov g13, r3 ldt (r3), g0 callx ___uClibc_main - + /* We might want to add some instruction so that it crashes if main returns */ + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/m68k/crt0.S b/libc/sysdeps/linux/m68k/crt0.S index 36546835c..44aca7fd1 100644 --- a/libc/sysdeps/linux/m68k/crt0.S +++ b/libc/sysdeps/linux/m68k/crt0.S @@ -61,3 +61,12 @@ empty_func: .set atexit,empty_func #endif + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/microblaze/crt0.S b/libc/sysdeps/linux/microblaze/crt0.S index 67416b329..99687b707 100644 --- a/libc/sysdeps/linux/microblaze/crt0.S +++ b/libc/sysdeps/linux/microblaze/crt0.S @@ -8,7 +8,7 @@ * This file is subject to the terms and conditions of the GNU Lesser * General Public License. See the file COPYING.LIB in the main * directory of this archive for more details. - * + * * Written by Miles Bader */ @@ -19,7 +19,7 @@ */ .text -C_ENTRY(_start): +C_ENTRY(_start): lw r5, r0, r1 // Arg 0: argc addi r6, r1, 4 // Arg 1: argv @@ -45,3 +45,12 @@ C_ENTRY(_start): we can be sure that `main' actually gets linked in. */ L_dummy_main_reference: .long C_SYMBOL_NAME(main) + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/mips/crt0.S b/libc/sysdeps/linux/mips/crt0.S index 7a79c433f..3ce8c9cd8 100644 --- a/libc/sysdeps/linux/mips/crt0.S +++ b/libc/sysdeps/linux/mips/crt0.S @@ -23,7 +23,7 @@ * we can be sure that main() actually gets linked in */ .type main,%function -__start: +__start: #ifdef __PIC__ .set noreorder bltzal zero,0f @@ -43,7 +43,7 @@ __start: /* multiple of 8 for longlong/double support */ la v0, _fini sw v0, 16(sp) /* stack has 5th argument, address of _fini */ - + /* Ok, now run uClibc's main() -- shouldn't return */ jal __uClibc_start_main @@ -53,6 +53,11 @@ __start: hlt: b hlt - .section ".data" +/* Define a symbol for the first piece of initialized data. */ + .data .globl __data_start __data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/powerpc/crt0.S b/libc/sysdeps/linux/powerpc/crt0.S index 24110850d..c3b903e1e 100644 --- a/libc/sysdeps/linux/powerpc/crt0.S +++ b/libc/sysdeps/linux/powerpc/crt0.S @@ -79,12 +79,15 @@ _start: #endif .size _start,.-_start - .section ".data" - .globl __data_start +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start __data_start: + .long 0 + .weak data_start + data_start = __data_start #if defined L_gcrt1 && defined __UCLIBC_PROFILING__ # include "./gmon-start.S" #endif - diff --git a/libc/sysdeps/linux/sh/crt0.S b/libc/sysdeps/linux/sh/crt0.S index 64dd3f493..a978b3fcf 100644 --- a/libc/sysdeps/linux/sh/crt0.S +++ b/libc/sysdeps/linux/sh/crt0.S @@ -70,7 +70,7 @@ _start: jmp @r0 nop -_start_end: +_start_end: .align 2 L_main: @@ -101,7 +101,7 @@ L_main: mov.l L_abort, r0 jmp @r0 nop -_start_end: +_start_end: .align 2 L_main: @@ -124,9 +124,18 @@ L_fini: #endif -L_abort: - .long abort +L_abort: + .long abort + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start #if defined L_gcrt1 && defined __UCLIBC_PROFILING__ # include "./gmon-start.S" #endif + diff --git a/libc/sysdeps/linux/sh64/crt0.S b/libc/sysdeps/linux/sh64/crt0.S index bd54ba5e2..271dfbaca 100644 --- a/libc/sysdeps/linux/sh64/crt0.S +++ b/libc/sysdeps/linux/sh64/crt0.S @@ -43,7 +43,7 @@ .section .text64,"xa" .align 2 /* 2^2 = 4 */ - + _start: /* Clear the frame pointer since this is the outermost frame. */ ### mov #0, r14 # qqq @@ -76,3 +76,11 @@ __main: ptabs/l r18,tr0 blink tr0,r63 +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/v850/crt0.S b/libc/sysdeps/linux/v850/crt0.S index fe36d0af8..11d7bb5aa 100644 --- a/libc/sysdeps/linux/v850/crt0.S +++ b/libc/sysdeps/linux/v850/crt0.S @@ -7,7 +7,7 @@ * This file is subject to the terms and conditions of the GNU Lesser * General Public License. See the file COPYING.LIB in the main * directory of this archive for more details. - * + * * Written by Miles Bader */ @@ -18,7 +18,7 @@ */ .text -C_ENTRY(start): +C_ENTRY(start): ld.w 0[sp], r6 // Arg 0: argc addi 4, sp, r7 // Arg 1: argv @@ -46,3 +46,12 @@ C_ENTRY(start): we can be sure that `main' actually gets linked in. */ L_dummy_main_reference: .long C_SYMBOL_NAME(main) + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + -- cgit v1.2.3