From: Jakub Jelinek Date: Mon, 20 Jun 2011 13:18:52 +0000 (+0000) Subject: PR ld/12570 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e41b3a13792f24506443962d82207466bf9b9e39;p=binutils-gdb.git PR ld/12570 include/ * bfdlink.h (struct bfd_link_info): Add no_ld_generated_unwind_info option. ld/ * emultempl/elf32.em (OPTION_LD_GENERATED_UNWIND_INFO, OPTION_NO_LD_GENERATED_UNWIND_INFO): Define. (gld${EMULATION_NAME}_handle_option): Handle --ld-generated-unwind-info and --no-ld-generated-unwind-info. * ld.texinfo (--ld-generated-unwind-info, --no-ld-generated-unwind-info): Document. bfd/ * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Allow no relocations at all for linker created .eh_frame sections. (_bfd_elf_discard_section_eh_frame): Handle linker created .eh_frame sections with no relocations. * elf64-x86-64.c: Include dwarf2.h. (elf_x86_64_eh_frame_plt): New variable. (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Define. (struct elf_x86_64_link_hash_table): Add plt_eh_frame field. (elf_x86_64_create_dynamic_sections): Create and fill in .eh_frame section for .plt section. (elf_x86_64_size_dynamic_sections): Write .plt section size into .eh_frame FDE covering .plt section. (elf_x86_64_finish_dynamic_sections): Write .plt section start into .eh_frame FDE covering .plt section. Call _bfd_elf_write_section_eh_frame on htab->plt_eh_frame section. (elf_backend_plt_alignment): Define to 4. * elf32-i386.c: Include dwarf2.h. (elf_i386_eh_frame_plt): New variable. (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Define. (struct elf_i386_link_hash_table): Add plt_eh_frame field. (elf_i386_create_dynamic_sections): Create and fill in .eh_frame section for .plt section. (elf_i386_size_dynamic_sections): Write .plt section size into .eh_frame FDE covering .plt section. (elf_i386_finish_dynamic_sections): Write .plt section start into .eh_frame FDE covering .plt section. Call _bfd_elf_write_section_eh_frame on htab->plt_eh_frame section. (elf_backend_plt_alignment): Define to 4. ld/testsuite/ * ld-x86-64/x86-64.exp: Link some testcases with --no-ld-generated-unwind-info. * ld-x86-64/tlsbin.rd: Add --no-ld-generated-unwind-info to ld comment. * ld-x86-64/tlsdesc.dd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlsdesc.sd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-x86-64/tlsbindesc.rd: Likewise. * ld-x86-64/tlsbindesc.sd: Likewise. * ld-x86-64/tlsbin.td: Likewise. * ld-x86-64/tlsdesc.pd: Likewise. * ld-x86-64/tlsdesc.td: Likewise. * ld-x86-64/tlsbindesc.dd: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlsgdesc.rd: Likewise. * ld-x86-64/tlspic.sd: Likewise. * ld-x86-64/tlsbindesc.td: Likewise. * ld-x86-64/tlspic.td: Likewise. * ld-x86-64/tlsbin.sd: Likewise. * ld-x86-64/ilp32-4.d: Likewise. * ld-x86-64/tlsgdesc.dd: Add --no-ld-generated-unwind-info to ld comment. Adjust. * ld-x86-64/tlsdesc.rd: Likewise. * ld-x86-64/tlsgd6.dd: Adjust. * ld-x86-64/tlsgd5.dd: Likewise. * ld-i386/i386.exp: Link some testcases with --no-ld-generated-unwind-info. * ld-i386/tlsbin.rd: Add --no-ld-generated-unwind-info to ld comment.. * ld-i386/tlsdesc.dd: Likewise. * ld-i386/tlspic.dd: Likewise. * ld-i386/tlsdesc.sd: Likewise. * ld-i386/tlsgdesc.dd: Likewise. * ld-i386/tlsnopic.sd: Likewise. * ld-i386/tlspic.rd: Likewise. * ld-i386/tlsdesc.rd: Likewise. * ld-i386/tlsbindesc.rd: Likewise. * ld-i386/tlsbindesc.sd: Likewise. * ld-i386/tlsbin.td: Likewise. * ld-i386/tlsdesc.td: Likewise. * ld-i386/tlsnopic.dd: Likewise. * ld-i386/tlsbindesc.dd: Likewise. * ld-i386/tlsbin.dd: Likewise. * ld-i386/tlsgdesc.rd: Likewise. * ld-i386/tlspic.sd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlsbindesc.td: Likewise. * ld-i386/tlspic.td: Likewise. * ld-i386/tlsbin.sd: Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9536f022aea..327f83b062a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,37 @@ +2011-06-20 Jakub Jelinek + + PR ld/12570 + * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Allow no relocations + at all for linker created .eh_frame sections. + (_bfd_elf_discard_section_eh_frame): Handle linker created + .eh_frame sections with no relocations. + * elf64-x86-64.c: Include dwarf2.h. + (elf_x86_64_eh_frame_plt): New variable. + (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, + PLT_FDE_LEN_OFFSET): Define. + (struct elf_x86_64_link_hash_table): Add plt_eh_frame field. + (elf_x86_64_create_dynamic_sections): Create and fill in + .eh_frame section for .plt section. + (elf_x86_64_size_dynamic_sections): Write .plt section size + into .eh_frame FDE covering .plt section. + (elf_x86_64_finish_dynamic_sections): Write .plt section + start into .eh_frame FDE covering .plt section. Call + _bfd_elf_write_section_eh_frame on htab->plt_eh_frame section. + (elf_backend_plt_alignment): Define to 4. + * elf32-i386.c: Include dwarf2.h. + (elf_i386_eh_frame_plt): New variable. + (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, + PLT_FDE_LEN_OFFSET): Define. + (struct elf_i386_link_hash_table): Add plt_eh_frame field. + (elf_i386_create_dynamic_sections): Create and fill in + .eh_frame section for .plt section. + (elf_i386_size_dynamic_sections): Write .plt section size + into .eh_frame FDE covering .plt section. + (elf_i386_finish_dynamic_sections): Write .plt section + start into .eh_frame FDE covering .plt section. Call + _bfd_elf_write_section_eh_frame on htab->plt_eh_frame section. + (elf_backend_plt_alignment): Define to 4. + 2011-06-19 H.J. Lu * elf64-x86-64.c (elf_backend_post_process_headers): Defined diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 21041a5b408..54142b29526 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -778,8 +778,6 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, } else { - asection *rsec; - /* Find the corresponding CIE. */ unsigned int cie_offset = this_inf->offset + 4 - hdr_id; for (cie = local_cies; cie < local_cies + cie_count; cie++) @@ -795,17 +793,22 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, = cie->cie_inf->add_augmentation_size; ENSURE_NO_RELOCS (buf); - REQUIRE (GET_RELOC (buf)); - - /* Chain together the FDEs for each section. */ - rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie); - /* RSEC will be NULL if FDE was cleared out as it was belonging to - a discarded SHT_GROUP. */ - if (rsec) + if ((sec->flags & SEC_LINKER_CREATED) == 0 || cookie->rels != NULL) { - REQUIRE (rsec->owner == abfd); - this_inf->u.fde.next_for_section = elf_fde_list (rsec); - elf_fde_list (rsec) = this_inf; + asection *rsec; + + REQUIRE (GET_RELOC (buf)); + + /* Chain together the FDEs for each section. */ + rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie); + /* RSEC will be NULL if FDE was cleared out as it was belonging to + a discarded SHT_GROUP. */ + if (rsec) + { + REQUIRE (rsec->owner == abfd); + this_inf->u.fde.next_for_section = elf_fde_list (rsec); + elf_fde_list (rsec) = this_inf; + } } /* Skip the initial location and address range. */ @@ -1141,6 +1144,9 @@ _bfd_elf_discard_section_eh_frame if (sec_info == NULL) return FALSE; + ptr_size = (get_elf_backend_data (sec->owner) + ->elf_backend_eh_frame_address_size (sec->owner, sec)); + hdr_info = &elf_hash_table (info)->eh_info; for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent) if (ent->size == 4) @@ -1149,11 +1155,25 @@ _bfd_elf_discard_section_eh_frame ent->removed = sec->map_head.s != NULL; else if (!ent->cie) { - cookie->rel = cookie->rels + ent->reloc_index; - /* FIXME: octets_per_byte. */ - BFD_ASSERT (cookie->rel < cookie->relend - && cookie->rel->r_offset == ent->offset + 8); - if (!(*reloc_symbol_deleted_p) (ent->offset + 8, cookie)) + bfd_boolean keep; + if ((sec->flags & SEC_LINKER_CREATED) != 0 && cookie->rels == NULL) + { + unsigned int width + = get_DW_EH_PE_width (ent->fde_encoding, ptr_size); + bfd_vma value + = read_value (abfd, sec->contents + ent->offset + 8 + width, + width, get_DW_EH_PE_signed (ent->fde_encoding)); + keep = value != 0; + } + else + { + cookie->rel = cookie->rels + ent->reloc_index; + /* FIXME: octets_per_byte. */ + BFD_ASSERT (cookie->rel < cookie->relend + && cookie->rel->r_offset == ent->offset + 8); + keep = !(*reloc_symbol_deleted_p) (ent->offset + 8, cookie); + } + if (keep) { if (info->shared && (((ent->fde_encoding & 0x70) == DW_EH_PE_absptr @@ -1182,8 +1202,6 @@ _bfd_elf_discard_section_eh_frame sec_info->cies = NULL; } - ptr_size = (get_elf_backend_data (sec->owner) - ->elf_backend_eh_frame_address_size (sec->owner, sec)); offset = 0; for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent) if (!ent->removed) diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 05962a07f7f..581272fa7c1 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -29,6 +29,7 @@ #include "bfd_stdint.h" #include "objalloc.h" #include "hashtab.h" +#include "dwarf2.h" /* 386 uses REL relocations instead of RELA. */ #define USE_REL 1 @@ -574,6 +575,45 @@ static const bfd_byte elf_i386_pic_plt_entry[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; +/* .eh_frame covering the .plt section. */ + +static const bfd_byte elf_i386_eh_frame_plt[] = +{ +#define PLT_CIE_LENGTH 20 +#define PLT_FDE_LENGTH 36 +#define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8 +#define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12 + PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */ + 0, 0, 0, 0, /* CIE ID */ + 1, /* CIE version */ + 'z', 'R', 0, /* Augmentation string */ + 1, /* Code alignment factor */ + 0x7c, /* Data alignment factor */ + 8, /* Return address column */ + 1, /* Augmentation size */ + DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */ + DW_CFA_def_cfa, 4, 4, /* DW_CFA_def_cfa: r4 (esp) ofs 4 */ + DW_CFA_offset + 8, 1, /* DW_CFA_offset: r8 (eip) at cfa-4 */ + DW_CFA_nop, DW_CFA_nop, + + PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */ + PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */ + 0, 0, 0, 0, /* R_386_PC32 .plt goes here */ + 0, 0, 0, 0, /* .plt size goes here */ + 0, /* Augmentation size */ + DW_CFA_def_cfa_offset, 8, /* DW_CFA_def_cfa_offset: 8 */ + DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */ + DW_CFA_def_cfa_offset, 12, /* DW_CFA_def_cfa_offset: 12 */ + DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */ + DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */ + 11, /* Block length */ + DW_OP_breg4, 4, /* DW_OP_breg4 (esp): 4 */ + DW_OP_breg8, 0, /* DW_OP_breg8 (eip): 0 */ + DW_OP_lit15, DW_OP_and, DW_OP_lit11, DW_OP_ge, + DW_OP_lit3, DW_OP_shl, DW_OP_plus, + DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop +}; + /* On VxWorks, the .rel.plt.unloaded section has absolute relocations for the PLTResolve stub and then for each PLT entry. */ #define PLTRESOLVE_RELOCS_SHLIB 0 @@ -655,6 +695,7 @@ struct elf_i386_link_hash_table /* Short-cuts to get to dynamic linker sections. */ asection *sdynbss; asection *srelbss; + asection *plt_eh_frame; union { @@ -887,6 +928,25 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) &htab->srelplt2)) return FALSE; + if (!info->no_ld_generated_unwind_info + && bfd_get_section_by_name (dynobj, ".eh_frame") == NULL + && htab->elf.splt != NULL) + { + flagword flags = get_elf_backend_data (dynobj)->dynamic_sec_flags; + htab->plt_eh_frame + = bfd_make_section_with_flags (dynobj, ".eh_frame", + flags | SEC_READONLY); + if (htab->plt_eh_frame == NULL + || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame, 2)) + return FALSE; + + htab->plt_eh_frame->size = sizeof (elf_i386_eh_frame_plt); + htab->plt_eh_frame->contents + = bfd_alloc (dynobj, htab->plt_eh_frame->size); + memcpy (htab->plt_eh_frame->contents, elf_i386_eh_frame_plt, + sizeof (elf_i386_eh_frame_plt)); + } + return TRUE; } @@ -2667,6 +2727,13 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return FALSE; } + if (htab->plt_eh_frame != NULL + && htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && (htab->elf.splt->flags & SEC_EXCLUDE) == 0) + bfd_put_32 (dynobj, htab->elf.splt->size, + htab->plt_eh_frame->contents + PLT_FDE_LEN_OFFSET); + if (htab->elf.dynamic_sections_created) { /* Add some entries to the .dynamic section. We fill in the @@ -4667,6 +4734,33 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize = 4; } + /* Adjust .eh_frame for .plt section. */ + if (htab->plt_eh_frame != NULL) + { + if (htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && (htab->elf.splt->flags & SEC_EXCLUDE) == 0 + && htab->elf.splt->output_section != NULL + && htab->plt_eh_frame->output_section != NULL) + { + bfd_vma plt_start = htab->elf.splt->output_section->vma; + bfd_vma eh_frame_start = htab->plt_eh_frame->output_section->vma + + htab->plt_eh_frame->output_offset + + PLT_FDE_START_OFFSET; + bfd_put_signed_32 (dynobj, plt_start - eh_frame_start, + htab->plt_eh_frame->contents + + PLT_FDE_START_OFFSET); + } + if (htab->plt_eh_frame->sec_info_type + == ELF_INFO_TYPE_EH_FRAME) + { + if (! _bfd_elf_write_section_eh_frame (output_bfd, info, + htab->plt_eh_frame, + htab->plt_eh_frame->contents)) + return FALSE; + } + } + if (htab->elf.sgot && htab->elf.sgot->size > 0) elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4; @@ -4734,6 +4828,7 @@ elf_i386_add_symbol_hook (bfd * abfd, #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 +#define elf_backend_plt_alignment 4 /* Support RELA for objdump of prelink objects. */ #define elf_info_to_howto elf_i386_info_to_howto_rel diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index a9297972960..37349f9fd22 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -29,6 +29,7 @@ #include "bfd_stdint.h" #include "objalloc.h" #include "hashtab.h" +#include "dwarf2.h" #include "elf/x86-64.h" @@ -528,6 +529,45 @@ static const bfd_byte elf_x86_64_plt_entry[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* replaced with offset to start of .plt0. */ }; +/* .eh_frame covering the .plt section. */ + +static const bfd_byte elf_x86_64_eh_frame_plt[] = +{ +#define PLT_CIE_LENGTH 20 +#define PLT_FDE_LENGTH 36 +#define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8 +#define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12 + PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */ + 0, 0, 0, 0, /* CIE ID */ + 1, /* CIE version */ + 'z', 'R', 0, /* Augmentation string */ + 1, /* Code alignment factor */ + 0x78, /* Data alignment factor */ + 16, /* Return address column */ + 1, /* Augmentation size */ + DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */ + DW_CFA_def_cfa, 7, 8, /* DW_CFA_def_cfa: r7 (rsp) ofs 8 */ + DW_CFA_offset + 16, 1, /* DW_CFA_offset: r16 (rip) at cfa-8 */ + DW_CFA_nop, DW_CFA_nop, + + PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */ + PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */ + 0, 0, 0, 0, /* R_X86_64_PC32 .plt goes here */ + 0, 0, 0, 0, /* .plt size goes here */ + 0, /* Augmentation size */ + DW_CFA_def_cfa_offset, 16, /* DW_CFA_def_cfa_offset: 16 */ + DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */ + DW_CFA_def_cfa_offset, 24, /* DW_CFA_def_cfa_offset: 24 */ + DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */ + DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */ + 11, /* Block length */ + DW_OP_breg7, 8, /* DW_OP_breg7 (rsp): 8 */ + DW_OP_breg16, 0, /* DW_OP_breg16 (rip): 0 */ + DW_OP_lit15, DW_OP_and, DW_OP_lit11, DW_OP_ge, + DW_OP_lit3, DW_OP_shl, DW_OP_plus, + DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop +}; + /* x86-64 ELF linker hash entry. */ struct elf_x86_64_link_hash_entry @@ -601,6 +641,7 @@ struct elf_x86_64_link_hash_table /* Short-cuts to get to dynamic linker sections. */ asection *sdynbss; asection *srelbss; + asection *plt_eh_frame; union { @@ -847,6 +888,24 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj, || (!info->shared && !htab->srelbss)) abort (); + if (!info->no_ld_generated_unwind_info + && bfd_get_section_by_name (dynobj, ".eh_frame") == NULL + && htab->elf.splt != NULL) + { + flagword flags = get_elf_backend_data (dynobj)->dynamic_sec_flags; + htab->plt_eh_frame + = bfd_make_section_with_flags (dynobj, ".eh_frame", + flags | SEC_READONLY); + if (htab->plt_eh_frame == NULL + || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame, 3)) + return FALSE; + + htab->plt_eh_frame->size = sizeof (elf_x86_64_eh_frame_plt); + htab->plt_eh_frame->contents + = bfd_alloc (dynobj, htab->plt_eh_frame->size); + memcpy (htab->plt_eh_frame->contents, elf_x86_64_eh_frame_plt, + sizeof (elf_x86_64_eh_frame_plt)); + } return TRUE; } @@ -2721,6 +2780,13 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, return FALSE; } + if (htab->plt_eh_frame != NULL + && htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && (htab->elf.splt->flags & SEC_EXCLUDE) == 0) + bfd_put_32 (dynobj, htab->elf.splt->size, + htab->plt_eh_frame->contents + PLT_FDE_LEN_OFFSET); + if (htab->elf.dynamic_sections_created) { /* Add some entries to the .dynamic section. We fill in the @@ -4521,6 +4587,33 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, GOT_ENTRY_SIZE; } + /* Adjust .eh_frame for .plt section. */ + if (htab->plt_eh_frame != NULL) + { + if (htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && (htab->elf.splt->flags & SEC_EXCLUDE) == 0 + && htab->elf.splt->output_section != NULL + && htab->plt_eh_frame->output_section != NULL) + { + bfd_vma plt_start = htab->elf.splt->output_section->vma; + bfd_vma eh_frame_start = htab->plt_eh_frame->output_section->vma + + htab->plt_eh_frame->output_offset + + PLT_FDE_START_OFFSET; + bfd_put_signed_32 (dynobj, plt_start - eh_frame_start, + htab->plt_eh_frame->contents + + PLT_FDE_START_OFFSET); + } + if (htab->plt_eh_frame->sec_info_type + == ELF_INFO_TYPE_EH_FRAME) + { + if (! _bfd_elf_write_section_eh_frame (output_bfd, info, + htab->plt_eh_frame, + htab->plt_eh_frame->contents)) + return FALSE; + } + } + if (htab->elf.sgot && htab->elf.sgot->size > 0) elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = GOT_ENTRY_SIZE; @@ -4787,6 +4880,7 @@ static const struct bfd_elf_special_section #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size (GOT_ENTRY_SIZE*3) #define elf_backend_rela_normal 1 +#define elf_backend_plt_alignment 4 #define elf_info_to_howto elf_x86_64_info_to_howto diff --git a/include/ChangeLog b/include/ChangeLog index 42546be664b..6ff56e6b065 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2011-06-20 Jakub Jelinek + + PR ld/12570 + * bfdlink.h (struct bfd_link_info): Add no_ld_generated_unwind_info + option. + 2011-06-13 Jan Kratochvil * demangle.h (DMGL_RET_POSTFIX): Extend the comment. diff --git a/include/bfdlink.h b/include/bfdlink.h index bb62fbe34d5..b1c751a8405 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -353,6 +353,10 @@ struct bfd_link_info --dynamic-list command line options. */ unsigned int dynamic: 1; + /* FALSE if .eh_frame unwind info should be generated for PLT and other + linker created sections, TRUE if it should be omitted. */ + unsigned int no_ld_generated_unwind_info: 1; + /* Non-NULL if .note.gnu.build-id section should be created. */ char *emit_note_gnu_build_id; diff --git a/ld/ChangeLog b/ld/ChangeLog index 099104da019..6748fa3bb16 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2011-06-20 Jakub Jelinek + + PR ld/12570 + * emultempl/elf32.em (OPTION_LD_GENERATED_UNWIND_INFO, + OPTION_NO_LD_GENERATED_UNWIND_INFO): Define. + (gld${EMULATION_NAME}_handle_option): Handle + --ld-generated-unwind-info and --no-ld-generated-unwind-info. + * ld.texinfo (--ld-generated-unwind-info, + --no-ld-generated-unwind-info): Document. + 2011-06-19 H.J. Lu * configure.tgt: Support x32. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 42674bd4f61..2453e58a59e 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2124,6 +2124,8 @@ fragment < + + PR ld/12570 + * ld-x86-64/x86-64.exp: Link some testcases with + --no-ld-generated-unwind-info. + * ld-x86-64/tlsbin.rd: Add --no-ld-generated-unwind-info to ld + comment. + * ld-x86-64/tlsdesc.dd: Likewise. + * ld-x86-64/tlspic.dd: Likewise. + * ld-x86-64/tlsdesc.sd: Likewise. + * ld-x86-64/tlspic.rd: Likewise. + * ld-x86-64/tlsbindesc.rd: Likewise. + * ld-x86-64/tlsbindesc.sd: Likewise. + * ld-x86-64/tlsbin.td: Likewise. + * ld-x86-64/tlsdesc.pd: Likewise. + * ld-x86-64/tlsdesc.td: Likewise. + * ld-x86-64/tlsbindesc.dd: Likewise. + * ld-x86-64/tlsbin.dd: Likewise. + * ld-x86-64/tlsgdesc.rd: Likewise. + * ld-x86-64/tlspic.sd: Likewise. + * ld-x86-64/tlsbindesc.td: Likewise. + * ld-x86-64/tlspic.td: Likewise. + * ld-x86-64/tlsbin.sd: Likewise. + * ld-x86-64/ilp32-4.d: Likewise. + * ld-x86-64/tlsgdesc.dd: Add --no-ld-generated-unwind-info to ld + comment. Adjust. + * ld-x86-64/tlsdesc.rd: Likewise. + * ld-x86-64/tlsgd6.dd: Adjust. + * ld-x86-64/tlsgd5.dd: Likewise. + * ld-i386/i386.exp: Link some testcases with + --no-ld-generated-unwind-info. + * ld-i386/tlsbin.rd: Add --no-ld-generated-unwind-info to ld + comment.. + * ld-i386/tlsdesc.dd: Likewise. + * ld-i386/tlspic.dd: Likewise. + * ld-i386/tlsdesc.sd: Likewise. + * ld-i386/tlsgdesc.dd: Likewise. + * ld-i386/tlsnopic.sd: Likewise. + * ld-i386/tlspic.rd: Likewise. + * ld-i386/tlsdesc.rd: Likewise. + * ld-i386/tlsbindesc.rd: Likewise. + * ld-i386/tlsbindesc.sd: Likewise. + * ld-i386/tlsbin.td: Likewise. + * ld-i386/tlsdesc.td: Likewise. + * ld-i386/tlsnopic.dd: Likewise. + * ld-i386/tlsbindesc.dd: Likewise. + * ld-i386/tlsbin.dd: Likewise. + * ld-i386/tlsgdesc.rd: Likewise. + * ld-i386/tlspic.sd: Likewise. + * ld-i386/tlsnopic.rd: Likewise. + * ld-i386/tlsbindesc.td: Likewise. + * ld-i386/tlspic.td: Likewise. + * ld-i386/tlsbin.sd: Likewise. + 2011-06-19 H.J. Lu * ld-elf/eh1.d: Skip x32. diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 3bce2d3f6ff..ae798c04aca 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -118,12 +118,14 @@ if { !([istarget "i?86-*-elf*"] # readelf: Apply readelf options on result. Compare with regex (last arg). set i386tests { - {"TLS -fpic -shared transitions" "-shared -melf_i386" + {"TLS -fpic -shared transitions" + "-shared -melf_i386 --no-ld-generated-unwind-info" "--32" {tlspic1.s tlspic2.s} {{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} "libtlspic.so"} - {"TLS descriptor -fpic -shared transitions" "-shared -melf_i386" + {"TLS descriptor -fpic -shared transitions" + "-shared -melf_i386 --no-ld-generated-unwind-info" "--32" {tlsdesc.s tlspic2.s} {{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd} {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}} @@ -131,21 +133,24 @@ set i386tests { {"Helper shared library" "-shared -melf_i386" "--32" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec transitions" - "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbinpic.s tlsbin.s} + "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" + "--32" {tlsbinpic.s tlsbin.s} {{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} {"TLS descriptor -fpic and -fno-pic exec transitions" - "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbindesc.s tlsbin.s} + "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" + "--32" {tlsbindesc.s tlsbin.s} {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} "tlsbindesc"} - {"TLS -fno-pic -shared" "-shared -melf_i386" + {"TLS -fno-pic -shared" "-shared -melf_i386 --no-ld-generated-unwind-info" "--32" {tlsnopic1.s tlsnopic2.s} {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd} {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"} {"TLS with global dynamic and descriptors" - "-shared -melf_i386" "--32" {tlsgdesc.s} + "-shared -melf_i386 --no-ld-generated-unwind-info" + "--32" {tlsgdesc.s} {{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}} "libtlsgdesc.so"} {"TLS in debug sections" "-melf_i386" diff --git a/ld/testsuite/ld-i386/tlsbin.dd b/ld/testsuite/ld-i386/tlsbin.dd index 9cf14a5379b..6f6c0e4114d 100644 --- a/ld/testsuite/ld-i386/tlsbin.dd +++ b/ld/testsuite/ld-i386/tlsbin.dd @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #objdump: -drj.text #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbin.rd b/ld/testsuite/ld-i386/tlsbin.rd index 84cec7858d2..5579334614e 100644 --- a/ld/testsuite/ld-i386/tlsbin.rd +++ b/ld/testsuite/ld-i386/tlsbin.rd @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #readelf: -Ssrl #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbin.sd b/ld/testsuite/ld-i386/tlsbin.sd index 2fa7a8970b6..99dc4c57a81 100644 --- a/ld/testsuite/ld-i386/tlsbin.sd +++ b/ld/testsuite/ld-i386/tlsbin.sd @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #objdump: -sj.got #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbin.td b/ld/testsuite/ld-i386/tlsbin.td index bb29455e5de..a1ed433d272 100644 --- a/ld/testsuite/ld-i386/tlsbin.td +++ b/ld/testsuite/ld-i386/tlsbin.td @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #objdump: -sj.tdata #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbindesc.dd b/ld/testsuite/ld-i386/tlsbindesc.dd index f77d1c8d5fd..db547644f26 100644 --- a/ld/testsuite/ld-i386/tlsbindesc.dd +++ b/ld/testsuite/ld-i386/tlsbindesc.dd @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #objdump: -drj.text #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbindesc.rd b/ld/testsuite/ld-i386/tlsbindesc.rd index c2cea19959c..a334e5617bf 100644 --- a/ld/testsuite/ld-i386/tlsbindesc.rd +++ b/ld/testsuite/ld-i386/tlsbindesc.rd @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #readelf: -Ssrl #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbindesc.sd b/ld/testsuite/ld-i386/tlsbindesc.sd index a87f5da402e..7d56466c7ba 100644 --- a/ld/testsuite/ld-i386/tlsbindesc.sd +++ b/ld/testsuite/ld-i386/tlsbindesc.sd @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #objdump: -sj.got #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsbindesc.td b/ld/testsuite/ld-i386/tlsbindesc.td index 726df3edbe3..64859ddfae1 100644 --- a/ld/testsuite/ld-i386/tlsbindesc.td +++ b/ld/testsuite/ld-i386/tlsbindesc.td @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --32 -#ld: -melf_i386 tmpdir/libtlslib.so +#ld: -melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info #objdump: -sj.tdata #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsdesc.dd b/ld/testsuite/ld-i386/tlsdesc.dd index bca00901b97..85db8ddb422 100644 --- a/ld/testsuite/ld-i386/tlsdesc.dd +++ b/ld/testsuite/ld-i386/tlsdesc.dd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -drj.text #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsdesc.rd b/ld/testsuite/ld-i386/tlsdesc.rd index 42edd44a586..c7c41c6b1f5 100644 --- a/ld/testsuite/ld-i386/tlsdesc.rd +++ b/ld/testsuite/ld-i386/tlsdesc.rd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #readelf: -Ssrl #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsdesc.sd b/ld/testsuite/ld-i386/tlsdesc.sd index 656c4097146..ad3d1e3679c 100644 --- a/ld/testsuite/ld-i386/tlsdesc.sd +++ b/ld/testsuite/ld-i386/tlsdesc.sd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -s -j.got -j.got.plt #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsdesc.td b/ld/testsuite/ld-i386/tlsdesc.td index f3612b32a79..12cc43ca019 100644 --- a/ld/testsuite/ld-i386/tlsdesc.td +++ b/ld/testsuite/ld-i386/tlsdesc.td @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -sj.tdata #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsgdesc.dd b/ld/testsuite/ld-i386/tlsgdesc.dd index 25659de2833..92062cef932 100644 --- a/ld/testsuite/ld-i386/tlsgdesc.dd +++ b/ld/testsuite/ld-i386/tlsgdesc.dd @@ -1,6 +1,6 @@ #source: tlsgdesc.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -drj.text #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsgdesc.rd b/ld/testsuite/ld-i386/tlsgdesc.rd index 3a224a24066..fa0eeb98354 100644 --- a/ld/testsuite/ld-i386/tlsgdesc.rd +++ b/ld/testsuite/ld-i386/tlsgdesc.rd @@ -1,6 +1,6 @@ #source: tlsgdesc.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #readelf: -Ssrl #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsnopic.dd b/ld/testsuite/ld-i386/tlsnopic.dd index a0a8853f2ce..995cdaa1b9e 100644 --- a/ld/testsuite/ld-i386/tlsnopic.dd +++ b/ld/testsuite/ld-i386/tlsnopic.dd @@ -1,7 +1,7 @@ #source: tlsnopic1.s #source: tlsnopic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -drj.text #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsnopic.rd b/ld/testsuite/ld-i386/tlsnopic.rd index 2590a9ff4a9..2396fc5801e 100644 --- a/ld/testsuite/ld-i386/tlsnopic.rd +++ b/ld/testsuite/ld-i386/tlsnopic.rd @@ -1,7 +1,7 @@ #source: tlsnopic1.s #source: tlsnopic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #readelf: -Ssrl #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlsnopic.sd b/ld/testsuite/ld-i386/tlsnopic.sd index fdfaacf2e2d..925c5d5d857 100644 --- a/ld/testsuite/ld-i386/tlsnopic.sd +++ b/ld/testsuite/ld-i386/tlsnopic.sd @@ -1,7 +1,7 @@ #source: tlsnopic1.s #source: tlsnopic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -sj.got #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlspic.dd b/ld/testsuite/ld-i386/tlspic.dd index dd436d2f8d4..b0c046d9ef1 100644 --- a/ld/testsuite/ld-i386/tlspic.dd +++ b/ld/testsuite/ld-i386/tlspic.dd @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -drj.text #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlspic.rd b/ld/testsuite/ld-i386/tlspic.rd index 46b8ed55c61..7fe042ecc74 100644 --- a/ld/testsuite/ld-i386/tlspic.rd +++ b/ld/testsuite/ld-i386/tlspic.rd @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #readelf: -Ssrl #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlspic.sd b/ld/testsuite/ld-i386/tlspic.sd index f9c962764c1..15b3b9316e4 100644 --- a/ld/testsuite/ld-i386/tlspic.sd +++ b/ld/testsuite/ld-i386/tlspic.sd @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -sj.got #target: i?86-*-* diff --git a/ld/testsuite/ld-i386/tlspic.td b/ld/testsuite/ld-i386/tlspic.td index 1291584da46..a96d6f617e4 100644 --- a/ld/testsuite/ld-i386/tlspic.td +++ b/ld/testsuite/ld-i386/tlspic.td @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --32 -#ld: -shared -melf_i386 +#ld: -shared -melf_i386 --no-ld-generated-unwind-info #objdump: -sj.tdata #target: i?86-*-* diff --git a/ld/testsuite/ld-x86-64/ilp32-4.d b/ld/testsuite/ld-x86-64/ilp32-4.d index e8690b34569..84dc7b250e5 100644 --- a/ld/testsuite/ld-x86-64/ilp32-4.d +++ b/ld/testsuite/ld-x86-64/ilp32-4.d @@ -1,6 +1,6 @@ #source: start.s #as: --x32 -#ld: -m elf32_x86_64 -shared +#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info #readelf: -d -S --wide There are 10 section headers, starting at offset 0x22c: diff --git a/ld/testsuite/ld-x86-64/tlsbin.dd b/ld/testsuite/ld-x86-64/tlsbin.dd index b87f34a4953..5bb59791e2e 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.dd +++ b/ld/testsuite/ld-x86-64/tlsbin.dd @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -drj.text #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbin.rd b/ld/testsuite/ld-x86-64/tlsbin.rd index 936f3706beb..9bfa3ccfc0a 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.rd +++ b/ld/testsuite/ld-x86-64/tlsbin.rd @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #readelf: -WSsrl #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbin.sd b/ld/testsuite/ld-x86-64/tlsbin.sd index 050e59553e2..7fa7904a4ca 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.sd +++ b/ld/testsuite/ld-x86-64/tlsbin.sd @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.got #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbin.td b/ld/testsuite/ld-x86-64/tlsbin.td index 76736dbe8e1..6f87a19f57f 100644 --- a/ld/testsuite/ld-x86-64/tlsbin.td +++ b/ld/testsuite/ld-x86-64/tlsbin.td @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.tdata #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.dd b/ld/testsuite/ld-x86-64/tlsbindesc.dd index 5157c81fe8c..b1cfacba83d 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.dd +++ b/ld/testsuite/ld-x86-64/tlsbindesc.dd @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -drj.text #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.rd b/ld/testsuite/ld-x86-64/tlsbindesc.rd index 5f25090eb28..3527495c950 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.rd +++ b/ld/testsuite/ld-x86-64/tlsbindesc.rd @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #readelf: -WSsrl #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.sd b/ld/testsuite/ld-x86-64/tlsbindesc.sd index 37fa54477e1..dbea32d44bc 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.sd +++ b/ld/testsuite/ld-x86-64/tlsbindesc.sd @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.got #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.td b/ld/testsuite/ld-x86-64/tlsbindesc.td index 7f2d5720e34..1dc6c28abba 100644 --- a/ld/testsuite/ld-x86-64/tlsbindesc.td +++ b/ld/testsuite/ld-x86-64/tlsbindesc.td @@ -1,7 +1,7 @@ #source: tlsbindesc.s #source: tlsbin.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.tdata #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsdesc.dd b/ld/testsuite/ld-x86-64/tlsdesc.dd index 9b0ae610915..2507e422942 100644 --- a/ld/testsuite/ld-x86-64/tlsdesc.dd +++ b/ld/testsuite/ld-x86-64/tlsdesc.dd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -drj.text #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsdesc.pd b/ld/testsuite/ld-x86-64/tlsdesc.pd index bf3bc2f7be8..2176576b220 100644 --- a/ld/testsuite/ld-x86-64/tlsdesc.pd +++ b/ld/testsuite/ld-x86-64/tlsdesc.pd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -drj.plt #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsdesc.rd b/ld/testsuite/ld-x86-64/tlsdesc.rd index 662b6393041..df8d46695a0 100644 --- a/ld/testsuite/ld-x86-64/tlsdesc.rd +++ b/ld/testsuite/ld-x86-64/tlsdesc.rd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #readelf: -WSsrld #target: x86_64-*-* @@ -15,7 +15,7 @@ Section Headers: +\[[ 0-9]+\] .dynstr +.* +\[[ 0-9]+\] .rela.dyn +.* +\[[ 0-9]+\] .rela.plt +.* - +\[[ 0-9]+\] .plt +PROGBITS +0+450 0+450 0+20 10 +AX +0 +0 +4 + +\[[ 0-9]+\] .plt +PROGBITS +0+450 0+450 0+20 10 +AX +0 +0 +(4|16) +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+154 00 +AX +0 +0 4096 +\[[ 0-9]+\] .tdata +PROGBITS +0+201154 0+1154 0+60 00 WAT +0 +0 +1 +\[[ 0-9]+\] .tbss +NOBITS +0+2011b4 0+11b4 0+20 00 WAT +0 +0 +1 diff --git a/ld/testsuite/ld-x86-64/tlsdesc.sd b/ld/testsuite/ld-x86-64/tlsdesc.sd index 7eb474a9d79..89e2a39b647 100644 --- a/ld/testsuite/ld-x86-64/tlsdesc.sd +++ b/ld/testsuite/ld-x86-64/tlsdesc.sd @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -s -j.got -j.got.plt #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsdesc.td b/ld/testsuite/ld-x86-64/tlsdesc.td index 6b8098c80f5..479cb84ea5a 100644 --- a/ld/testsuite/ld-x86-64/tlsdesc.td +++ b/ld/testsuite/ld-x86-64/tlsdesc.td @@ -1,7 +1,7 @@ #source: tlsdesc.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.tdata #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlsgd5.dd b/ld/testsuite/ld-x86-64/tlsgd5.dd index 7ca953a8f9e..ad9cd6e6d6b 100644 --- a/ld/testsuite/ld-x86-64/tlsgd5.dd +++ b/ld/testsuite/ld-x86-64/tlsgd5.dd @@ -10,5 +10,5 @@ Disassembly of section .text: [a-f0-9]+ <_start>: [ ]*[a-f0-9]+: 64 48 8b 04 25 00 00 00 00 mov %fs:0x0,%rax -[ ]*[a-f0-9]+: 48 03 05 00 01 20 00 add 0x200100\(%rip\),%rax # 600368 <_DYNAMIC\+0x100> +[ ]*[a-f0-9]+: 48 03 05 40 01 20 00 add 0x200140\(%rip\),%rax # 6003a8 <_DYNAMIC\+0x100> #pass diff --git a/ld/testsuite/ld-x86-64/tlsgd6.dd b/ld/testsuite/ld-x86-64/tlsgd6.dd index e1d8238bc61..8bdb468e957 100644 --- a/ld/testsuite/ld-x86-64/tlsgd6.dd +++ b/ld/testsuite/ld-x86-64/tlsgd6.dd @@ -10,5 +10,5 @@ Disassembly of section .text: [a-f0-9]+ <_start>: [ ]*[a-f0-9]+: 64 8b 04 25 00 00 00 00 mov %fs:0x0,%eax -[ ]*[a-f0-9]+: 48 03 05 81 00 20 00 add 0x200081\(%rip\),%rax # 60022c <_DYNAMIC\+0x80> +[ ]*[a-f0-9]+: 48 03 05 c5 00 20 00 add 0x2000c5\(%rip\),%rax # 600270 <_DYNAMIC\+0x80> #pass diff --git a/ld/testsuite/ld-x86-64/tlsgdesc.dd b/ld/testsuite/ld-x86-64/tlsgdesc.dd index 75e8da4df5f..fa467a5ff32 100644 --- a/ld/testsuite/ld-x86-64/tlsgdesc.dd +++ b/ld/testsuite/ld-x86-64/tlsgdesc.dd @@ -1,6 +1,6 @@ #source: tlsgdesc.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -drj.text #target: x86_64-*-* @@ -20,7 +20,7 @@ Disassembly of section .text: +[0-9a-f]+: 00 00 * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 03 0d 5e 02 20 00[ ]+add 0x20025e\(%rip\),%rcx +# 200660 <.*> + +[0-9a-f]+: 48 03 0d 5e 02 20 00[ ]+add 0x20025e\(%rip\),%rcx +# 200668 <.*> # -> R_X86_64_TPOFF64 sG3 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * @@ -31,14 +31,14 @@ Disassembly of section .text: +[0-9a-f]+: 00 00 * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 03 0d 68 02 20 00[ ]+add 0x200268\(%rip\),%rcx +# 200680 <.*> + +[0-9a-f]+: 48 03 0d 68 02 20 00[ ]+add 0x200268\(%rip\),%rcx +# 200688 <.*> # -> R_X86_64_TPOFF64 sG4 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * # GD, gd first - +[0-9a-f]+: 66 48 8d 3d 6c 02 20[ ]+data32 lea 0x20026c\(%rip\),%rdi +# 200690 <.*> + +[0-9a-f]+: 66 48 8d 3d 6c 02 20[ ]+data32 lea 0x20026c\(%rip\),%rdi +# 200698 <.*> +[0-9a-f]+: 00 * # -> R_X86_64_DTPMOD64 sG1 +[0-9a-f]+: 66 66 48 e8 9c ff ff[ ]+data32 data32 callq [0-9a-f]+ <.*> @@ -48,7 +48,7 @@ Disassembly of section .text: +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 8d 05 a1 02 20 00[ ]+lea 0x2002a1\(%rip\),%rax +# 2006d8 <.*> + +[0-9a-f]+: 48 8d 05 a1 02 20 00[ ]+lea 0x2002a1\(%rip\),%rax +# 2006e0 <.*> # -> R_X86_64_TLSDESC sG1 +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\) +[0-9a-f]+: 90[ ]+nop * @@ -56,14 +56,14 @@ Disassembly of section .text: +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * # GD, desc first - +[0-9a-f]+: 48 8d 05 84 02 20 00[ ]+lea 0x200284\(%rip\),%rax +# 2006c8 <.*> + +[0-9a-f]+: 48 8d 05 84 02 20 00[ ]+lea 0x200284\(%rip\),%rax +# 2006d0 <.*> # -> R_X86_64_TLSDESC sG2 +[0-9a-f]+: ff 10[ ]+callq \*\(%rax\) +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 66 48 8d 3d 1e 02 20[ ]+data32 lea 0x20021e\(%rip\),%rdi +# 200670 <.*> + +[0-9a-f]+: 66 48 8d 3d 1e 02 20[ ]+data32 lea 0x20021e\(%rip\),%rdi +# 200678 <.*> +[0-9a-f]+: 00 * # -> R_X86_64_DTPMOD64 sG2 +[0-9a-f]+: 66 66 48 e8 6e ff ff[ ]+data32 data32 callq [0-9a-f]+ <.*> @@ -76,13 +76,13 @@ Disassembly of section .text: # GD -> IE, gd first, after IE use +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax +[0-9a-f]+: 00 00 * - +[0-9a-f]+: 48 03 05 f2 01 20 00[ ]+add 0x2001f2\(%rip\),%rax +# 200660 <.*> + +[0-9a-f]+: 48 03 05 f2 01 20 00[ ]+add 0x2001f2\(%rip\),%rax +# 200668 <.*> # -> R_X86_64_TPOFF64 sG3 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 8b 05 e7 01 20 00[ ]+mov 0x2001e7\(%rip\),%rax +# 200660 <.*> + +[0-9a-f]+: 48 8b 05 e7 01 20 00[ ]+mov 0x2001e7\(%rip\),%rax +# 200668 <.*> # -> R_X86_64_TPOFF64 sG3 +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax +[0-9a-f]+: 90[ ]+nop * @@ -90,7 +90,7 @@ Disassembly of section .text: +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * # GD -> IE, desc first, after IE use - +[0-9a-f]+: 48 8b 05 fa 01 20 00[ ]+mov 0x2001fa\(%rip\),%rax +# 200680 <.*> + +[0-9a-f]+: 48 8b 05 fa 01 20 00[ ]+mov 0x2001fa\(%rip\),%rax +# 200688 <.*> # -> R_X86_64_TPOFF64 sG4 +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax +[0-9a-f]+: 90[ ]+nop * @@ -99,7 +99,7 @@ Disassembly of section .text: +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax +[0-9a-f]+: 00 00 * - +[0-9a-f]+: 48 03 05 e4 01 20 00[ ]+add 0x2001e4\(%rip\),%rax +# 200680 <.*> + +[0-9a-f]+: 48 03 05 e4 01 20 00[ ]+add 0x2001e4\(%rip\),%rax +# 200688 <.*> # -> R_X86_64_TPOFF64 sG4 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * @@ -108,13 +108,13 @@ Disassembly of section .text: # GD -> IE, gd first, before IE use +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax +[0-9a-f]+: 00 00 * - +[0-9a-f]+: 48 03 05 b8 01 20 00[ ]+add 0x2001b8\(%rip\),%rax +# 200668 <.*> + +[0-9a-f]+: 48 03 05 b8 01 20 00[ ]+add 0x2001b8\(%rip\),%rax +# 200670 <.*> # -> R_X86_64_TPOFF64 sG5 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 8b 05 ad 01 20 00[ ]+mov 0x2001ad\(%rip\),%rax +# 200668 <.*> + +[0-9a-f]+: 48 8b 05 ad 01 20 00[ ]+mov 0x2001ad\(%rip\),%rax +# 200670 <.*> # -> R_X86_64_TPOFF64 sG5 +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax +[0-9a-f]+: 90[ ]+nop * @@ -122,7 +122,7 @@ Disassembly of section .text: +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * # GD -> IE, desc first, before IE use - +[0-9a-f]+: 48 8b 05 c0 01 20 00[ ]+mov 0x2001c0\(%rip\),%rax +# 200688 <.*> + +[0-9a-f]+: 48 8b 05 c0 01 20 00[ ]+mov 0x2001c0\(%rip\),%rax +# 200690 <.*> # -> R_X86_64_TPOFF64 sG6 +[0-9a-f]+: 66 90[ ]+xchg %ax,%ax +[0-9a-f]+: 90[ ]+nop * @@ -131,7 +131,7 @@ Disassembly of section .text: +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax +[0-9a-f]+: 00 00 * - +[0-9a-f]+: 48 03 05 aa 01 20 00[ ]+add 0x2001aa\(%rip\),%rax +# 200688 <.*> + +[0-9a-f]+: 48 03 05 aa 01 20 00[ ]+add 0x2001aa\(%rip\),%rax +# 200690 <.*> # -> R_X86_64_TPOFF64 sG6 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * @@ -142,7 +142,7 @@ Disassembly of section .text: +[0-9a-f]+: 00 00 * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 03 0d 74 01 20 00[ ]+add 0x200174\(%rip\),%rcx +# 200668 <.*> + +[0-9a-f]+: 48 03 0d 74 01 20 00[ ]+add 0x200174\(%rip\),%rcx +# 200670 <.*> # -> R_X86_64_TPOFF64 sG5 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * @@ -153,7 +153,7 @@ Disassembly of section .text: +[0-9a-f]+: 00 00 * +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * - +[0-9a-f]+: 48 03 0d 7e 01 20 00[ ]+add 0x20017e\(%rip\),%rcx +# 200688 <.*> + +[0-9a-f]+: 48 03 0d 7e 01 20 00[ ]+add 0x20017e\(%rip\),%rcx +# 200690 <.*> # -> R_X86_64_TPOFF64 sG6 +[0-9a-f]+: 90[ ]+nop * +[0-9a-f]+: 90[ ]+nop * diff --git a/ld/testsuite/ld-x86-64/tlsgdesc.rd b/ld/testsuite/ld-x86-64/tlsgdesc.rd index 61d2fa84f38..1e246930ee9 100644 --- a/ld/testsuite/ld-x86-64/tlsgdesc.rd +++ b/ld/testsuite/ld-x86-64/tlsgdesc.rd @@ -1,6 +1,6 @@ #source: tlsgdesc.s #as: --64 -#ld: -shared -melf64_x86_64 +#ld: -shared -melf64_x86_64 --no-ld-generated-unwind-info #readelf: -WSsrl #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlspic.dd b/ld/testsuite/ld-x86-64/tlspic.dd index e1b64fc14dd..6f55456d829 100644 --- a/ld/testsuite/ld-x86-64/tlspic.dd +++ b/ld/testsuite/ld-x86-64/tlspic.dd @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -drj.text #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlspic.rd b/ld/testsuite/ld-x86-64/tlspic.rd index 798703e5cd2..177f2060105 100644 --- a/ld/testsuite/ld-x86-64/tlspic.rd +++ b/ld/testsuite/ld-x86-64/tlspic.rd @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #readelf: -WSsrl #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlspic.sd b/ld/testsuite/ld-x86-64/tlspic.sd index 666c7749c30..36c1b528ca7 100644 --- a/ld/testsuite/ld-x86-64/tlspic.sd +++ b/ld/testsuite/ld-x86-64/tlspic.sd @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.got #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/tlspic.td b/ld/testsuite/ld-x86-64/tlspic.td index 67eb4f2a274..36a7f8e4228 100644 --- a/ld/testsuite/ld-x86-64/tlspic.td +++ b/ld/testsuite/ld-x86-64/tlspic.td @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --no-ld-generated-unwind-info #objdump: -sj.tdata #target: x86_64-*-* diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index bd1991a4762..58e4bc014ec 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -38,12 +38,14 @@ if { !([istarget "x86_64-*-elf*"] # readelf: Apply readelf options on result. Compare with regex (last arg). set x86_64tests { - {"TLS -fpic -shared transitions" "-shared -melf_x86_64" + {"TLS -fpic -shared transitions" + "-shared -melf_x86_64 --no-ld-generated-unwind-info" "--64" {tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} "libtlspic.so"} - {"TLS descriptor -fpic -shared transitions" "-shared -melf_x86_64" + {"TLS descriptor -fpic -shared transitions" + "-shared -melf_x86_64 --no-ld-generated-unwind-info" "--64" {tlsdesc.s tlspic2.s} {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd} {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td} @@ -51,17 +53,20 @@ set x86_64tests { {"Helper shared library" "-shared -melf_x86_64" "--64" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec transitions" - "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbinpic.s tlsbin.s} + "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info" + "--64" {tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} {"TLS descriptor -fpic and -fno-pic exec transitions" - "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbindesc.s tlsbin.s} + "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info" + "--64" {tlsbindesc.s tlsbin.s} {{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} "tlsbindesc"} {"TLS with global dynamic and descriptors" - "-shared -melf_x86_64" "--64" {tlsgdesc.s} + "-shared -melf_x86_64 --no-ld-generated-unwind-info" + "--64" {tlsgdesc.s} {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}} "libtlsgdesc.so"} {"TLS in debug sections" "-melf_x86_64"