diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-07-10 21:40:25 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-07-10 21:40:25 +0000 |
commit | fdc90cb46b0f96dd4444ec3d126c87de75fb6e6b (patch) | |
tree | 4ffde6484836dfa2b50c27ba8a68b187effb5348 /ld | |
parent | 8a112c90fe342a045c82485eb3b1ef65f7c735f3 (diff) | |
download | fsf-binutils-gdb-fdc90cb46b0f96dd4444ec3d126c87de75fb6e6b.zip fsf-binutils-gdb-fdc90cb46b0f96dd4444ec3d126c87de75fb6e6b.tar.gz fsf-binutils-gdb-fdc90cb46b0f96dd4444ec3d126c87de75fb6e6b.tar.bz2 |
include/
* bfdlink.h (struct bfd_link_info): Add emit_hash and
emit_gnu_hash bitfields.
include/elf/
* common.h (SHT_GNU_HASH, DT_GNU_HASH): Define.
ld/
* scripttempl/elf.sc: Add .gnu.hash section.
* emultempl/elf32.em (OPTION_HASH_STYLE): Define.
(gld${EMULATION_NAME}_add_options): Register --hash-style option.
(gld${EMULATION_NAME}_handle_option): Handle it.
(gld${EMULATION_NAME}_list_options): Document it.
* ldmain.c (main): Initialize emit_hash and emit_gnu_hash.
* ld.texinfo: Document --hash-style option.
bfd/
* elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH.
(bfd_section_from_shdr, elf_fake_sections, assign_section_numbers):
Handle SHT_GNU_HASH.
(special_sections_g): Include .gnu.hash section.
(bfd_elf_gnu_hash): New function.
* elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes.
(struct elf_backend_data): Add elf_hash_symbol method.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash
only if info->emit_hash, create .gnu.hash section if
info->emit_gnu_hash.
(struct collect_gnu_hash_codes): New type.
(elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms,
_bfd_elf_hash_symbol): New functions.
(compute_bucket_count): Don't compute HASHCODES array, instead add
that and NSYMS as arguments. Use bed->s->sizeof_hash_entry
instead of bed->s->arch_size / 8. Fix .hash size estimation.
When not optimizing, use the number of hashed symbols rather than
dynsymcount.
(bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash,
and ADD DT_GNU_HASH if info->emit_gnu_hash.
(bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash,
adjust compute_bucket_count caller. Create and populate .gnu.hash
section if info->emit_gnu_hash.
(elf_link_output_extsym): Only populate .hash section if
finfo->hash_sec != NULL.
(bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH.
* elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined.
(elfNN_bed): Add elf_backend_hash_symbol.
* elf64-x86-64.c (elf64_x86_64_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
* elf32-i386.c (elf_i386_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
binutils/
* readelf.c (get_dynamic_type): Handle DT_GNU_HASH.
(get_section_type_name): Handle SHT_GNU_HASH.
(dynamic_info_DT_GNU_HASH): New variable.
(process_dynamic_section): Handle DT_GNU_HASH.
(process_symbol_table): Print also DT_GNU_HASH histogram.
ld/testsuite/
* ld-powerpc/tlsso32.r: Adjust.
* ld-powerpc/tlsso32.d: Adjust.
* ld-powerpc/tlsso32.g: Adjust.
* ld-powerpc/tlsso.r: Adjust.
* ld-powerpc/tlsso.g: Adjust.
* ld-powerpc/tlstocso.g: Adjust.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 10 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 19 | ||||
-rw-r--r-- | ld/ld.texinfo | 8 | ||||
-rw-r--r-- | ld/ldmain.c | 2 | ||||
-rw-r--r-- | ld/scripttempl/elf.sc | 1 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso.g | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso.r | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso32.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso32.g | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso32.r | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlstocso.g | 2 |
12 files changed, 59 insertions, 10 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 1d1cc1b..24141f6 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2006-07-10 Jakub Jelinek <jakub@redhat.com> + + * scripttempl/elf.sc: Add .gnu.hash section. + * emultempl/elf32.em (OPTION_HASH_STYLE): Define. + (gld${EMULATION_NAME}_add_options): Register --hash-style option. + (gld${EMULATION_NAME}_handle_option): Handle it. + (gld${EMULATION_NAME}_list_options): Document it. + * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. + * ld.texinfo: Document --hash-style option. + 2006-07-10 Nick Clifton <nickc@redhat.com> * po/zh_TW.po: New Chinese (traditional) translation. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 9eb5323..7ce112a 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1719,6 +1719,7 @@ cat >>e${EMULATION_NAME}.c <<EOF #define OPTION_GROUP (OPTION_ENABLE_NEW_DTAGS + 1) #define OPTION_EH_FRAME_HDR (OPTION_GROUP + 1) #define OPTION_EXCLUDE_LIBS (OPTION_EH_FRAME_HDR + 1) +#define OPTION_HASH_STYLE (OPTION_EXCLUDE_LIBS + 1) static void gld${EMULATION_NAME}_add_options @@ -1735,6 +1736,7 @@ cat >>e${EMULATION_NAME}.c <<EOF {"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS}, {"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR}, {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS}, + {"hash-style", required_argument, NULL, OPTION_HASH_STYLE}, {"Bgroup", no_argument, NULL, OPTION_GROUP}, EOF fi @@ -1791,6 +1793,22 @@ cat >>e${EMULATION_NAME}.c <<EOF add_excluded_libs (optarg); break; + case OPTION_HASH_STYLE: + link_info.emit_hash = FALSE; + link_info.emit_gnu_hash = FALSE; + if (strcmp (optarg, "sysv") == 0) + link_info.emit_hash = TRUE; + else if (strcmp (optarg, "gnu") == 0) + link_info.emit_gnu_hash = TRUE; + else if (strcmp (optarg, "both") == 0) + { + link_info.emit_hash = TRUE; + link_info.emit_gnu_hash = TRUE; + } + else + einfo (_("%P%F: invalid hash style \`%s'\n"), optarg); + break; + case 'z': if (strcmp (optarg, "initfirst") == 0) link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST; @@ -1894,6 +1912,7 @@ cat >>e${EMULATION_NAME}.c <<EOF fprintf (file, _(" --disable-new-dtags\tDisable new dynamic tags\n")); fprintf (file, _(" --enable-new-dtags\tEnable new dynamic tags\n")); fprintf (file, _(" --eh-frame-hdr\tCreate .eh_frame_hdr section\n")); + fprintf (file, _(" --hash-style=STYLE\tSet hash style to sysv, gnu or both\n")); fprintf (file, _(" -z combreloc\t\tMerge dynamic relocs into one section and sort\n")); fprintf (file, _(" -z defs\t\tReport unresolved symbols in object files.\n")); fprintf (file, _(" -z execstack\t\tMark executable as requiring executable stack\n")); diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 72a3044..687f19c 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1883,6 +1883,14 @@ time it takes the linker to perform its tasks, at the expense of increasing the linker's memory requirements. Similarly reducing this value can reduce the memory requirements at the expense of speed. +@kindex --hash-style=@var{style} +@item --hash-style=@var{style} +Set the type of linker's hash table(s). @var{style} can be either +@code{sysv} for classic ELF @code{.hash} section, @code{gnu} for +new style GNU @code{.gnu.hash} section or @code{both} for both +the classic ELF @code{.hash} and new style GNU @code{.gnu.hash} +hash tables. The default is @code{sysv}. + @kindex --reduce-memory-overheads @item --reduce-memory-overheads This option reduces memory requirements at ld runtime, at the expense of diff --git a/ld/ldmain.c b/ld/ldmain.c index 8881190..ec31310 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -304,6 +304,8 @@ main (int argc, char **argv) link_info.create_object_symbols_section = NULL; link_info.gc_sym_list = NULL; link_info.base_file = NULL; + link_info.emit_hash = TRUE; + link_info.emit_gnu_hash = FALSE; /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init and _fini symbols. We are compatible. */ link_info.init_function = "_init"; diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index ac0c725..ebe387e 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -260,6 +260,7 @@ SECTIONS ${INITIAL_READONLY_SECTIONS} ${TEXT_DYNAMIC+${DYNAMIC}} .hash ${RELOCATING-0} : { *(.hash) } + .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) } .dynsym ${RELOCATING-0} : { *(.dynsym) } .dynstr ${RELOCATING-0} : { *(.dynstr) } .gnu.version ${RELOCATING-0} : { *(.gnu.version) } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 3507142..501335e 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2006-07-10 Jakub Jelinek <jakub@redhat.com> + + * ld-powerpc/tlsso32.r: Adjust. + * ld-powerpc/tlsso32.d: Adjust. + * ld-powerpc/tlsso32.g: Adjust. + * ld-powerpc/tlsso.r: Adjust. + * ld-powerpc/tlsso.g: Adjust. + * ld-powerpc/tlstocso.g: Adjust. + 2006-07-05 Thiemo Seufer <ths@mips.com> * ld-mips-elf/multi-got-1.d, ld-mips-elf/tls-multi-got-1.got, diff --git a/ld/testsuite/ld-powerpc/tlsso.g b/ld/testsuite/ld-powerpc/tlsso.g index caef9dd..6113155 100644 --- a/ld/testsuite/ld-powerpc/tlsso.g +++ b/ld/testsuite/ld-powerpc/tlsso.g @@ -7,7 +7,7 @@ .*: +file format elf64-powerpc Contents of section \.got: -.* 00000000 000187f0 00000000 00000000 .* +.* 00000000 000187b8 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r index e0e0f00..db54154 100644 --- a/ld/testsuite/ld-powerpc/tlsso.r +++ b/ld/testsuite/ld-powerpc/tlsso.r @@ -49,9 +49,9 @@ Relocation section '\.rela\.dyn' at offset .* contains 16 entries: [0-9a-f ]+R_PPC64_TPREL16 +0+60 le0 \+ 0 [0-9a-f ]+R_PPC64_TPREL16_HA +0+68 le1 \+ 0 [0-9a-f ]+R_PPC64_TPREL16_LO +0+68 le1 \+ 0 -[0-9a-f ]+R_PPC64_TPREL16_DS +0+10668 \.tdata \+ 28 -[0-9a-f ]+R_PPC64_TPREL16_HA +0+10668 \.tdata \+ 30 -[0-9a-f ]+R_PPC64_TPREL16_LO +0+10668 \.tdata \+ 30 +[0-9a-f ]+R_PPC64_TPREL16_DS +0+10630 \.tdata \+ 28 +[0-9a-f ]+R_PPC64_TPREL16_HA +0+10630 \.tdata \+ 30 +[0-9a-f ]+R_PPC64_TPREL16_LO +0+10630 \.tdata \+ 30 [0-9a-f ]+R_PPC64_DTPMOD64 +0+ [0-9a-f ]+R_PPC64_DTPMOD64 +0+ [0-9a-f ]+R_PPC64_DTPREL64 +0+ diff --git a/ld/testsuite/ld-powerpc/tlsso32.d b/ld/testsuite/ld-powerpc/tlsso32.d index 45432db..dafca7d 100644 --- a/ld/testsuite/ld-powerpc/tlsso32.d +++ b/ld/testsuite/ld-powerpc/tlsso32.d @@ -42,5 +42,5 @@ Disassembly of section \.got: .* <\.got>: \.\.\. .*: 4e 80 00 21 blrl -.*: 00 01 04 38 .* +.*: 00 01 04 00 .* \.\.\. diff --git a/ld/testsuite/ld-powerpc/tlsso32.g b/ld/testsuite/ld-powerpc/tlsso32.g index 7014419..c097ffa 100644 --- a/ld/testsuite/ld-powerpc/tlsso32.g +++ b/ld/testsuite/ld-powerpc/tlsso32.g @@ -9,5 +9,5 @@ Contents of section \.got: .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* -.* 00000000 4e800021 00010438 00000000 .* +.* 00000000 4e800021 00010400 00000000 .* .* 00000000 .* diff --git a/ld/testsuite/ld-powerpc/tlsso32.r b/ld/testsuite/ld-powerpc/tlsso32.r index 7044c35..a0ede5f 100644 --- a/ld/testsuite/ld-powerpc/tlsso32.r +++ b/ld/testsuite/ld-powerpc/tlsso32.r @@ -52,9 +52,9 @@ Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 18 entries: [0-9a-f ]+R_PPC_TPREL16 +0+30 +le0 \+ 0 [0-9a-f ]+R_PPC_TPREL16_HA +0+34 +le1 \+ 0 [0-9a-f ]+R_PPC_TPREL16_LO +0+34 +le1 \+ 0 -[0-9a-f ]+R_PPC_TPREL16 +0+1041c +\.tdata \+ 10430 -[0-9a-f ]+R_PPC_TPREL16_HA +0+1041c +\.tdata \+ 10434 -[0-9a-f ]+R_PPC_TPREL16_LO +0+1041c +\.tdata \+ 10434 +[0-9a-f ]+R_PPC_TPREL16 +0+103e4 +\.tdata \+ 103f8 +[0-9a-f ]+R_PPC_TPREL16_HA +0+103e4 +\.tdata \+ 103fc +[0-9a-f ]+R_PPC_TPREL16_LO +0+103e4 +\.tdata \+ 103fc [0-9a-f ]+R_PPC_DTPMOD32 +0+ [0-9a-f ]+R_PPC_DTPREL32 +0+ [0-9a-f ]+R_PPC_DTPMOD32 +0+ diff --git a/ld/testsuite/ld-powerpc/tlstocso.g b/ld/testsuite/ld-powerpc/tlstocso.g index b5d7d64..3d59c43 100644 --- a/ld/testsuite/ld-powerpc/tlstocso.g +++ b/ld/testsuite/ld-powerpc/tlstocso.g @@ -7,7 +7,7 @@ .*: +file format elf64-powerpc Contents of section \.got: -.* 00000000 00018738 00000000 00000000 .* +.* 00000000 00018700 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* |