diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index b8bb89d..8160a00 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -468,6 +468,19 @@ static reloc_howto_type elf32_tic6x_howto_table[] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ + 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 (28), EMPTY_HOWTO (29), EMPTY_HOWTO (30), @@ -1040,6 +1053,19 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ + 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 (28), EMPTY_HOWTO (29), EMPTY_HOWTO (30), @@ -1900,6 +1926,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) @@ -2370,6 +2397,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) @@ -2693,6 +2721,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) { diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 6ff8006..cd24dff 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -345,6 +345,44 @@ s_tic6x_arch (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); } +/* Parse a .ehtype directive. */ + +static void +s_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_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; diff --git a/gas/doc/c-tic6x.texi b/gas/doc/c-tic6x.texi index 1116275..b1e04f9 100644 --- a/gas/doc/c-tic6x.texi +++ b/gas/doc/c-tic6x.texi @@ -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 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 index 0000000..c29ae68 --- /dev/null +++ b/ld/testsuite/ld-tic6x/ehtype-reloc-1-rel.d @@ -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 index 0000000..c14eeef --- /dev/null +++ b/ld/testsuite/ld-tic6x/ehtype-reloc-1.d @@ -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 index 0000000..46c6de4 --- /dev/null +++ b/ld/testsuite/ld-tic6x/ehtype-reloc-1.s @@ -0,0 +1,9 @@ +.globl s2 +.globl _start +.text +_start: +.ehtype s1 +.ehtype s2 +.data +s2: +.word 0x12345678