From: Alan Modra Date: Mon, 2 Mar 2009 13:53:31 +0000 (+0000) Subject: backport 2009-02-01 Jan Kratochvil X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10a61ece6bb26b6970fd39998ebff11896e57747;p=thirdparty%2Fbinutils-gdb.git backport 2009-02-01 Jan Kratochvil --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8e7c0594d65..112c8e5f318 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ 2009-03-02 Alan Modra + 2009-02-01 Jan Kratochvil + * elf-eh-frame.c (REQUIRE_CLEARED_RELOCS) Remove. + (_bfd_elf_parse_eh_frame): Do not check relocations for removed FDEs. + 2009-01-26 Nathan Sidwell * elf32-ppc.c (ppc_elf_relax_section): Add space for relocs describing the trampolines. diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 579a6b8967e..3567c240684 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -549,16 +549,6 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, < (bfd_size_type) ((buf) - ehbuf))) \ cookie->rel++ -#define REQUIRE_CLEARED_RELOCS(buf) \ - while (cookie->rel < cookie->relend \ - && (cookie->rel->r_offset \ - < (bfd_size_type) ((buf) - ehbuf))) \ - { \ - REQUIRE (cookie->rel->r_info == 0); \ - REQUIRE (cookie->rel->r_addend == 0); \ - cookie->rel++; \ - } - #define GET_RELOC(buf) \ ((cookie->rel < cookie->relend \ && (cookie->rel->r_offset \ @@ -817,16 +807,16 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, buf = last_fde + 4 + hdr_length; - /* Cleared FDE? The instructions will not be cleared but verify all - the relocation entries for them are cleared. */ - if (rsec == NULL) - { - REQUIRE_CLEARED_RELOCS (buf); - } - else - { - SKIP_RELOCS (buf); - } + /* For NULL RSEC (cleared FDE belonging to a discarded section) + the relocations are commonly cleared. We do not sanity check if + all these relocations are cleared as (1) relocations to + .gcc_except_table will remain uncleared (they will get dropped + with the drop of this unused FDE) and (2) BFD already safely drops + relocations of any type to .eh_frame by + elf_section_ignore_discarded_relocs. + TODO: The .gcc_except_table entries should be also filtered as + .eh_frame entries; or GCC could rather use COMDAT for them. */ + SKIP_RELOCS (buf); } /* Try to interpret the CFA instructions and find the first diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 45015f58905..54efd636faa 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2009-03-02 Alan Modra + 2009-02-01 Jan Kratochvil + * ld-elf/eh-group2.s: New `.cfi_lsda' referencing `.gcc_except_table'. + * ld-elf/eh-group.exp: New test and conditional defininiton of `ELF64'. + 2009-01-26 Nathan Sidwell * ld-powerpc/powerpc.exp: Add vxworks relax testcase. * ld-powerpc/vxworks-relax.s, ld-powerpc/vxworks-relax.rd: New. diff --git a/ld/testsuite/ld-elf/eh-group.exp b/ld/testsuite/ld-elf/eh-group.exp index c55e06ebc38..cc0789016a5 100644 --- a/ld/testsuite/ld-elf/eh-group.exp +++ b/ld/testsuite/ld-elf/eh-group.exp @@ -35,12 +35,28 @@ if {![check_as_cfi]} { return } -set build_tests_ld { - {"Build eh-group1.o" - "-r" "" - {eh-group1.s eh-group2.s} {} "eh-group.o"} +# alpha-linux-gnu does not support 64-bit relocations: +# relocation truncated to fit: REFLONG against `.gcc_except_table' +# arm-eabi does not support 64-bit relocations: +# bad relocation fixup type (1) +set testname "Guess the target size from eh-group1size.o" +if [ld_assemble $as "$srcdir/$subdir/eh-group1.s" "tmpdir/eh-group1size.o"] { + pass $testname +} else { + fail $testname } +set as_options "" +if [is_elf64 "tmpdir/eh-group1size.o"] { + set as_options "$as_options --defsym ELF64=1" +} + +set build_tests_ld [list \ + [list "Build eh-group1.o" \ + "-r" "$as_options" \ + {eh-group1.s eh-group2.s} {} "eh-group.o"] \ +] + run_ld_link_tests $build_tests_ld set testname "Link eh-group.o to eh-group" diff --git a/ld/testsuite/ld-elf/eh-group2.s b/ld/testsuite/ld-elf/eh-group2.s index 2ec89197a64..49b59de326c 100644 --- a/ld/testsuite/ld-elf/eh-group2.s +++ b/ld/testsuite/ld-elf/eh-group2.s @@ -1,4 +1,15 @@ .section sect, "axG", %progbits, sectgroup, comdat .cfi_startproc +# Test intention is that LSDA must be provided by the discarded FDE. +# DW_EH_PE_udata8 = 4 +# DW_EH_PE_udata4 = 3 + .ifdef ELF64 + .cfi_lsda 4, lsda + .else + .cfi_lsda 3, lsda + .endif .skip 16 .cfi_endproc + + .section .gcc_except_table, "a", %progbits +lsda: