gas/
authorBernd Schmidt <bernds@codesourcery.com>
Mon, 27 Sep 2010 15:52:40 +0000 (15:52 +0000)
committerBernd Schmidt <bernds@codesourcery.com>
Mon, 27 Sep 2010 15:52:40 +0000 (15:52 +0000)
* 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
gas/config/tc-tic6x.c
gas/config/tc-tic6x.h
gas/testsuite/ChangeLog
gas/testsuite/gas/tic6x/got-reloc.d [new file with mode: 0644]
gas/testsuite/gas/tic6x/got-reloc.s [new file with mode: 0644]

index 55a2202142df6890fd62905cc730a4987ec2abf4..56d5e411aea8142e7d6682b1a2f7029284d737be 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-27  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * 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  <Andreas.Krebbel@de.ibm.com>
 
        * config/tc-s390.c: (md_parse_option): New option -march=z196.
index ea750ba5c306125522239b4dc7937431060a19e6..f1c28d0d3c1d07df13528c3d013857c02dab04e7 100644 (file)
@@ -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.  */
 
index d4a37953246b04752d8422902f3a780e5b9da334..a324c0273d78b8b31ba3243526c487b26b081ba1 100644 (file)
@@ -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);
 
index 3c8f2c5b1314643d8091708246c01719a31188bd..713ef5858fbee0b83f4131aae36d169d77c8dbd3 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-27  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * gas/tic6x/got-reloc.s: New test.
+       * gas/tic6x/got-reloc.d: New test.
+
 2010-09-27  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * 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 (file)
index 0000000..d3b5859
--- /dev/null
@@ -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 (file)
index 0000000..8eceda3
--- /dev/null
@@ -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
+
+