2011-05-03 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Tue, 3 May 2011 11:17:22 +0000 (11:17 +0000)
committerPaul Brook <paul@codesourcery.com>
Tue, 3 May 2011 11:17:22 +0000 (11:17 +0000)
bfd/
* elf32-tic6x.c (elf32_tic6x_howto_table,
elf32_tic6x_howto_table_rel, (elf32_tic6x_gc_sweep_hook,
elf32_tic6x_relocate_section, elf32_tic6x_check_relocs):
Add R_C6000_EHTYPE.

gas/
* config/tc-tic6x.c (s_ehtype): New function.
(md_pseudo_table): Add "ehtype".
(tic6x_fix_adjustable, md_apply_fix): BFD_RELOC_C6000_EHTYPE.
* doc/c-tic6x.texi: Document .ehtype directive.

ld/testsuite/
* ld-tic6x/ehtype-reloc-1-rel.d: New test.
* ld-tic6x/ehtype-reloc-1.d: New test.
* ld-tic6x/ehtype-reloc-1.s: New test.

bfd/ChangeLog
bfd/elf32-tic6x.c
gas/ChangeLog
gas/config/tc-tic6x.c
gas/doc/c-tic6x.texi
ld/testsuite/ChangeLog
ld/testsuite/ld-tic6x/ehtype-reloc-1-rel.d [new file with mode: 0644]
ld/testsuite/ld-tic6x/ehtype-reloc-1.d [new file with mode: 0644]
ld/testsuite/ld-tic6x/ehtype-reloc-1.s [new file with mode: 0644]

index 4d155cd88ce9f0504131b74c636181cb01e6901c..471118388f4471713347a93fbc2baf72b10ad329 100644 (file)
@@ -1,3 +1,11 @@
+2011-05-03  Paul Brook  <paul@codesourcery.com>
+
+
+       * elf32-tic6x.c (elf32_tic6x_howto_table,
+       elf32_tic6x_howto_table_rel, (elf32_tic6x_gc_sweep_hook,
+       elf32_tic6x_relocate_section, elf32_tic6x_check_relocs):
+       Add R_C6000_EHTYPE.
+
 2011-05-01  Alan Modra  <amodra@gmail.com>
 
        PR ld/12718
index b898aabf049945c92d4e4be814b7d9924f391079..8b5f5cb4188b4305b81454b08e8cb3444f1a1f51 100644 (file)
@@ -468,7 +468,19 @@ static reloc_howto_type elf32_tic6x_howto_table[] =
         0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
-  EMPTY_HOWTO (28),
+  HOWTO (R_C6000_EHTYPE,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont,/* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_C6000_EHTYPE",      /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
   EMPTY_HOWTO (29),
   EMPTY_HOWTO (30),
   EMPTY_HOWTO (31),
@@ -1040,7 +1052,19 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] =
         0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
-  EMPTY_HOWTO (28),
+  HOWTO (R_C6000_EHTYPE,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont,/* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_C6000_EHTYPE",      /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
   EMPTY_HOWTO (29),
   EMPTY_HOWTO (30),
   EMPTY_HOWTO (31),
@@ -1853,6 +1877,7 @@ elf32_tic6x_gc_sweep_hook (bfd *abfd,
        case R_C6000_SBR_GOT_U15_W:
        case R_C6000_SBR_GOT_L16_W:
        case R_C6000_SBR_GOT_H16_W:
+       case R_C6000_EHTYPE:
          if (h != NULL)
            {
              if (h->got.refcount > 0)
@@ -2323,6 +2348,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
        case R_C6000_SBR_GOT_U15_W:
        case R_C6000_SBR_GOT_L16_W:
        case R_C6000_SBR_GOT_H16_W:
+       case R_C6000_EHTYPE:
          /* Relocation is to the entry for this symbol in the global
             offset table.  */
          if (htab->elf.sgot == NULL)
@@ -2646,6 +2672,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
        case R_C6000_SBR_GOT_U15_W:
        case R_C6000_SBR_GOT_L16_W:
        case R_C6000_SBR_GOT_H16_W:
+       case R_C6000_EHTYPE:
          /* This symbol requires a global offset table entry.  */
          if (h != NULL)
            {
index beb3847b0a684f81dc4f813a1c1da2a7238961b3..37ef434f174680b7db1aed6eabdd5a86eb0ca2ec 100644 (file)
@@ -1,3 +1,11 @@
+2011-05-03  Paul Brook  <paul@codesourcery.com>
+
+
+       * config/tc-tic6x.c (s_ehtype): New function.
+       (md_pseudo_table): Add "ehtype".
+       (tic6x_fix_adjustable, md_apply_fix): BFD_RELOC_C6000_EHTYPE.
+       * doc/c-tic6x.texi: Document .ehtype directive.
+
 2011-04-26  Kai Tietz  <ktietz@redhat.com>
 
        * dw2gencfi.c (dwcfi_seg_list): New struct.
index 6ff8006920439fcae330e7893e7b636c21bbcdfa..15ce88a68e8b727ac950d79629f6a373573033c9 100644 (file)
@@ -345,6 +345,44 @@ s_tic6x_arch (int ignored ATTRIBUTE_UNUSED)
   demand_empty_rest_of_line ();
 }
 
+/* Parse a .ehtype directive.  */
+
+static void
+s_tic6x_ehtype (int ignored ATTRIBUTE_UNUSED)
+{
+  expressionS exp;
+  char *p;
+
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
+  if (is_it_end_of_statement ())
+    {
+      demand_empty_rest_of_line ();
+      return;
+    }
+
+#ifdef md_cons_align
+  md_cons_align (4);
+#endif
+
+
+  expression (&exp);
+
+  if (exp.X_op != O_symbol)
+    {
+      as_bad (_("expected symbol"));
+      return;
+    }
+
+  p = frag_more (4);
+  fix_new_exp (frag_now, p - frag_now->fr_literal, 4,
+              &exp, 0, BFD_RELOC_C6000_EHTYPE);
+
+  demand_empty_rest_of_line ();
+}
+
 /* Parse a .nocmp directive.  */
 
 static void
@@ -535,6 +573,7 @@ const pseudo_typeS md_pseudo_table[] =
     { "nocmp", s_tic6x_nocmp, 0 },
     { "scomm", s_tic6x_scomm, 0 },
     { "word", cons, 4 },
+    { "ehtype", s_tic6x_ehtype, 0 },
     { 0, 0, 0 }
   };
 
@@ -1801,6 +1840,7 @@ tic6x_fix_adjustable (fixS *fixP)
     case BFD_RELOC_C6000_SBR_GOT_U15_W:
     case BFD_RELOC_C6000_SBR_GOT_H16_W:
     case BFD_RELOC_C6000_SBR_GOT_L16_W:
+    case BFD_RELOC_C6000_EHTYPE:
       return 0;
 
     default:
@@ -3508,6 +3548,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
   switch (fixP->fx_r_type)
     {
     case BFD_RELOC_NONE:
+    case BFD_RELOC_C6000_EHTYPE:
       /* Force output to the object file.  */
       fixP->fx_done = 0;
       break;
index 111627537bc7c0197c18c1363d45bb698953bc53..b1e04f9a7a12f9d4dec967c50dfcca4518887fef 100644 (file)
@@ -146,6 +146,10 @@ The @var{tag} is either an attribute number or one of
 @var{value} is either a @code{number}, @code{"string"}, or
 @code{number, "string"} depending on the tag.
 
+@cindex @code{.ehtype} directive, TIC6X
+@item .ehtype @var{symbol}
+Output an exception type table reference to @var{symbol}.
+
 @cindex @code{.nocmp} directive, TIC6X
 @item .nocmp
 Disallow use of C64x+ compact instructions in the current text
index 8909846fa6e48e6c9160ef5024c802670a41ed7a..6433199d199dd84663c1ed405080a2491153870c 100644 (file)
@@ -1,3 +1,10 @@
+2011-05-03  Paul Brook  <paul@codesourcery.com>
+
+
+       * ld-tic6x/ehtype-reloc-1-rel.d: New test.
+       * ld-tic6x/ehtype-reloc-1.d: New test.
+       * ld-tic6x/ehtype-reloc-1.s: New test.
+
 2011-05-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/12718
diff --git a/ld/testsuite/ld-tic6x/ehtype-reloc-1-rel.d b/ld/testsuite/ld-tic6x/ehtype-reloc-1-rel.d
new file mode 100644 (file)
index 0000000..c29ae68
--- /dev/null
@@ -0,0 +1,14 @@
+#name: EHTYPE relocations (REL)
+#as: -mlittle-endian -mgenerate-rel
+#ld: -melf32_tic6x_le --defsym s1=0x2a -Tdsbt-inrange.ld
+#source: ehtype-reloc-1.s
+#objdump: -s -j.data -j.text -j.got
+
+.*: *file format elf32-tic6x-le
+
+Contents of section .data:
+ 8018 78563412                             .*
+Contents of section .text:
+ 10000000 08000000 0c000000                    .*
+Contents of section .got:
+ 2001fff4 00000000 00000000 2a000000 18800000  .*
diff --git a/ld/testsuite/ld-tic6x/ehtype-reloc-1.d b/ld/testsuite/ld-tic6x/ehtype-reloc-1.d
new file mode 100644 (file)
index 0000000..c14eeef
--- /dev/null
@@ -0,0 +1,14 @@
+#name: EHTYPE relocations (RELA)
+#as: -mlittle-endian
+#ld: -melf32_tic6x_le --defsym s1=0x2a -Tdsbt-inrange.ld
+#source: ehtype-reloc-1.s
+#objdump: -s -j.data -j.text -j.got
+
+.*: *file format elf32-tic6x-le
+
+Contents of section .data:
+ 8018 78563412                             .*
+Contents of section .text:
+ 10000000 08000000 0c000000                    .*
+Contents of section .got:
+ 2001fff4 00000000 00000000 2a000000 18800000  .*
diff --git a/ld/testsuite/ld-tic6x/ehtype-reloc-1.s b/ld/testsuite/ld-tic6x/ehtype-reloc-1.s
new file mode 100644 (file)
index 0000000..46c6de4
--- /dev/null
@@ -0,0 +1,9 @@
+.globl s2
+.globl _start
+.text
+_start:
+.ehtype  s1
+.ehtype  s2
+.data
+s2:
+.word 0x12345678