diff options
Diffstat (limited to 'libc/ports/sysdeps/arm')
-rw-r--r-- | libc/ports/sysdeps/arm/__longjmp.S | 6 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/arm-mcount.S | 9 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/crti.S | 2 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/crtn.S | 2 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/dl-tlsdesc.S | 3 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/dl-trampoline.S | 6 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/frame.h | 6 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/memcpy.S | 2 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/memmove.S | 2 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/memset.S | 2 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/preconfigure | 7 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/setjmp.S | 6 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/strlen.S | 2 | ||||
-rw-r--r-- | libc/ports/sysdeps/arm/sysdep.h | 63 |
14 files changed, 73 insertions, 45 deletions
diff --git a/libc/ports/sysdeps/arm/__longjmp.S b/libc/ports/sysdeps/arm/__longjmp.S index 5c04f3645..a3a2a8aec 100644 --- a/libc/ports/sysdeps/arm/__longjmp.S +++ b/libc/ports/sysdeps/arm/__longjmp.S @@ -16,6 +16,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* ??? Needs more rearrangement for the LDM to handle thumb mode. */ +#define NO_THUMB #include <sysdep.h> #define _SETJMP_H #define _ASM @@ -105,12 +107,12 @@ ENTRY (__longjmp) #ifdef NEED_HWCAP # ifdef IS_IN_rtld -1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS .Lrtld_local_ro: .long C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF) # else # ifdef PIC -1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS .Lrtld_global_ro: .long C_SYMBOL_NAME(_rtld_global_ro)(GOT) # else diff --git a/libc/ports/sysdeps/arm/arm-mcount.S b/libc/ports/sysdeps/arm/arm-mcount.S index 6c2427139..679d042ba 100644 --- a/libc/ports/sysdeps/arm/arm-mcount.S +++ b/libc/ports/sysdeps/arm/arm-mcount.S @@ -24,8 +24,8 @@ #ifdef __thumb2__ .thumb - .syntax unified #endif + .syntax unified /* Use an assembly stub with a special ABI. The calling lr has been @@ -77,15 +77,10 @@ ENTRY(_mcount) cfi_rel_offset (r3, 12) cfi_rel_offset (fp, 16) cfi_rel_offset (lr, 20) -#ifdef __thumb2__ movs r0, fp ittt ne ldrne r0, [r0, #-4] -#else - movs fp, fp - ldrne r0, [fp, #-4] -#endif - movnes r1, lr + movsne r1, lr blne __mcount_internal #ifdef __thumb2__ ldmia sp!, {r0, r1, r2, r3, fp, pc} diff --git a/libc/ports/sysdeps/arm/crti.S b/libc/ports/sysdeps/arm/crti.S index 44e20f0c1..1d55ae27a 100644 --- a/libc/ports/sysdeps/arm/crti.S +++ b/libc/ports/sysdeps/arm/crti.S @@ -38,6 +38,8 @@ they can be called as functions. The symbols _init and _fini are magic and cause the linker to emit DT_INIT and DT_FINI. */ +/* Always build .init and .fini sections in ARM mode. */ +#define NO_THUMB #include <libc-symbols.h> #include <sysdep.h> diff --git a/libc/ports/sysdeps/arm/crtn.S b/libc/ports/sysdeps/arm/crtn.S index 5ff3661f1..a01eb0139 100644 --- a/libc/ports/sysdeps/arm/crtn.S +++ b/libc/ports/sysdeps/arm/crtn.S @@ -33,6 +33,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* Always build .init and .fini sections in ARM mode. */ +#define NO_THUMB #include <sysdep.h> /* crtn.S puts function epilogues in the .init and .fini sections diff --git a/libc/ports/sysdeps/arm/dl-tlsdesc.S b/libc/ports/sysdeps/arm/dl-tlsdesc.S index 0ae3abb38..7b4c8dfcb 100644 --- a/libc/ports/sysdeps/arm/dl-tlsdesc.S +++ b/libc/ports/sysdeps/arm/dl-tlsdesc.S @@ -29,7 +29,7 @@ .text @ emit debug information with cfi @ use arm-specific pseudos for unwinding itself - .cfi_sections .debug_frame + CFI_SECTIONS .hidden _dl_tlsdesc_return .global _dl_tlsdesc_return .type _dl_tlsdesc_return,#function @@ -116,6 +116,7 @@ _dl_tlsdesc_dynamic: ldr r3, [r1] ldr r2, [r0, r3, lsl #3] cmn r2, #1 + ittt ne ldrne r3, [r1, #4] addne r3, r2, r3 rsbne r0, r4, r3 diff --git a/libc/ports/sysdeps/arm/dl-trampoline.S b/libc/ports/sysdeps/arm/dl-trampoline.S index ebf221c85..561d8ae6f 100644 --- a/libc/ports/sysdeps/arm/dl-trampoline.S +++ b/libc/ports/sysdeps/arm/dl-trampoline.S @@ -16,6 +16,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* ??? Needs more rearrangement for the LDM to handle thumb mode. */ +#define NO_THUMB #include <sysdep.h> #include <libc-symbols.h> @@ -28,7 +30,7 @@ .text .globl _dl_runtime_resolve .type _dl_runtime_resolve, #function - .cfi_sections .debug_frame + CFI_SECTIONS cfi_startproc .align 2 _dl_runtime_resolve: @@ -77,7 +79,7 @@ _dl_runtime_resolve: #ifndef PROF .globl _dl_runtime_profile .type _dl_runtime_profile, #function - .cfi_sections .debug_frame + CFI_SECTIONS cfi_startproc .align 2 _dl_runtime_profile: diff --git a/libc/ports/sysdeps/arm/frame.h b/libc/ports/sysdeps/arm/frame.h index c5a8ed17e..db3529939 100644 --- a/libc/ports/sysdeps/arm/frame.h +++ b/libc/ports/sysdeps/arm/frame.h @@ -19,9 +19,9 @@ /* This is the APCS stack backtrace structure. */ struct layout { - struct layout *__unbounded next; - void *__unbounded sp; - void *__unbounded return_address; + struct layout *next; + void *sp; + void *return_address; }; #define FIRST_FRAME_POINTER ADVANCE_STACK_FRAME (__builtin_frame_address (0)) diff --git a/libc/ports/sysdeps/arm/memcpy.S b/libc/ports/sysdeps/arm/memcpy.S index d8164b4d7..98b9b47e3 100644 --- a/libc/ports/sysdeps/arm/memcpy.S +++ b/libc/ports/sysdeps/arm/memcpy.S @@ -17,6 +17,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* Thumb requires excessive IT insns here. */ +#define NO_THUMB #include <sysdep.h> /* diff --git a/libc/ports/sysdeps/arm/memmove.S b/libc/ports/sysdeps/arm/memmove.S index d33c1cef8..059ca7ac3 100644 --- a/libc/ports/sysdeps/arm/memmove.S +++ b/libc/ports/sysdeps/arm/memmove.S @@ -17,6 +17,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* Thumb requires excessive IT insns here. */ +#define NO_THUMB #include <sysdep.h> /* diff --git a/libc/ports/sysdeps/arm/memset.S b/libc/ports/sysdeps/arm/memset.S index 3152a84e8..9924cb911 100644 --- a/libc/ports/sysdeps/arm/memset.S +++ b/libc/ports/sysdeps/arm/memset.S @@ -16,6 +16,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* Thumb requires excessive IT insns here. */ +#define NO_THUMB #include <sysdep.h> /* void *memset (dstpp, c, len) */ diff --git a/libc/ports/sysdeps/arm/preconfigure b/libc/ports/sysdeps/arm/preconfigure index 20f6d91a1..6d61b1428 100644 --- a/libc/ports/sysdeps/arm/preconfigure +++ b/libc/ports/sysdeps/arm/preconfigure @@ -10,7 +10,7 @@ arm*) # an appropriate directory exists in sysdeps/arm archcppflag=`echo "" | $CC $CFLAGS $CPPFLAGS -E -dM - | - grep __ARM_ARCH | + grep '__ARM_ARCH_[0-9].*__' | sed -e 's/^#define //' -e 's/ .*//'` case x$archcppflag in @@ -28,7 +28,10 @@ arm*) machine=armv6t2 echo "Found compiler is configured for $machine" ;; - + x__ARM_ARCH_6*__) + machine=armv6 + echo "Found compiler is configured for $machine" + ;; *) machine=arm echo 2>&1 "arm/preconfigure: Did not find ARM architecture type; using default" diff --git a/libc/ports/sysdeps/arm/setjmp.S b/libc/ports/sysdeps/arm/setjmp.S index 4b7542ad3..6776cab38 100644 --- a/libc/ports/sysdeps/arm/setjmp.S +++ b/libc/ports/sysdeps/arm/setjmp.S @@ -16,6 +16,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* ??? Needs more rearrangement for the STM to handle thumb mode. */ +#define NO_THUMB #include <sysdep.h> #define _SETJMP_H #define _ASM @@ -91,12 +93,12 @@ ENTRY (__sigsetjmp) #ifdef NEED_HWCAP # ifdef IS_IN_rtld -1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS .Lrtld_local_ro: .long C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF) # else # ifdef PIC -1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS .Lrtld_global_ro: .long C_SYMBOL_NAME(_rtld_global_ro)(GOT) # else diff --git a/libc/ports/sysdeps/arm/strlen.S b/libc/ports/sysdeps/arm/strlen.S index 15e922118..2b947e240 100644 --- a/libc/ports/sysdeps/arm/strlen.S +++ b/libc/ports/sysdeps/arm/strlen.S @@ -16,6 +16,8 @@ License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ +/* Thumb requires excessive IT insns here. */ +#define NO_THUMB #include <sysdep.h> /* size_t strlen(const char *S) diff --git a/libc/ports/sysdeps/arm/sysdep.h b/libc/ports/sysdeps/arm/sysdep.h index 0e6f645e8..4af7429ac 100644 --- a/libc/ports/sysdeps/arm/sysdep.h +++ b/libc/ports/sysdeps/arm/sysdep.h @@ -58,40 +58,43 @@ #endif /* Define an entry point visible from C. */ -#define ENTRY(name) \ - .globl C_SYMBOL_NAME(name); \ - .type C_SYMBOL_NAME(name),%function; \ - .align ALIGNARG(4); \ - C_LABEL(name) \ - .cfi_sections .debug_frame; \ - cfi_startproc; \ - CALL_MCOUNT +#define ENTRY(name) \ + .globl C_SYMBOL_NAME(name); \ + .type C_SYMBOL_NAME(name),%function; \ + .align ALIGNARG(4); \ + C_LABEL(name) \ + CFI_SECTIONS; \ + cfi_startproc; \ + CALL_MCOUNT + +#define CFI_SECTIONS \ + .cfi_sections .debug_frame #undef END -#define END(name) \ - cfi_endproc; \ - ASM_SIZE_DIRECTIVE(name) +#define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(name) /* If compiled for profiling, call `mcount' at the start of each function. */ #ifdef PROF /* Call __gnu_mcount_nc if GCC >= 4.4. */ #if __GNUC_PREREQ(4,4) -#define CALL_MCOUNT \ - str lr,[sp, #-4]!; \ - cfi_adjust_cfa_offset (4); \ - cfi_rel_offset (lr, 0); \ - bl PLTJMP(mcount); \ - cfi_adjust_cfa_offset (-4); \ - cfi_restore (lr) +#define CALL_MCOUNT \ + str lr,[sp, #-4]!; \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (lr, 0); \ + bl PLTJMP(mcount); \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (lr) #else /* else call _mcount */ -#define CALL_MCOUNT \ - str lr,[sp, #-4]!; \ - cfi_adjust_cfa_offset (4); \ - cfi_rel_offset (lr, 0); \ - bl PLTJMP(mcount); \ - ldr lr, [sp], #4; \ - cfi_adjust_cfa_offset (-4); \ - cfi_restore (lr) +#define CALL_MCOUNT \ + str lr,[sp, #-4]!; \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (lr, 0); \ + bl PLTJMP(mcount); \ + ldr lr, [sp], #4; \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (lr) #endif #else #define CALL_MCOUNT /* Do nothing. */ @@ -115,3 +118,11 @@ .eabi_attribute 24, 1 #endif /* __ASSEMBLER__ */ + +/* This number is the offset from the pc at the current location. */ +/* ??? At the moment we're not turning on thumb mode in assembly. */ +#if defined(__thumb__) && !defined(__ASSEMBLER__) +# define PC_OFS 4 +#else +# define PC_OFS 8 +#endif |