From 191d0518b9967a64fa8f947a5b042b4c162752ca Mon Sep 17 00:00:00 2001 From: Ulf Samuelsson Date: Fri, 12 Oct 2007 15:12:55 +0000 Subject: Add AVR32 support for uclibc-0-9-29 --- ...pointer-at-the-beginning-of-init-and-fini.patch | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 toolchain/uClibc/uClibc-0.9.29-load-got-pointer-at-the-beginning-of-init-and-fini.patch (limited to 'toolchain/uClibc/uClibc-0.9.29-load-got-pointer-at-the-beginning-of-init-and-fini.patch') diff --git a/toolchain/uClibc/uClibc-0.9.29-load-got-pointer-at-the-beginning-of-init-and-fini.patch b/toolchain/uClibc/uClibc-0.9.29-load-got-pointer-at-the-beginning-of-init-and-fini.patch new file mode 100644 index 000000000..27aa5a59c --- /dev/null +++ b/toolchain/uClibc/uClibc-0.9.29-load-got-pointer-at-the-beginning-of-init-and-fini.patch @@ -0,0 +1,68 @@ +From: Haavard Skinnemoen +Date: Wed, 19 Sep 2007 10:03:35 +0200 +Subject: [Avr-gnu-toolchain] [uClibc PATCH] Load GOT pointer at the + beginning of .init and .fini + +I don't know why this seems to have worked before, but the .init and +.fini sections typically consist of a bunch of mcalls using r6 as the +base pointer. This can cause "interesting" behaviour when r6 hasn't +been initialized to point to the GOT. + +Signed-off-by: Haavard Skinnemoen +--- + libc/sysdeps/linux/avr32/crti.S | 15 ++++++++++++--- + libc/sysdeps/linux/avr32/crtn.S | 4 ++-- + 2 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/libc/sysdeps/linux/avr32/crti.S b/libc/sysdeps/linux/avr32/crti.S +index 3e132d0..660f47c 100644 +--- a/libc/sysdeps/linux/avr32/crti.S ++++ b/libc/sysdeps/linux/avr32/crti.S +@@ -4,14 +4,23 @@ + .global _init + .type _init, @function + _init: +- /* Use a four-byte instruction to avoid NOPs */ +- stm --sp, r0-r7,lr ++ stm --sp, r6, lr ++ lddpc r6, 2f ++1: rsub r6, pc ++ rjmp 3f + .align 2 ++2: .long 1b - _GLOBAL_OFFSET_TABLE_ ++3: + + .section .fini + .align 2 + .global _fini + .type _fini, @function + _fini: +- stm --sp, r0-r7,lr ++ stm --sp, r6, lr ++ lddpc r6, 2f ++1: rsub r6, pc ++ rjmp 3f + .align 2 ++2: .long 1b - _GLOBAL_OFFSET_TABLE_ ++3: +diff --git a/libc/sysdeps/linux/avr32/crtn.S b/libc/sysdeps/linux/avr32/crtn.S +index 577adcc..f7d1040 100644 +--- a/libc/sysdeps/linux/avr32/crtn.S ++++ b/libc/sysdeps/linux/avr32/crtn.S +@@ -3,12 +3,12 @@ + .align 2 + .global _init + .type _init, @function +- ldm sp++, r0-r7,pc ++ ldm sp++, r6, pc + .size _init, . - _init + + .section .fini + .align 2 + .global _fini + .type _fini, @function +- ldm sp++, r0-r7,pc ++ ldm sp++, r6, pc + .size _fini, . - _fini +-- +1.5.3.1 -- cgit v1.2.3