diff options
Diffstat (limited to 'ports/sysdeps/arm/arm-mcount.S')
-rw-r--r-- | ports/sysdeps/arm/arm-mcount.S | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/ports/sysdeps/arm/arm-mcount.S b/ports/sysdeps/arm/arm-mcount.S index 8b8653c78e..7e433c6ff7 100644 --- a/ports/sysdeps/arm/arm-mcount.S +++ b/ports/sysdeps/arm/arm-mcount.S @@ -21,6 +21,7 @@ #include <sysdep.h> +#undef mcount #ifdef __thumb2__ .thumb @@ -65,10 +66,20 @@ ENTRY(__gnu_mcount_nc) END(__gnu_mcount_nc) +#include <gcc-compat.h> +#include <shlib-compat.h> + +/* The new __gnu_mcount_nc entry point was introduced in 4.4, so the + static library needs the old one only to support older compilers. + Even in a configuration that only cares about newer compilers, the + shared library might need it only for strict ABI compatibility. */ + +#if GCC_COMPAT (4, 3) || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_19) + /* Provide old mcount for backwards compatibility. This requires code be compiled with APCS frame pointers. */ -ENTRY(_mcount) +ENTRY(__mcount_arm_compat) push {r0, r1, r2, r3, fp, lr} cfi_adjust_cfa_offset (24) cfi_rel_offset (r0, 0) @@ -83,7 +94,7 @@ ENTRY(_mcount) ldrne r0, [\B, #-4] movsne r1, lr blne __mcount_internal -#if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__) +# if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__) pop {r0, r1, r2, r3, fp, lr} cfi_adjust_cfa_offset (-24) cfi_restore (r0) @@ -93,12 +104,26 @@ ENTRY(_mcount) cfi_restore (fp) cfi_restore (lr) bx lr -#else +# else pop {r0, r1, r2, r3, fp, pc} +# endif +END(__mcount_arm_compat) + #endif -END(_mcount) + +#if GCC_COMPAT (4, 3) + +strong_alias (__mcount_arm_compat, _mcount) /* The canonical name for the function is `_mcount' in both C and asm, but some old asm code might assume it's `mcount'. */ -#undef mcount weak_alias (_mcount, mcount) + +#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_19) + +compat_symbol (libc, __mcount_arm_compat, _mcount, GLIBC_2_0) + +strong_alias (__mcount_arm_compat, __mcount_arm_compat_1) +compat_symbol (libc, __mcount_arm_compat_1, mcount, GLIBC_2_0) + +#endif |