From: Paul Brook Date: Tue, 3 May 2011 11:17:22 +0000 (+0000) Subject: 2011-05-03 Paul Brook X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2fbb87f62734ebbf166eb86c62ad4d569f1229cc;p=binutils-gdb.git 2011-05-03 Paul Brook 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4d155cd88ce..471118388f4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2011-05-03 Paul Brook + + + * 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 PR ld/12718 diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index b898aabf049..8b5f5cb4188 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -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) { diff --git a/gas/ChangeLog b/gas/ChangeLog index beb3847b0a6..37ef434f174 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2011-05-03 Paul Brook + + + * 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 * dw2gencfi.c (dwcfi_seg_list): New struct. diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 6ff80069204..15ce88a68e8 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_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; diff --git a/gas/doc/c-tic6x.texi b/gas/doc/c-tic6x.texi index 111627537bc..b1e04f9a7a1 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/ChangeLog b/ld/testsuite/ChangeLog index 8909846fa6e..6433199d199 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-05-03 Paul Brook + + + * 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 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 index 00000000000..c29ae6838bb --- /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 00000000000..c14eeefca1d --- /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 00000000000..46c6de40c4b --- /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