diff options
| author | Thomas Schwinge <thomas@codesourcery.com> | 2010-03-26 18:12:56 +0000 |
|---|---|---|
| committer | Joseph Myers <joseph@codesourcery.com> | 2010-03-26 18:12:56 +0000 |
| commit | 01b32e7361d68ade13d88f7245af778bb3ba02fd (patch) | |
| tree | 131b967fb0290ccbcaa5637e3a62dab96111bef6 | |
| parent | cca1fbbc2f53c8e515c76a2d61d1d5d826ae00d0 (diff) | |
| download | glibc-01b32e7361d68ade13d88f7245af778bb3ba02fd.tar.xz glibc-01b32e7361d68ade13d88f7245af778bb3ba02fd.zip | |
Add CFI statements to ARM's assembly code.
23 files changed, 561 insertions, 72 deletions
diff --git a/ChangeLog.arm b/ChangeLog.arm index fbd173ea84..aa8f2d777b 100644 --- a/ChangeLog.arm +++ b/ChangeLog.arm @@ -1,3 +1,53 @@ +2010-03-26 Thomas Schwinge <thomas@codesourcery.com> + + * sysdeps/arm/configure.in: New file. + * sysdeps/arm/configure: Generate. + * sysdeps/arm/sysdep.h (ENTRY, END): Add CFI statements. + * sysdeps/unix/arm/sysdep.S (__syscall_error): Likewise. + * sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h + (PSEUDO, DOCARGS_0, RESTORE_LR_0, DOCARGS_1, UNDOCARGS_1, DOCARGS_2) + (UNDOCARGS_2, DOCARGS_3, UNDOCARGS_3, DOCARGS_4, UNDOCARGS_4) + (DOCARGS_5, UNDOCARGS_5, RESTORE_LR_5, DOCARGS_6, UNDOCARGS_6): + Likewise. + [__ASSEMBLER__] (SINGLE_THREAD_P): Likewise. + * sysdeps/unix/sysv/linux/arm/eabi/sysdep.h (DO_CALL): Likewise. + * sysdeps/unix/sysv/linux/arm/sysdep.h + (POP_PC, SYSCALL_ERROR_HANDLER (__local_syscall_error)) + (DOARGS_5, UNDOARGS_5, DOARGS_6, UNDOARGS_6, DOARGS_7, UNDOARGS_7): + Likewise. + * sysdeps/unix/sysv/linux/arm/eabi/sigrestorer.S + (__default_sa_restorer_v1, __default_sa_restorer_v2) + (__default_rt_sa_restorer_v1, __default_rt_sa_restorer_v2): Add END + statements. + * sysdeps/unix/sysv/linux/arm/eabi/syscall.S (syscall): Add CFI + statements. + * sysdeps/arm/memcpy.S (memcpy): Add CFI statements. + * sysdeps/arm/memmove.S (memmove): Likewise. + * sysdeps/unix/sysv/linux/arm/eabi/mmap64.S (__mmap64): Add CFI + statements. + * sysdeps/unix/sysv/linux/arm/mmap.S (__mmap): Likewise. + * sysdeps/arm/eabi/arm-mcount.S (__gnu_mcount_nc, _mcount): Add CFI + statements. + * sysdeps/arm/sysdep.h (CALL_MCOUNT): Likewise. + * sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c + (_Unwind_Resume): Add CFI statements. + * sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c + (_Unwind_Resume): Likewise. + * sysdeps/arm/dl-trampoline.S (_dl_runtime_resolve) + (_dl_runtime_profile) <CFI>: Only emit .debug_frame. + * sysdeps/arm/eabi/__longjmp.S (__longjmp): Add CFI statements. + * sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S (CALL_FAIL) + (CHECK_SP): Likewise + * sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S (SAVE_PID): Add CFI + statements. + * sysdeps/unix/sysv/linux/arm/nptl/vfork.S (SAVE_PID): Likewise. + * sysdeps/unix/sysv/linux/arm/clone.S (__clone): Add CFI statements. + * sysdeps/unix/sysv/linux/arm/eabi/sigrestorer.S (cfi_startproc): + Redefine for signal frames. + (__default_sa_restorer_v1, __default_sa_restorer_v2) + (__default_rt_sa_restorer_v1, __default_rt_sa_restorer_v2): Add CFI + statements. + 2010-02-10 Joseph Myers <joseph@codesourcery.com> * sysdeps/arm/eabi/fegetenv.c, sysdeps/arm/fpu/fegetenv.c: Add diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure new file mode 100644 index 0000000000..066a8b69c5 --- /dev/null +++ b/sysdeps/arm/configure @@ -0,0 +1,33 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/arm. + +{ $as_echo "$as_me:$LINENO: checking whether the CFI directive .cfi_sections is supported" >&5 +$as_echo_n "checking whether the CFI directive .cfi_sections is supported... " >&6; } +if test "${libc_cv_asm_cfi_directive_sections+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat > conftest.s <<EOF + .text + .cfi_sections .debug_frame, .eh_frame + .cfi_startproc + .cfi_endproc +EOF + if { ac_try='${CC-cc} $ASFLAGS -c conftest.s 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + libc_cv_asm_cfi_directive_sections=yes + else + libc_cv_asm_cfi_directive_sections=no + fi + rm -f conftest* +fi +{ $as_echo "$as_me:$LINENO: result: $libc_cv_asm_cfi_directive_sections" >&5 +$as_echo "$libc_cv_asm_cfi_directive_sections" >&6; } +if test $libc_cv_asm_cfi_directive_sections != yes; then + { { $as_echo "$as_me:$LINENO: error: need .cfi_sections in this configuration" >&5 +$as_echo "$as_me: error: need .cfi_sections in this configuration" >&2;} + { (exit 1); exit 1; }; } +fi diff --git a/sysdeps/arm/configure.in b/sysdeps/arm/configure.in new file mode 100644 index 0000000000..9f4ff3b738 --- /dev/null +++ b/sysdeps/arm/configure.in @@ -0,0 +1,20 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/arm. + +AC_CACHE_CHECK([whether the CFI directive .cfi_sections is supported], + [libc_cv_asm_cfi_directive_sections], + [cat > conftest.s <<EOF + .text + .cfi_sections .debug_frame, .eh_frame + .cfi_startproc + .cfi_endproc +EOF + if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_asm_cfi_directive_sections=yes + else + libc_cv_asm_cfi_directive_sections=no + fi + rm -f conftest*]) +if test $libc_cv_asm_cfi_directive_sections != yes; then + AC_MSG_ERROR([need .cfi_sections in this configuration]) +fi diff --git a/sysdeps/arm/dl-trampoline.S b/sysdeps/arm/dl-trampoline.S index 0224fa1d1c..de8d891821 100644 --- a/sysdeps/arm/dl-trampoline.S +++ b/sysdeps/arm/dl-trampoline.S @@ -1,5 +1,5 @@ /* PLT trampolines. ARM version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,6 +29,7 @@ .text .globl _dl_runtime_resolve .type _dl_runtime_resolve, #function + .cfi_sections .debug_frame cfi_startproc .align 2 _dl_runtime_resolve: @@ -77,6 +78,7 @@ _dl_runtime_resolve: #ifndef PROF .globl _dl_runtime_profile .type _dl_runtime_profile, #function + .cfi_sections .debug_frame cfi_startproc .align 2 _dl_runtime_profile: diff --git a/sysdeps/arm/eabi/__longjmp.S b/sysdeps/arm/eabi/__longjmp.S index 305919393d..edabdad4a2 100644 --- a/sysdeps/arm/eabi/__longjmp.S +++ b/sysdeps/arm/eabi/__longjmp.S @@ -1,5 +1,6 @@ /* longjmp for ARM. - Copyright (C) 1997, 1998, 2005, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2005, 2006, 2009, 2010 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,10 +32,21 @@ ENTRY (__longjmp) moveq r0, #1 /* can't let setjmp() return zero! */ #ifdef CHECK_SP - ldr r4, [ip, #32] + ldr r4, [ip, #32] /* jmpbuf's sp */ + cfi_undefined (r4) CHECK_SP (r4) #endif LOADREGS(ia, ip!, {v1-v6, sl, fp, sp, lr}) + cfi_restore (v1) + cfi_restore (v2) + cfi_restore (v3) + cfi_restore (v4) + cfi_restore (v5) + cfi_restore (v6) + cfi_restore (sl) + cfi_restore (fp) + cfi_restore (sp) + cfi_restore (lr) #ifdef IS_IN_rtld ldr a2, 1f diff --git a/sysdeps/arm/eabi/arm-mcount.S b/sysdeps/arm/eabi/arm-mcount.S index 2aa50b70e7..06e5f182d8 100644 --- a/sysdeps/arm/eabi/arm-mcount.S +++ b/sysdeps/arm/eabi/arm-mcount.S @@ -1,5 +1,5 @@ /* Implementation of profiling support. ARM EABI version. - Copyright (C) 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,10 +46,22 @@ func: ENTRY(__gnu_mcount_nc) push {r0, r1, r2, r3, lr} + cfi_adjust_cfa_offset (20) + cfi_rel_offset (r0, 0) + cfi_rel_offset (r1, 4) + cfi_rel_offset (r2, 8) + cfi_rel_offset (r3, 12) + cfi_rel_offset (lr, 16) bic r1, lr, #1 ldr r0, [sp, #20] bl __mcount_internal pop {r0, r1, r2, r3, ip, lr} + cfi_adjust_cfa_offset (-24) + cfi_restore (r0) + cfi_restore (r1) + cfi_restore (r2) + cfi_restore (r3) + cfi_register (lr, ip) bx ip END(__gnu_mcount_nc) @@ -59,6 +71,13 @@ END(__gnu_mcount_nc) ENTRY(_mcount) stmdb sp!, {r0, r1, r2, r3, fp, lr} + cfi_adjust_cfa_offset (24) + cfi_rel_offset (r0, 0) + cfi_rel_offset (r1, 4) + cfi_rel_offset (r2, 8) + cfi_rel_offset (r3, 12) + cfi_rel_offset (fp, 16) + cfi_rel_offset (lr, 20) #ifdef __thumb2__ movs r0, fp ittt ne @@ -73,6 +92,13 @@ ENTRY(_mcount) ldmia sp!, {r0, r1, r2, r3, fp, pc} #else ldmia sp!, {r0, r1, r2, r3, fp, lr} + cfi_adjust_cfa_offset (-24) + cfi_restore (r0) + cfi_restore (r1) + cfi_restore (r2) + cfi_restore (r3) + cfi_restore (fp) + cfi_restore (lr) bx lr #endif END(_mcount) diff --git a/sysdeps/arm/memcpy.S b/sysdeps/arm/memcpy.S index 7f669a6e90..673bf43c48 100644 --- a/sysdeps/arm/memcpy.S +++ b/sysdeps/arm/memcpy.S @@ -58,6 +58,11 @@ ENTRY(memcpy) stmfd sp!, {r0, r4, lr} + cfi_adjust_cfa_offset (12) + cfi_rel_offset (r4, 4) + cfi_rel_offset (lr, 8) + + cfi_remember_state subs r2, r2, #4 blt 8f @@ -69,6 +74,11 @@ ENTRY(memcpy) 1: subs r2, r2, #(28) stmfd sp!, {r5 - r8} + cfi_adjust_cfa_offset (16) + cfi_rel_offset (r5, 0) + cfi_rel_offset (r6, 4) + cfi_rel_offset (r7, 8) + cfi_rel_offset (r8, 12) blt 5f CALGN( ands ip, r1, #31 ) @@ -121,6 +131,11 @@ ENTRY(memcpy) CALGN( bcs 2b ) 7: ldmfd sp!, {r5 - r8} + cfi_adjust_cfa_offset (-16) + cfi_restore (r5) + cfi_restore (r6) + cfi_restore (r7) + cfi_restore (r8) 8: movs r2, r2, lsl #31 ldrneb r3, [r1], #1 @@ -132,11 +147,16 @@ ENTRY(memcpy) #if defined (__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__) ldmfd sp!, {r0, r4, lr} + cfi_adjust_cfa_offset (-12) + cfi_restore (r4) + cfi_restore (lr) bx lr #else ldmfd sp!, {r0, r4, pc} #endif + cfi_restore_state + 9: rsb ip, ip, #4 cmp ip, #2 ldrgtb r3, [r1], #1 @@ -169,6 +189,12 @@ ENTRY(memcpy) CALGN( bcc 15f ) 11: stmfd sp!, {r5 - r9} + cfi_adjust_cfa_offset (20) + cfi_rel_offset (r5, 0) + cfi_rel_offset (r6, 4) + cfi_rel_offset (r7, 8) + cfi_rel_offset (r8, 12) + cfi_rel_offset (r9, 16) PLD( pld [r1, #0] ) PLD( subs r2, r2, #96 ) @@ -203,6 +229,12 @@ ENTRY(memcpy) PLD( bge 13b ) ldmfd sp!, {r5 - r9} + cfi_adjust_cfa_offset (-20) + cfi_restore (r5) + cfi_restore (r6) + cfi_restore (r7) + cfi_restore (r8) + cfi_restore (r9) 14: ands ip, r2, #28 beq 16f diff --git a/sysdeps/arm/memmove.S b/sysdeps/arm/memmove.S index 9c9b2344d2..026d8e2bd1 100644 --- a/sysdeps/arm/memmove.S +++ b/sysdeps/arm/memmove.S @@ -73,6 +73,12 @@ ENTRY(memmove) #endif stmfd sp!, {r0, r4, lr} + cfi_adjust_cfa_offset (12) + cfi_rel_offset (r4, 4) + cfi_rel_offset (lr, 8) + + cfi_remember_state + add r1, r1, r2 add r0, r0, r2 subs r2, r2, #4 @@ -85,6 +91,11 @@ ENTRY(memmove) 1: subs r2, r2, #(28) stmfd sp!, {r5 - r8} + cfi_adjust_cfa_offset (16) + cfi_rel_offset (r5, 0) + cfi_rel_offset (r6, 4) + cfi_rel_offset (r7, 8) + cfi_rel_offset (r8, 12) blt 5f CALGN( ands ip, r1, #31 ) @@ -136,6 +147,11 @@ ENTRY(memmove) CALGN( bcs 2b ) 7: ldmfd sp!, {r5 - r8} + cfi_adjust_cfa_offset (-16) + cfi_restore (r5) + cfi_restore (r6) + cfi_restore (r7) + cfi_restore (r8) 8: movs r2, r2, lsl #31 ldrneb r3, [r1, #-1]! @@ -144,13 +160,19 @@ ENTRY(memmove) strneb r3, [r0, #-1]! strcsb r4, [r0, #-1]! strcsb ip, [r0, #-1] + #if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__) ldmfd sp!, {r0, r4, lr} + cfi_adjust_cfa_offset (-12) + cfi_restore (r4) + cfi_restore (lr) bx lr #else ldmfd sp!, {r0, r4, pc} #endif + cfi_restore_state + 9: cmp ip, #2 ldrgtb r3, [r1, #-1]! ldrgeb r4, [r1, #-1]! @@ -182,6 +204,12 @@ ENTRY(memmove) CALGN( bcc 15f ) 11: stmfd sp!, {r5 - r9} + cfi_adjust_cfa_offset (20) + cfi_rel_offset (r5, 0) + cfi_rel_offset (r6, 4) + cfi_rel_offset (r7, 8) + cfi_rel_offset (r8, 12) + cfi_rel_offset (r9, 16) PLD( pld [r1, #-4] ) PLD( subs r2, r2, #96 ) @@ -216,6 +244,12 @@ ENTRY(memmove) PLD( bge 13b ) ldmfd sp!, {r5 - r9} + cfi_adjust_cfa_offset (-20) + cfi_restore (r5) + cfi_restore (r6) + cfi_restore (r7) + cfi_restore (r8) + cfi_restore (r9) 14: ands ip, r2, #28 beq 16f diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h index 442d3a146e..9ffd7df2b5 100644 --- a/sysdeps/arm/sysdep.h +++ b/sysdeps/arm/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for ARM. - Copyright (C) 1997, 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2003, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -81,18 +81,25 @@ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function) \ .align ALIGNARG(4); \ C_LABEL(name) \ + .cfi_sections .debug_frame; \ + cfi_startproc; \ CALL_MCOUNT #undef END #define END(name) \ + cfi_endproc; \ ASM_SIZE_DIRECTIVE(name) /* If compiled for profiling, call `mcount' at the start of each function. */ #ifdef PROF -#define CALL_MCOUNT \ - str lr,[sp, #-4]! ; \ - bl PLTJMP(mcount) ; \ - ldr lr, [sp], #4 ; +#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) #else #define CALL_MCOUNT /* Do nothing. */ #endif diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S index dcb427e57f..d3ad81b7bd 100644 --- a/sysdeps/unix/arm/sysdep.S +++ b/sysdeps/unix/arm/sysdep.S @@ -1,5 +1,5 @@ /* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2002, 2003, - 2004, 2005 + 2004, 2005, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -44,6 +44,7 @@ syscall_error: #if USE___THREAD mov ip, lr + cfi_register (lr, ip) mov r1, r0 mov r0, #0xffff0fff @@ -66,9 +67,13 @@ syscall_error: 1: .word C_SYMBOL_NAME(rtld_errno) - 0b - 8 #elif defined(_LIBC_REENTRANT) str lr, [sp, #-4]! + cfi_adjust_cfa_offset (4) + cfi_rel_offset (lr, 0) str r0, [sp, #-4]! + cfi_adjust_cfa_offset (4) bl PLTJMP(C_SYMBOL_NAME(__errno_location)) ldr r1, [sp], #4 + cfi_adjust_cfa_offset (-4) str r1, [r0] mvn r0, $0 ldr pc, [sp], #4 diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S index 1a19f5b558..178b0f1efd 100644 --- a/sysdeps/unix/sysv/linux/arm/clone.S +++ b/sysdeps/unix/sysv/linux/arm/clone.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2005, 2008, 2009 +/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2005, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Pat Beirne <patb@corelcomputer.com> @@ -52,8 +52,13 @@ ENTRY(__clone) @ new sp is already in r1 #ifdef __ARM_EABI__ stmfd sp!, {r4, r7} + cfi_adjust_cfa_offset (8) + cfi_rel_offset (r4, 0) + cfi_rel_offset (r7, 4) #else str r4, [sp, #-8]! + cfi_adjust_cfa_offset (8) + cfi_rel_offset (r4, 0) #endif ldr r2, [sp, #8] ldr r3, [sp, #12] @@ -64,6 +69,7 @@ ENTRY(__clone) #else swi SYS_ify(clone) #endif + cfi_endproc cmp r0, #0 beq 1f #ifdef __ARM_EABI__ @@ -74,6 +80,8 @@ ENTRY(__clone) blt PLTJMP(C_SYMBOL_NAME(__syscall_error)) RETINSTR(, lr) + cfi_startproc + cfi_undefined (lr) 1: #ifdef RESET_PID tst ip, #CLONE_THREAD diff --git a/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S b/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S index f92a382e44..423e7776ea 100644 --- a/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S +++ b/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S @@ -30,6 +30,7 @@ longjmp_msg: #ifdef PIC # define CALL_FAIL \ ldr sl, .L_GOT; \ + cfi_undefined (sl); \ .L_GOT_OFF: \ add sl, pc, sl; \ ldr r0, .Lstr; \ @@ -48,12 +49,17 @@ longjmp_msg: #endif #define CHECK_SP(reg) \ + cfi_remember_state; \ cmp sp, reg; \ bls .Lok; \ mov r5, r0; \ + cfi_undefined (r5); \ mov r7, #SYS_ify(sigaltstack); \ + cfi_undefined (r7); \ mov r0, #0; \ - sub sp, sp, #16; \ + sub sp, sp, #16; /* >= sizeof (stack_t) */ \ + cfi_adjust_cfa_offset (16); \ + cfi |
