This patch is for the ARM architecture. It fixes the correct handover of the "--fix-v4bx" flag from gcc to the linker when the architecture doesn't support the thumb "bx lr" instruction. You'll also have to disable the USE_BX flag in the kernel configuration. The "bx lr" instruction is used by default in newer gccs and needs to be "fixed" by the linker or the assembler (see http://wiki.debian.org/ArmEabiPort). Signed-off-by: Sven Bachmann --- a/gcc/config/arm/bpabi.h +++ b/gcc/config/arm/bpabi.h @@ -57,6 +57,10 @@ #undef SUBTARGET_EXTRA_ASM_SPEC #define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC +/* Tell the linker to build BPABI binaries. */ +#undef SUBSUBTARGET_EXTRA_LINK_SPEC +#define SUBSUBTARGET_EXTRA_LINK_SPEC TARGET_FIX_V4BX_SPEC + #ifndef SUBTARGET_EXTRA_LINK_SPEC #define SUBTARGET_EXTRA_LINK_SPEC "" #endif --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -55,8 +55,15 @@ #define TARGET_LINKER_EMULATION "armelf_linux_eabi" #endif +/* Extra define to keep FIX_V4BX from bpabi.h if defined. */ +#ifndef SUBSUBTARGET_EXTRA_LINK_SPEC +#define SUBSUBTARGET_EXTRA_LINK_SPEC "" +#endif + #undef SUBTARGET_EXTRA_LINK_SPEC -#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION +#define SUBTARGET_EXTRA_LINK_SPEC \ + " -m " TARGET_LINKER_EMULATION \ + SUBSUBTARGET_EXTRA_LINK_SPEC /* Use ld-linux.so.3 so that it will be possible to run "classic" GNU/Linux binaries on an EABI system. */