* elf32-i386.c (struct elf_i386_link_hash_table): Added field
tls_module_base.
(elf_i386_link_hash_table_create): Initialize it.
(elf_i386_always_size_sections): Set it.
(set_tls_module_base): New.
(elf_i386_relocate_sections): Call it.
* elf64-x86-64.c (struct elf64_x86_64_link_hash_table): Added
field tls_module_base.
(elf64_x86_64_link_hash_table_create): Initialize it.
(elf64_x86_64_always_size_sections): Set it.
(set_tls_module_base): New.
(elf64_x86_64_relocate_sections): Call it.
Reported by Cary Coutant <ccoutant@google.com>
ld/testsuite/ChangeLog:
* ld-i386/tlsbindesc.dd: Adjust incorrect expectations for LD to
LE relaxation.
* ld-x86-64/tlsbindesc.dd: Likewise.
* ld-i386/tlsbindesc.rd: Adjust address of _TLS_MODULE_BASE_.
* ld-x86-64/tlsbindesc.rd: Likewise.
Reported by Cary Coutant <ccoutant@google.com>
COFF_WITH_PE based SH ports.
* libpei.h (_bfd_XX_print_ce_compressed_pdata): Prototype.
* arm-wince-pe.c (bfd_pe_print_pdata): Use
_bfd_pe_print_ce_compressed_pdata.
(slurp_symcache, cleanup_syms, pe_print_ce_compressed_pdata): Move
to...
* peXXigen.c: ... here and rename pe_print_ce_compressed_pdata to
_bfd_XX_print_ce_compressed_pdata.
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add new parameter.
* bfd-in2.h: Regenerate.
* elf32-arm.c (struct elf_arm_obj_tdata): Add field
no_wchar_size_warning.
(bfd_elf32_arm_set_target_relocs): Add new parameter
no_wchar_warn.
(elf32_arm_merge_eabi_attributes): Give a warning, not an error,
for conflicting wchar_t attributes. Do not warn if
--no-wchar-size-warning. Make diagnostic text more specific.
ld:
* ld.texinfo (--no-wchar-size-warning): Document new ARM option.
* emultempl/armelf.em (no_wchar_size_warning): New.
(arm_elf_create_output_section_statements): Pass
no_wchar_size_warning to arm_elf_create_output_section_statements.
(OPTION_NO_WCHAR_SIZE_WARNING): New.
(PARSE_AND_LIST_LONGOPTS): Add no-wchar-size-warning.
(PARSE_AND_LIST_OPTIONS): List --no-wchar-size-warning.
(PARSE_AND_LIST_ARGS_CASES): Handle --no-wchar-size-warning.
ld/testsuite:
* ld-arm/attr-merge-wchar-0.s,ld-arm/attr-merge-wchar-2.s,
ld-arm/attr-merge-wchar-4.s, ld-arm/attr-merge-wchar-00-nowarn.d,
ld-arm/attr-merge-wchar-00.d, ld-arm/attr-merge-wchar-02-nowarn.d,
ld-arm/attr-merge-wchar-02.d, ld-arm/attr-merge-wchar-04-nowarn.d,
ld-arm/attr-merge-wchar-04.d, ld-arm/attr-merge-wchar-20-nowarn.d,
ld-arm/attr-merge-wchar-20.d, ld-arm/attr-merge-wchar-22-nowarn.d,
ld-arm/attr-merge-wchar-22.d, ld-arm/attr-merge-wchar-24-nowarn.d,
ld-arm/attr-merge-wchar-24.d, ld-arm/attr-merge-wchar-40-nowarn.d,
ld-arm/attr-merge-wchar-40.d, ld-arm/attr-merge-wchar-42-nowarn.d,
ld-arm/attr-merge-wchar-42.d, ld-arm/attr-merge-wchar-44-nowarn.d,
ld-arm/attr-merge-wchar-44.d: New.
* ld-arm/arm-elf.exp: Run new tests.
bfin_final_link_relocate, bfin_gc_mark_hook, bfin_gc_sweep_hook,
ELF_DYNAMIC_INTERPRETER, DEFAULT_STACK_SIZE,
struct _bfinfdpic_dynamic_got_info): Moved around to keep FD-PIC code
separate from non-FD-PIC.
checks for PCREL8, PCREL16, GOTPC16, GOTOFF16, PLT16, and GOT16
relocs.
(mn10300_elf_relax_section): Correct jump offset check when target
is in a different section.
* dwarf2.c (struct dwarf2_debug): New variable info_ptr_memory.
(find_line): Use info_ptr_memory instead of sec_info_ptr.
(_bfd_dwarf2_cleanup_debug_info): Likewise.
of unsigned long as last parameter.
(struct dwarf2_debug): Define dwarf_abbrev_size, dwarf_line_size,
dwarf_str_size and dwarf_ranges_size as bfd_size_type instead of
unsigned long.
* elfxx-mips.c (mips_elf_calculate_relocation): Calculate GP and GP0
for all relocation types. Allow any type of relocation to refer to
__gnu_local_gp.
ld/testsuite/
* ld-mips-elf/no-shared-1-o32.s,
ld-mips-elf/no-shared-1-o32.d,
ld-mips-elf/no-shared-1-n32.d,
ld-mips-elf/no-shared-1-n64.s,
ld-mips-elf/no-shared-1-n64.d,
ld-mips-elf/no-shared-1.ld: New tests.
* ld-mips-elf/mips-elf.exp: Run them.
* Makefile.am (BFD32_LIBS): Add compress.lo.
(BFD32_LIBS_CFILES): Add compress.c.
(BFD_H_FILES): Likewise.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* config.in: Add HAVE_ZLIB_H
* configure.in: Add test for libz and zlib.h
* configure: Regenerate.
* dwarf2.c (read_section): New function.
(read_indirect_string): Call new function read_section.
(read_abbrevs): Likewise.
(decode_line_info): Likewise.
(read_debug_ranges): Likewise.
(find_line): Call new function read_section when just one
.zdebug_info section is found, otherwise read and compress
multiple sections.
(_bfd_dwarf2_cleanup_debug_info): Free sec_info_ptr.
* elf.c (_bfd_elf_make_section_from_shdr): Add zdebug prefix.
(special_sections_z): New struct.
(special_sections): Refer to special_sections_z.
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Recognize
sections named .zdebug_*.
(_bfd_mips_elf_fake_sections): Likewise.
* compress.c: New file.
(bfd_uncompress_section_contents): New function.
bfd/doc/
* Makefile.am (BFD_H_DEP): Add ../compress.c.
* Makefile.in: Regenerate.
binutils/
* config.in: Add HAVE_ZLIB_H
* configure.in: Add test for libz and zlib.h
* configure: Regenerate.
* dwarf.c (debug_displays): Add .zdebug_* strings.
* dwarf.h (struct dwarf_section): Add fields uncompressed_namd
and compressed_name.
* objdump.c (load_debug_section): Call
bfd_uncompress_section_contents when loading a compressed
section.
(dump_dwarf_section): Recognize compressed section name.
(mach_o_dwarf_sections): Rename as
mach_o_uncompressed_dwarf_sections.
(mach_o_compressed_dwarf_sections): New variable.
(generic_dwarf_section): Rename as
generic_uncompressed_dwarf_sections.
(generic_compressed_dwarf_sections): New variable.
(check_mach_o_dwarf): Save and restore
mach_o_compressed_dwarf_sections.
* readelf.c: Add #include for config.h and zlib.h
(process_section_headers): Recognize compressed section name.
(uncompress_section_contents): New function.
(load_debug_section): Call uncompress_section_contents when
loading a compressed section.
(display_debug_section): Recognize compressed section name.
binutils/testsuite:
* binutils-all/objdump.exp: Add test for objdump -s on a file
with a compressed debug section. Add test for objdump -W on a
file that contains a compressed debug section.
* binutils-all/readelf.exp: Call readelf_compressed_wa_test.
(readelf_compressed_wa_test): New function.
* binutils-all/dw2-compressed.S: New file.
* binutils-all/objdump.W: New file.
* binutils-all/objdump.s: New file.
* binutils-all/readelf.wa: New file.
(allocate_spuear_stubs, build_spuear_stubs): Return value from
count_stub/build_stub.
(spu_elf_build_stubs): Correct location of stub reloc error message.
config/
* override.m4: Use m4_version_prereq throughout.
(_AC_ARG_VAR_VALIDATE, AC_MSG_FAILURE): Backport from git
Autoconf: output pwd along with fatal errors, so the right
config.log file is hinted at more prominently.
(PARSE_ARGS): Push setting of ac_pwd in this diversion.
(_GCC_AUTOCONF_VERSION): New, define to 2.59 if not defined.
(_GCC_AUTOCONF_VERSION_CHECK): New macro, require use of Autoconf
version _GCC_AUTOCONF_VERSION throughout the tree.
(m4_wrap): New override, fix for Posix semantics of m4wrap.
binutils/
* configure: Regenerate.
opcodes/
* configure: Regenerate.
bfd/
* configure: Regenerate.
gas/
* configure: Regenerate.
gprof/
* configure: Regenerate.
ld/
* config.in: Regenerate.
* configure: Regenerate.
(process_stubs): Likewise.
(discover_functions): Don't used cached symbols.
(maybe_insert_function): Correct condition under which function
array is realloc'd.
(mark_functions_via_relocs): Delete unused variable.
* elf.c (assign_file_positions_for_load_sections): Adjust pre-section
gaps based on VMA and P_VADDR instead of LMA and P_PADDR addresses.
binutils/testsuite/
* binutils-all/objcopy.exp: Call KEEP_DEBUG_SYMBOLS_AND_TEST_COPY.
(keep_debug_symbols_and_test_copy): New function.
(test5, test6): New variables.
bfd/
* elf32-m68k.c (struct elf_m68k_link_hash_entry: got_entry_key,
glist): New fields.
(struct elf_m68k_got_entry_key, struct elf_m68k_got_entry,
struct elf_m68k_got, struct elf_m68k_bfd2got_entry,
struct elf_m68k_multi_got): New data structures.
(struct elf_m68k_link_hash_table: local_gp_p, use_neg_got_offsets_p,
allow_multigot_p, multi_got_): New fields.
(elf_m68k_multi_got): New macro.
(elf_m68k_link_hash_newfunc): Initialize new fields of
struct elf_m68k_link_hash_entry.
(elf_m68k_link_hash_table_create): Initialize new fields of
struct elf_m68k_link_hash_table.
(elf_m68k_link_hash_table_free): New static function implementing hook.
(elf_m68k_init_got, elf_m68k_clear_got, elf_m68k_create_empty_got): New
static functions for struct elf_m68k_got.
(elf_m68k_init_got_entry_key, elf_m68k_got_entry_hash,
elf_m68k_got_entry_eq): New static functions for
struct elf_m68k_got_entry.
(ELF_M68K_REL_8O_MAX_N_ENTRIES_IN_GOT,
ELF_M68K_REL_8O_16O_MAX_N_ENTRIES_IN_GOT): New macros.
(enum elf_m68k_get_entry_howto): New enum.
(elf_m68k_get_got_entry, elf_m68k_update_got_entry_type,
elf_m68k_remove_got_entry_type): New static functions for
struct elf_m68k_got_entry.
(elf_m68k_add_entry_to_got): New static function.
(elf_m68k_bfd2got_entry_hash, elf_m68k_bfd2got_entry_eq,
elf_m68k_bfd2got_entry_del, elf_m68k_get_bfd2got_entry): New static
functions for struct elf_m68k_bfd2got_entry.
(struct elf_m68k_can_merge_gots_arg, elf_m68k_can_merge_gots_1,
elf_m68k_can_merge_gots): New traversal.
(struct elf_m68k_merge_gots_arg, elf_m68k_merge_gots_1,
elf_m68k_merge_gots): Ditto.
(struct elf_m68k_finalize_got_offsets_arg,
elf_m68k_finalize_got_offsets_1, elf_m68k_finalize_got_offsets): Ditto.
(struct elf_m68k_partition_multi_got_arg,
elf_m68k_partition_multi_got_1, elf_m68k_init_symndx2h_1,
elf_m68k_partition_multi_got): Ditto.
(elf_m68k_find_got_entry_ptr, elf_m68k_remove_got_entry): New static
functions.
(elf_m68k_copy_indirect_symbol): New static function implementing
a hook.
(elf_m68k_check_relocs): Update to add entries to multi-GOT.
(elf_m68k_gc_sweep_hook): Update to remove entries from multi-GOT.
(elf_m68k_always_size_sections): Assign BFDs to GOTs.
(elf_m68k_relocate_section): Update to properly handle GOT relocations.
(elf_m68k_finish_dynamic_symbol): Update to traverse all GOT entries
of a global symbol.
(bfd_elf_m68k_set_target_options): New function.
(bfd_elf32_bfd_link_hash_table_free): Define hook.
(bfd_elf32_bfd_final_link): Change expansion to bfd_elf_final_link
to skip generic calculation of GOT offsets.
(elf_backend_copy_indirect_symbol): Define hook.
* bfd-in.h (bfd_elf_m68k_set_target_options): Declare function.
* bfd-in2.h: Regenerate.
ld/
* configure.in (--enable-got): New option. Handle it.
* configure: Regenerate.
* config.in: Regenerate.
* emultempl/m68kelf.em: (got_handling_target_default): New shell
variable.
(GOT_HANDLING_TARGET_DEFAULT): New macro.
(GOT_HANDLING_DEFAULT): New macro. Initialize it from configure
option if one was given.
(got_handling): New static variable.
(elf_m68k_create_output_section_statements): New static function
implementing hook.
(PARSE_AND_LIST_PROLOGUE): Define shell variable.
(OPTION_GOT): New macro.
(PARSE_AND_LIST_LONGOPTS): Define shell variable. Specify
--got option.
(got): New linker option.
(PARSE_AND_LIST_OPTIONS): Define shell variable. Print help string
for --got option.
(PARSE_AND_LIST_ARGS_CASES): Define shell variable. Handle --got
option.
* ld.texinfo: Document --got=<type> option.
* gen-doc.texi: Add M68K.
* NEWS: Mention the new feature.
ld/testsuite/
* ld-m68k/got-12.s: New file.
* ld-m68k/got-13.s: New file.
* ld-m68k/got-14.s: New file.
* ld-m68k/got-15.s: New file.
* ld-m68k/got-34.s: New file.
* ld-m68k/got-35.s: New file.
* ld-m68k/got-single-12-ok.d: New dump test.
* ld-m68k/got-single-13-er.d: New dump test.
* ld-m68k/got-negative-14-ok.d: New dump test.
* ld-m68k/got-negative-15-er.d: New dump test.
* ld-m68k/got-negative-12-13-14-34-ok.d: New dump test.
* ld-m68k/got-negative-12-13-14-35-er.d: New dump test.
* ld-m68k/got-multigot-14-ok.d: New dump test.
* ld-m68k/got-multigot-15-er.d: New dump test.
* ld-m68k/got-multigot-12-13-14-34-35-ok.d: New dump test.
* ld-m68k/xgot-15.s: New source.
* ld-m68k/got-xgot-15-ok.d: New test.
* ld-m68k/got-xgot-12-13-14-15-34-35-ok.d: New test.
* ld-m68k/m68k.exp: Run new tests.
(ppc_elf_get_synthetic_symtab): New function.
(bfd_elf32_get_synthetic_symtab): Define.
* elf64-ppc.c (section_covers_vma): New function.
(ppc64_elf_get_synthetic_symtab): Generate sym@plt on glink branch
table entries, and __glink_PLTresolve on resolver stub.
(ppc64_elf_build_stubs): Rename __glink sym to __glink_PLTresolve.
* elf32-ppc.c (MUST_BE_DYN_RELOC): Delete.
(must_be_dyn_reloc): New function.
(ppc_elf_check_relocs): Don't set DF_STATIC_TLS for tprel relocs
in pies.
(ppc_elf_tls_optimize): Optimise pies.
(ppc_elf_relocate_section): Use a section symbol rather than no
symbol if possible for LD->IE TLS sequence, but don't error if
we must use no symbol.
* elf64-ppc.c (MUST_BE_DYN_RELOC): As for elf32-ppc.c.
(must_be_dyn_reloc): Likewise.
(ppc64_elf_check_relocs): Likewise.
(ppc64_elf_tls_optimize): Likewise.
(ppc64_elf_relocate_section): Likewise.
* elf32-xtensa.c (xtensa_property_section_name): New.
(xtensa_make_property_section): New.
(xtensa_get_property_section): Make static. Do not create a new
section if it does not exist.
gas/
* config/tc-xtensa.c (xtensa_create_property_segments): Use
xtensa_make_property_section instead of xtensa_get_property_section.
(xtensa_create_xproperty_segments): Likewise.
* elf32-spu.c (spu_elf_special_sections): Add "._ea".
(spu_elf_relocate_section): Handle relocations against symbols
defined in ._ea specially.
binutils/
* embedspu.sh: Take note of R_SPU_PPU32/64 relocs without a symbol,
and if present, put image in ".data.speelf". Put program handle
in ".data.spehandle".
ld/emulparams/
* elf32_spu.sh (OTHER_SECTIONS): Add "._ea".
* elf32ppc.sh: If building with spu support, put ".data.spehandle"
sections at the start of ".data" and provide a symbol to locate
the directory of embedded spe programs.
ld/testsuite/
* ld-spu/ear.s: Align various sections.
* ld-spu/embed.rd: Update.
* elf.c (rewrite_elf_program_header): Rather than clearing
p_paddr_valid at end, don't set it in the first place. Delete
comment no longer relevant. When not p_paddr_valid, don't set
paddr from vaddr, and don't set p_vaddr_offset.
* elf.c (_bfd_elf_make_section_from_shdr): Always set lma from p_paddr.
(assign_file_positions_for_load_sections): Combine nested "if".
(copy_elf_program_header): Don't set p_paddr_valid or p_vaddr_offset
when all header p_paddr fields are zero.
(_bfd_elf_canonicalize_dynamic_reloc): Find dynamic relocations
even if they are not loaded.
* elflink.c (_bfd_elf_init_2_index_sections): Set data_index_section
first.
* ld-arm/symbian-seg1.s, ld-arm/symbian-seg1.d: New files.
* ld-arm/arm-elf.exp: Run symbian-seg1.
* elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Don't
set the value of undefined symbols in shared objects.
(_bfd_mips_vxworks_finish_dynamic_symbol): Clear value for
undefined symbols unless pointer equality is needed.
ld/testsuite/
* ld-vxworks/plt-mips1.s: New.
* ld-vxworks/plt-mips1.d: New.
machine for matching core files.
(xcoff64_core_p): Set the architecture and machine to the default
values defined in the macros mentioned above.
* rs6000-core.c: Define macros to determine whether or not the
core file header uses the core_dumpxx header format.
(rs6000coff_core_p): Don't match core files that use the
core_dumpxx header format.
* elf32-spu.c: Include libiberty.h.
(struct spu_link_hash_table): Add local_stire, overlay_fixed, reserved,
non_ovly_stub, spu_elf_load_ovl_mgr, spu_elf_open_overlay_script,
spu_elf_relink, auto_overlay fields.
(AUTO_OVERLAY, AUTO_RELINK, OVERLAY_RODATA): Define.
(needs_ovl_stub): Flip test so that call to non-function warning
is emitted during relocate_section rather than earlier.
(spu_elf_check_vma): Stash --auto-overlay parameters, and clear
auto_overlay if no section exceeds local store.
(struct call_info): Add count, max_depth, is_pasted fields.
(struct function_info): Add rodata, last_caller, call_count,
depth, new visit flags.
(insert_callee): Increment call count.
(copy_callee): New function.
(mark_functions_via_relocs): Investigate all reloc types to count
possible function pointer stubs for --auto-overlay. Track
last_caller and increment function call_count.
(pasted_function): Insert a "call" into call info for pasted section.
(remove_cycles): Track max depth of calls. Don't emit call graph
pruning warning for --auto-overlay.
(build_call_tree): Don't transfer_calls for --auto-overlay.
Adjust remove_cycles call.
(sort_calls, sort_lib, sort_bfds): New functions.
(struct _mos_param, struct _uos_param, struct _cl_param): New.
(mark_overlay_section, unmark_overlay_section): New functions.
(collect_lib_sectios, auto_ovl_lib_functions): New functions.
(collect_overlays, find_pasted_call): New functions.
(sum_stack): Deal with is_pasted "calls". Exit before printing
when --auto-overlay.
(spu_elf_auto_overlay): New function.
(spu_elf_final_link): Call spu_elf_auto_overlay.
* elf32-spu.h (spu_elf_check_vma): Update prototype.
ld/
* emultempl/spuelf.em (auto_overlay, auto_overlay_file,
auto_overlay_fixed, auto_overlay_reserved, my_argc, my_argv): New vars.
(spu_before_allocation): Warn on --auto-overlay and existing overlays.
(struct tflist, clean_tmp): Move.
(new_tmp_file): New function, extracted from..
(embedded_spu_file): ..here.
(spu_elf_open_overlay_script, spu_elf_relink): New function.
(gld${EMULATION_NAME}_finish): Pass a bunch of --auto-overlay params.
Warn on --auto-overlay and zero local store.
(gld${EMULATION_NAME}_choose_target): New function to stash argv.
(OPTION_SPU_AUTO_OVERLAY, OPTION_SPU_AUTO_RELINK,
OPTION_SPU_OVERLAY_RODATA, OPTION_SPU_FIXED_SPACE,
OPTION_SPU_RESERVED_SPACE, OPTION_SPU_NO_AUTO_OVERLAY): Define.
(PARSE_AND_LIST_LONGOPTS): Add entries for new options.
(PARSE_AND_LIST_OPTIONS): Likewise.
(PARSE_AND_LIST_ARGS_CASES): Likewise.
(LDEMUL_CHOOSE_TARGET): Define.