There are situations when the range offered by the bl instruction is not sufficient to reach CRT routines. Thus, use a long jump construction.
gcc/ 2016-04-21 Claudiu Zissulescu <claz...@synopsys.com> * config/arc/arc.h (CRT_CALL_STATIC_FUNCTION): Use long calls. --- gcc/config/arc/arc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 0237e66..0c7e561 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1518,10 +1518,11 @@ extern enum arc_function_type arc_compute_function_type (struct function *); /* Called by crtstuff.c to make calls to function FUNCTION that are defined in SECTION_OP, and then to switch back to text section. */ #undef CRT_CALL_STATIC_FUNCTION -#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ - asm (SECTION_OP "\n\t" \ - "bl @" USER_LABEL_PREFIX #FUNC "\n" \ - TEXT_SECTION_ASM_OP); +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n\t" \ + "add r12,pcl,@" USER_LABEL_PREFIX #FUNC "@pcl\n\t" \ + "jl [r12]\n" \ + TEXT_SECTION_ASM_OP); /* This macro expands to the name of the scratch register r12, used for temporary calculations according to the ABI. */ -- 1.9.1