From 1f8876c786ee2ea08adca27e632a9197bb90ffe7 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Tue, 25 Apr 2017 14:04:36 +0200 Subject: [PATCH] [ARC] Fix calling multiple inheritances. The TARGET_ASM_OUTPUT_MI_THUNK hook doesn't take into account the variant when we compile for PIC. gcc/ 2017-04-25 Claudiu Zissulescu * config/arc/arc.c (arc_output_mi_thunk): Emit PIC calls. From-SVN: r247200 --- gcc/ChangeLog | 4 ++++ gcc/config/arc/arc.c | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5faeb0e..82ece70 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2017-04-25 Claudiu Zissulescu + * config/arc/arc.c (arc_output_mi_thunk): Emit PIC calls. + +2017-04-25 Claudiu Zissulescu + * config/arc/arc.c (arc_conditional_register_usage): Use ACCL, ACCH registers whenever they are available. diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 0c6b96f..cdf7a64 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -6302,10 +6302,28 @@ arc_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, fnaddr = XEXP (DECL_RTL (function), 0); if (arc_is_longcall_p (fnaddr)) - fputs ("\tj\t", file); + { + if (flag_pic) + { + asm_fprintf (file, "\tld\t%s, [pcl, @", + ARC_TEMP_SCRATCH_REG); + assemble_name (file, XSTR (fnaddr, 0)); + fputs ("@gotpc]\n", file); + asm_fprintf (file, "\tj\t[%s]", ARC_TEMP_SCRATCH_REG); + } + else + { + fputs ("\tj\t@", file); + assemble_name (file, XSTR (fnaddr, 0)); + } + } else - fputs ("\tb\t", file); - assemble_name (file, XSTR (fnaddr, 0)); + { + fputs ("\tb\t@", file); + assemble_name (file, XSTR (fnaddr, 0)); + if (flag_pic) + fputs ("@plt\n", file); + } fputc ('\n', file); } -- 2.7.4