Skip to content

Commit 621fd43

Browse files
clazissartemiy-volkov
authored andcommitted
[PIC] Emit @plt for calls
1 parent fbae3e7 commit 621fd43

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

gcc/config/arc64/arc64.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ get_arc64_condition_code (rtx comparison)
874874
'?': Short instruction suffix.
875875
'L': Lower 32bit of immediate or symbol.
876876
'h': Higher 32bit of an immediate or symbol.
877+
'C': Constant address, switches on/off @plt.
877878
*/
878879

879880
static void
@@ -959,6 +960,20 @@ arc64_print_operand (FILE *file, rtx x, int code)
959960
fputs (arc_condition_codes[get_arc64_condition_code (x)], file);
960961
break;
961962

963+
case 'C':
964+
if (GET_CODE (x) != SYMBOL_REF
965+
&& GET_CODE (x) != LABEL_REF)
966+
{
967+
output_operand_lossage ("invalid operand for %%C code");
968+
return;
969+
}
970+
output_addr_const (asm_out_file, x);
971+
if (flag_pic
972+
&& GET_CODE (x) == SYMBOL_REF
973+
&& !SYMBOL_REF_LOCAL_P (x))
974+
fputs ("@plt", file);
975+
break;
976+
962977
case 0:
963978
if (x == NULL)
964979
{

gcc/config/arc64/arc64.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ udivl, unknown, xor, xorl"
461461
"@
462462
jl_s\\t[%0]
463463
jl\\t[%0]
464-
bl\\t%c0"
464+
bl\\t%C0"
465465
[(set_attr "type" "jl,jl,bl")
466466
(set_attr "predicable" "no,yes,yes")
467467
(set_attr "length" "2,4,4")])
@@ -490,7 +490,7 @@ udivl, unknown, xor, xorl"
490490
"@
491491
jl_s\\t[%1]
492492
jl\\t[%1]
493-
bl\\t%c1"
493+
bl\\t%C1"
494494
[(set_attr "type" "jl,jl,bl")
495495
(set_attr "predicable" "no,yes,yes")
496496
(set_attr "length" "2,4,4")])
@@ -527,7 +527,7 @@ udivl, unknown, xor, xorl"
527527
"SIBLING_CALL_P (insn)"
528528
"@
529529
j\\t[%0]
530-
b\\t%c0"
530+
b\\t%C0"
531531
[(set_attr "type" "jump,branch")
532532
(set_attr "predicable" "yes,yes")
533533
(set_attr "iscompact" "maybe,no")]
@@ -541,7 +541,7 @@ udivl, unknown, xor, xorl"
541541
"SIBLING_CALL_P (insn)"
542542
"@
543543
j\\t[%1]
544-
b\\t%c1"
544+
b\\t%C1"
545545
[(set_attr "type" "jump,branch")
546546
(set_attr "predicable" "yes,yes")
547547
(set_attr "iscompact" "maybe,no")]

0 commit comments

Comments
 (0)