From 43bb514a1cc9641dfdb0f3ac20de48e2c17c0135 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 27 Sep 2010 15:52:40 +0000 Subject: [PATCH] gas/ * config/tc-tic6x.c (tic6x_fix_adjustable): New function. * config/tc-tic6x.h (tic6x_fix_adjustable): Declare. (tc_fix_adjustable): New macro. gas/testsuite/ * gas/tic6x/got-reloc.s: New test. * gas/tic6x/got-reloc.d: New test. --- gas/ChangeLog | 6 ++++++ gas/config/tc-tic6x.c | 19 +++++++++++++++++++ gas/config/tc-tic6x.h | 3 +++ gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/tic6x/got-reloc.d | 14 ++++++++++++++ gas/testsuite/gas/tic6x/got-reloc.s | 15 +++++++++++++++ 6 files changed, 62 insertions(+) create mode 100644 gas/testsuite/gas/tic6x/got-reloc.d create mode 100644 gas/testsuite/gas/tic6x/got-reloc.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 55a2202142d..56d5e411aea 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2010-09-27 Bernd Schmidt + + * config/tc-tic6x.c (tic6x_fix_adjustable): New function. + * config/tc-tic6x.h (tic6x_fix_adjustable): Declare. + (tc_fix_adjustable): New macro. + 2010-09-27 Andreas Krebbel * config/tc-s390.c: (md_parse_option): New option -march=z196. diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index ea750ba5c30..f1c28d0d3c1 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -1591,6 +1591,25 @@ tic6x_init_fix_data (fixS *fixP) fixP->tc_fix_data.fix_adda = FALSE; } +/* Return true if the fix can be handled by GAS, false if it must + be passed through to the linker. */ + +bfd_boolean +tic6x_fix_adjustable (fixS *fixP) +{ + switch (fixP->fx_r_type) + { + /* Adjust_reloc_syms doesn't know about the GOT. */ + case BFD_RELOC_C6000_SBR_GOT_U15_W: + case BFD_RELOC_C6000_SBR_GOT_H16_W: + case BFD_RELOC_C6000_SBR_GOT_L16_W: + return 0; + + default: + return 1; + } +} + /* Given the fine-grained form of an operand, return the coarse (bit-mask) form. */ diff --git a/gas/config/tc-tic6x.h b/gas/config/tc-tic6x.h index d4a37953246..a324c0273d7 100644 --- a/gas/config/tc-tic6x.h +++ b/gas/config/tc-tic6x.h @@ -147,6 +147,9 @@ extern void tic6x_start_line_hook (void); extern void tic6x_cons_fix_new (fragS *frag, int where, int size, expressionS *exp); +#define tc_fix_adjustable(FIX) tic6x_fix_adjustable (FIX) +extern bfd_boolean tic6x_fix_adjustable (struct fix *); + #define tc_frob_label(sym) tic6x_frob_label (sym) extern void tic6x_frob_label (symbolS *sym); diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 3c8f2c5b131..713ef5858fb 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-09-27 Bernd Schmidt + + * gas/tic6x/got-reloc.s: New test. + * gas/tic6x/got-reloc.d: New test. + 2010-09-27 Andreas Krebbel * gas/s390/s390.exp: Run the zarch-z196 test. diff --git a/gas/testsuite/gas/tic6x/got-reloc.d b/gas/testsuite/gas/tic6x/got-reloc.d new file mode 100644 index 00000000000..d3b5859bffe --- /dev/null +++ b/gas/testsuite/gas/tic6x/got-reloc.d @@ -0,0 +1,14 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: C6X GOT relocs +#as: -march=c674x -mlittle-endian + +.*: *file format elf32-tic6x-le + +Disassembly of section \.text: +0+00 <[^>]*> 0000006e[ \t]+ldw \.D2T2 \*\+b14\(0\),b0 +[ \t]*0: R_C6000_SBR_GOT_U15_W[ \t]+\.LC1 +0+04 <[^>]*> 0080002a[ \t]+mvk \.S2 0,b1 +[ \t]*4: R_C6000_SBR_GOT_L16_W[ \t]+\.LC1 +0+08 <[^>]*> 0080006a[ \t]+mvkh \.S2 0,b1 +[ \t]*8: R_C6000_SBR_GOT_H16_W[ \t]+\.LC1 +[ \t]*\.\.\. diff --git a/gas/testsuite/gas/tic6x/got-reloc.s b/gas/testsuite/gas/tic6x/got-reloc.s new file mode 100644 index 00000000000..8eceda33f73 --- /dev/null +++ b/gas/testsuite/gas/tic6x/got-reloc.s @@ -0,0 +1,15 @@ +# Test that no GOT relocs with an addend are produced. + .section .const.str1.1,"aMS",@progbits,1 +.LC0: + .string "foo" +.LC1: + .string "bar" +.text +.nocmp +.globl f +f: + ldw .d2t2 *+B14($GOT(.LC1)), B0 + mvkl .s2 $DPR_GOT(.LC1), B1 + mvkh .s2 $DPR_GOT(.LC1), B1 + + -- 2.30.2