* elf.c (_bfd_elf_init_private_section_data): Add an assertion
that the output section has an allocated bfd_elf_section_data
structure.
* elfxx-mips.c (mips_elf_check_symbols): Do not create a stub for
symbols in sections that have been removed by garbage collection.
* emultempl/mipself.em (mips_add_stub_section): Do not add stubs
for sections that have been removed by garbage collection.
bfd/
* elf.c (assign_file_positions_for_load_sections): Set sh_offset for
.tbss, and page align same for all SHT_NOBITS sections.
ld/
* ldlang.c (lang_output_section_find_by_flags): Match orphan .sdata2
like sections to existing .sdata2, and similarly for orphan TLS
sections.
* emultempl/elf32.em (place_orphan): Exclude .tbss from orphan_bss.
* elf.c (_bfd_elf_make_section_from_shdr): Set up TLS section LMAs
from PT_TLS header.
(_bfd_elf_map_sections_to_segments): Don't create a final PT_LOAD
segment if just for .tbss.
(assign_file_positions_for_load_sections): Don't report "can't
allocate in segment" errors for .tbss.
(assign_file_positions_for_non_load_sections): Don't set p_filesz
from SHT_NOBITS section filepos.
* internal.h (elf_internal_sym): Add st_target_internal.
* arm.h (arm_st_branch_type): New enum.
(ARM_SYM_BRANCH_TYPE): New macro.
bfd/
* elf-bfd.h (elf_link_hash_entry): Add target_internal.
* elf.c (swap_out_syms): Set st_target_internal for each
Elf_Internal_Sym.
* elfcode.h (elf_swap_symbol_in): Likewise.
* elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise.
* elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise.
* elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
* elflink.c (elf_link_output_extsym): Likewise.
(bfd_elf_final_link): Likewise.
(elf_link_add_object_symbols): Copy st_target_internal
to the hash table if we see a definition.
(_bfd_elf_copy_link_hash_symbol_type): Copy target_internal.
* elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with
a branch_type field.
(a8_erratum_fix, a8_erratum_reloc): Likewise.
(arm_type_of_stub): Replace actual_st_type with an
actual_branch_type parameter.
(arm_build_one_stub): Use branch types rather than st_types to
determine the type of branch.
(cortex_a8_erratum_scan): Likewise.
(elf32_arm_size_stubs): Likewise.
(bfd_elf32_arm_process_before_allocation): Likewise.
(allocate_dynrelocs_for_symbol): Likewise.
(elf32_arm_finish_dynamic_sections): Likewise.
(elf32_arm_final_link_relocate): Replace sym_flags parameter with
a branch_type parameter.
(elf32_arm_relocate_section): Update call accordingly.
(elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC.
(elf32_arm_output_map_sym): Initialize st_target_internal.
(elf32_arm_output_stub_sym): Likewise.
(elf32_arm_symbol_processing): Delete.
(elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs.
Use st_target_internal to record the branch type.
(elf32_arm_swap_symbol_out): Use st_target_internal to test for
Thumb functions.
(elf32_arm_is_function_type): Delete.
(elf_backend_symbol_processing): Likewise.
(elf_backend_is_function_type): Likewise.
gas/
* config/tc-arm.c (arm_adjust_symtab): Set the branch type
for Thumb symbols.
ld/
* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check
eh->target_internal.
opcodes/
* arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC.
Use branch types instead.
(print_insn): Likewise.
* readelf.c (process_program_headers): Issue a warning if there
are no program headers but the file header has a non-zero program
header offset.
(process_section_headers): Issue a warning if there are no section
headers but the file header has a non-zero section header offset.
(process_section_groups): Reword the no section message so that it
can be distinguished from the one issued by process_section_headers.
* elf.c (assign_file_positions_for_load_sections): Set the program
header offset and entry size to zero if there are no program
headers.
* elf-bfd.h (struct bfd_elf_section_reloc_data): New structure.
(struct bfd_elf_section_data): New members REL and RELA; delete
members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX,
REL_IDX2, REL_HASHES.
(_bfd_elf_init_reloc_shdr): Adjust declaration.
(_bfd_elf_single_rel_hdr): Declare.
(RELOC_AGAINST_DISCARDED_SECTION): Use it.
* elf.c (bfd_section_from_shdr): Adjusted to match changes in
data structures.
(_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR.
All callers changed. Allocate memory for the Elf_Internal_Shdr
structure.
(_bfd_elf_single_rel_hdr): New function.
(struct fake_section_arg): New structure.
(elf_fake_section): Expect to see a pointer to it in the third
argument. If doing a relocatable link, allocate both REL and RELA
sections as needed.
(assign_section_numbers): Adjusted to match changes in
data structures.
(_bfd_elf_compute_section_file_positions): Call elf_fake_sections
with a struct fake_section_args argument.
* elfcode.h (elf_write_relocs): Adjusted to match changes in
data structures.
(elf_slurp_reloc_table): Likewise.
* elflink.c (_bfd_elf_link_read_relocs): Likewise.
(_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with
RELDATA. Remove argument O. All callers changed. Remove code to
discover the right rel_hdr and count.
(_bfd_elf_link_output_relocs): Adjusted to match changes in
data structures.
(elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH;
replace with RELDATA. All callers changed.
(elf_link_input_bfd): Correctly generate rel_hash data when both
REL and RELA sections are present.
(elf_reloc_link_order): Adjusted to match changes in
data structures.
(bfd_elf_final_link): Simplify code to count relocs. Free the
hashes array for both REL and RELA.
(get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr
* elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections):
Delete.
* elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections):
Delete.
(elf32_tic6x_rel_relocation_p): Adjusted to match changes in
data structures.
* elf32-microblaze.c (microblaze_elf_check_relocs): Use
_bfd_elf_single_rel_hdr.
* elf32-ppc.c (ppc_elf_relax_section): Likewise.
* elf32-spu.c (spu_elf_relocate_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
* elf64-hppa.c (get_reloc_section): Likewise.
* elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match
changes in data structures.
(mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr.
* elf64-ppc.c (ppc64_elf_edit_opd): Likewise.
(ppc64_elf_edit_toc): Likewise.
(get_relocs): Adjusted to match changes in data structures.
Allocate an Elf_Internal_Shdr structure if necessary.
(ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr.
* elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match
changes in data structures.
* elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr.
* elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro.
(mips_elf_rel_relocation_p): Adjusted to match changes in data
structures.
(_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather
than MIPS_RELOC_RELOCA_P.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use
_bfd_elf_single_rel_hdr.
(_bfd_sparc_elf_relocate_section): Likewise.
ld/
* emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use
_bfd_elf_single_rel_hdr.
* ldlang.c (lang_add_section): Don't copy SEC_RELOC from input
to output section on a final link.
bfd/
* elf.c (_bfd_elf_init_private_section_data): Allow for SEC_RELOC
difference between input and output section.
* elf.c (bfd_elf_get_default_section_type): Don't test SEC_NEVER_LOAD.
* elflink.c (elf_link_input_bfd): Likewise.
ld/
* ld.texinfo (NOLOAD): Do not erroneously state that contents will
appear in output file.
* ldlang.c (lang_add_section): Clear SEC_HAS_CONTENTS on noload
unless SEC_COFF_SHARED_LIBRARY.
(map_input_to_output_sections): Don't set SEC_HAS_CONTENTS for noload
output sections.
(lang_size_sections_1): Don't test SEC_NEVER_LOAD when deciding
to update dot in region. Ditto when setting SEC_ALLOC if dot
advanced due to assignment.
* ldwrite.c (build_link_order): Don't test SEC_NEVER_LOAD.
* elf.c (copy_elf_program_header): Calculate map->header_size
from lowest_section, not first_section. Validate program
header p_paddr against section lma. Find lowest_section in
second loop over headers.
headers if any loaded section wraps the address space. Simplify
~(m-1) to -m. Use lma rather than vma when determining whether
note sections are adjacent.
PR corefile/8210
bfd/
* bfd-in2.h: Regenerate.
* corefile.c (bfd_core_file_pid): New.
* targets.c (BFD_JUMP_TABLE_CORE): Add NAME##_core_file_pid.
(struct bfd_target) <_core_file_pid>: New.
* libbfd-in.h (_bfd_nocore_core_file_pid): Declare.
* libbfd.c (_bfd_nocore_core_file_pid): New.
* elf-bfd.h (bfd_elf32_core_file_pid, bfd_elf64_core_file_pid):
Declare.
* elfcode.h (elf_core_file_pid): New define.
* elfcore.h (elf_core_file_pid): New function.
* elf.c (elfcore_make_pid): Rewrite.
(elfcore_grok_prstatus): Only set core_pid if not set yet.
(elfcore_grok_prstatus) [!HAVE_PRSTATUS_T_PR_WHO]: Fallback to
getting the lwpid from prstat.pr_pid.
* elf64-x86-64.c (elf64_x86_64_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
(elf64_x86_64_grok_psinfo): Extract the the main process's PID,
and store it in elf_tdata's core_pid field.
* elf32-i386.c (elf_i386_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
(elf_i386_grok_psinfo): Extract the the main process's PID, and
store it in elf_tdata's core_pid field.
* elf32-am33lin.c (elf32_am33lin_grok_prstatus): Write the LWPID
to elf_tdata's core_lwpid instead of to core_pid.
* elf32-arm.c (elf32_arm_nabi_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-cris.c (cris_elf_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-frv.c (elf32_frv_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-hppa.c (elf32_hppa_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-ppc.c (ppc_elf_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-s390.c (elf_s390_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-score.c (s3_bfd_score_elf_grok_prstatus): Write the LWPID
to elf_tdata's core_lwpid instead of to core_pid.
* elf32-score7.c (s7_bfd_score_elf_grok_prstatus): Write the LWPID
to elf_tdata's core_lwpid instead of to core_pid.
* elf32-sh.c (elf32_shlin_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf32-xtensa.c (elf_xtensa_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf64-hppa.c (elf64_hppa_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf64-mips.c (elf64_mips_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elf64-ppc.c (ppc64_elf_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* elfn32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to
elf_tdata's core_lwpid instead of to core_pid.
* plugin.c (bfd_plugin_core_file_pid): New function.
* aout-target.h (MY_core_file_pid): Define.
* aout-tic30.c (MY_core_file_pid, MY_core_file_p): New defines.
* coff-rs6000.c (coff_core_file_pid): New define.
(rs6000coff_vec, pmac_xcoff_vec): Use BFD_JUMP_TABLE_CORE.
* coff64-rs6000.c (coff_core_file_pid): New define.
(rs6000coff64_vec): Use BFD_JUMP_TABLE_CORE.
(xcoff64_core_file_pid): New define.
(aix5coff64_vec): Use BFD_JUMP_TABLE_CORE.
* mach-o-target.c (bfd_mach_o_core_file_pid): New define.
* aix386-core.c (aix386_core_file_pid): New define.
* hppabsd-core.c (hppabsd_core_core_file_pid): New define.
* hpux-core.c (hpux_core_core_file_pid): New define.
* irix-core.c (irix_core_core_file_pid): New define.
* lynx-core.c (lynx_core_file_pid): New define.
* osf-core.c (osf_core_core_file_pid): New define.
* ptrace-core.c (ptrace_unix_core_file_pid): New define.
* sco5-core.c (sco5_core_file_pid): New define.
* xcoff-target.h (coff_core_file_pid): New define.
* netbsd-core.c (netbsd_core_core_file_pid): New define.
gdb/
2010-08-18 Pedro Alves <pedro@codesourcery.com>
PR corefile/8210
gdb/
* corelow.c (add_to_thread_list): Don't use
gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid.
(get_core_register_section): Don't use
gdbarch_core_reg_section_encodes_pid.
* gdbarch.sh (core_reg_section_encodes_pid): Delete.
* gdbarch.h, gdbarch.c: Regenerate.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Don't set
gdbarch_core_reg_section_encodes_pid.
* i386-sol2-tdep.c (i386_sol2_init_abi): Ditto.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Ditto.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Ditto.
* internal.h (ELF_TBSS_SPECIAL): New macro, extracted from..
(ELF_SECTION_SIZE): ..here.
(ELF_SECTION_IN_SEGMENT_1): Add "strict" arg.
(ELF_SECTION_IN_SEGMENT_STRICT): New macro.
bfd/
* elf.c (assign_file_positions_for_load_sections): Check that
zero size sections are allocated in segments too.
(assign_file_positions_for_non_load_sections): Warn if zero
size alloc sections are found here.
(copy_elf_program_header): Don't drop zero size sections from
segment map.
(copy_private_bfd_data): Check for changes in zero size sections.
binutils/
* readelf.c (process_program_headers): Don't ignore all zero size
sections.
ld/testsuite/
* ld-powerpc/tlsexe.r: Update.
* ld-powerpc/tlsexetoc.r: Update.
* ld-powerpc/tlsso.r: Update.
* ld-powerpc/tlstocso.r: Update.
for sections with overlapping LMAs.
(assign_file_positions_for_load_sections): Catch overlap for
sections that wrap around the address space. Replace a
warning that duplicates ld's --check-sections error with a
warning that lma has been adjusted for overlapping sections.
* internal.h (ELF_SECTION_SIZE): Protect macro args with parentheses.
Invert logic to clarify test for .tbss.
(ELF_IS_SECTION_IN_SEGMENT): Rename to..
(ELF_SECTION_IN_SEGMENT_1): ..this. Add check_vma param. Protect
macro args with parentheses.
(ELF_SECTION_IN_SEGMENT): Define.
(ELF_IS_SECTION_IN_SEGMENT_FILE): Delete.
(ELF_IS_SECTION_IN_SEGMENT_MEMORY): Delete.
bfd/
* elf.c: Replace use of ELF_IS_SECTION_IN_SEGMENT and
ELF_IS_SECTION_IN_SEGMENT_FILE with ELF_SECTION_IN_SEGMENT
throughout file.
(assign_file_positions_for_load_sections): Modify section in
segment warning to ignore overlay vmas.
* elf32-spu.c (spu_elf_object_p): Replace use of
ELF_IS_SECTION_IN_SEGMENT_MEMORY with ELF_SECTION_IN_SEGMENT.
binutils/
* readelf.c (process_program_headers): Replace use of
ELF_IS_SECTION_IN_SEGMENT_MEMORY with ELF_SECTION_IN_SEGMENT.
* elf.c (assign_file_positions_for_load_sections): Revert 2008-05-29
change. Tidy. Don't error on sections not allocated in segment.
ld/testsuite/
* ld-elf/extract-symbol-1sec.d: Update lma.
* ld-i386/alloc.d: Expect a warning, not an error.
2010-04-10 H.J. Lu <hongjiu.lu@intel.com>
PR corefiles/11467
* configure.in (CORE_HEADER): New. Set to hosts/x86-64linux.h
for x86_64-*-linux*.
* config.in: Regenerated.
* configure: Likewise.
* elf.c: Include CORE_HEADER if it is defined.
2010-04-10 H.J. Lu <hongjiu.lu@intel.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* hosts/x86-64linux.h: New.
PR ld/11304
* elf.c (_bfd_elf_init_private_section_data): Rename need_group
to final_link and invert. For final link allow some flags to
differ. Don't specially allow flags to be all zero.
ld/
* ldlang.c (init_os): Remove isec param. Don't check for
bfd_section already set or call bfd_init_private_section_data
here.
(exp_init_os): Update init_os call.
(lang_add_section): Tidy. Really don't set SEC_LINK_ONCE
flags. Call bfd_init_private_section_data here.
(map_input_to_output_sections): Tidy. Update init_os calls.
Use os->sectype to select sec flags for lang_data_statement.
commit. Don't write zeros for removed group members.
(_bfd_elf_copy_private_header_data): Adjust size of group section
when group members are removed by objcopy.
* elf.c (bfd_section_from_shdr): Allow SHN_BEFORE and SHN_AFTER
section link values in x86 binaries.
* elfcode.h (elf_object_p): Likewise.
* readelf.c (get_elf_section_flags): Allow SHN_BEFORE and
SHN_AFTER section link values in x86 binaries.
(process_section_headers): Likewise.
* elf.c (bfd_section_from_shdr): Do not reject sparc binaries with
section headers containing sh_link values of SHN_BEFORE or
SHN_AFTER.
* elfcode.h (elf_object_p): Likewise.
readelf.c (get_elf_section_flags): Add support for SHF_EXCLUDE and
SHF_ORDERED.
(process_section_headers): Warn about out of range sh_link
values. When displaying detailed section header information
annote the SHN_BEFORE and SHN_AFTER values.
gnu_unique_object.
* doc/as.texinfo: Document new feature of .type directive.
* NEWS: Mention support for gnu_unique_object symbol type.
* common.h (STB_GNU_UNIQUE): Define.
* NEWS: Mention the linker's support for symbols with a binding of
STB_GNU_UNIQUE.
* gas/elf/type.s: Add unique global symbol definition.
* gas/elf/type.e: Add expected readelf output for global unique
symbol.
* elfcpp.h (enum STB): Add STB_GNU_UNIQUE.
* readelf.c (get_symbol_binding): For Linux targeted files return
UNIQUE for symbols with the STB_GNU_UNIQUE binding.
* doc/binutils.texi: Document the meaning of the 'u' symbol
binding in the output of nm and objdump --syms.
* elf-bfd.h (struct elf_link_hash_entry): Add unique_global field.
* elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols
with the BSF_GNU_UNIQUE flag bit set.
* elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag
for symbols with STB_GNU_UNIQUE binding.
* elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols
with the STB_GNU_UNIQUE binding.
(elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for
symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for
symbols with the unique_global field set.
(elf_link_output_extsym): Set unique_global field for symbols with
the STB_GNU_UNIQUE binding.
* syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit.
(bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE
symbols.
(bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE
symbols.
* bfd-in2.h: Regenerate.
2009-06-27 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10337
* elf.c (bfd_section_from_shdr): Don't change sh_link for
SHT_REL/SHT_RELA sections on executable nor shared library.
Treat SHT_REL/SHT_RELA sections with sh_link set to SHN_UNDEF
as a normal section.
ld/testsuite/
2009-06-27 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10337
* ld-ifunc/binutils.exp: New.
2009-04-30 Nick Clifton <nickc@redhat.com>
* common.h (STT_GNU_IFUNC): Define.
elfcpp
2009-04-30 Nick Clifton <nickc@redhat.com>
* (enum STT): Add STT_GNU_IFUNC.
gas
2009-04-30 Nick Clifton <nickc@redhat.com>
* config/obj-elf.c (obj_elf_type): Add support for a
gnu_indirect_function type.
* config/tc-i386.c (tc_i386_fix_adjustable): Do not adjust fixups
against indirect function symbols.
* doc/as.texinfo (.type): Document the support for the
gnu_indirect_function symbol type.
* NEWS: Mention the new feature.
gas/testsuite
2009-04-30 Nick Clifton <nickc@redhat.com>
* gas/elf/elf.exp: Extend type test to include an ifunc symbol.
Provide an alternative test for targets which do not support ifunc
symbols.
(type.s): Add entry for an ifunc symbol.
(type.e): Add ifunc entry to expected symbol dump.
(section2.e-armelf): Add entry for ifunc symbol.
(type-noifunc.s): New file.
(type-noifunc.e): New file.
bfd/
2009-04-30 Nick Clifton <nickc@redhat.com>
* elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs
section pointer.
(struct elf_obj_data): Add has_ifunc_symbols boolean.
* elf.c (swap_out_syms): Convert BSF_GNU_INDIRECT_FUNCTION flags
into a STT_GNU_IFUNC symbol type.
(_bfd_elf_is_function_type): Accept STT_GNU_IFUNC as a function
type.
(_bfd_elf_set_osabi): Set the osasbi field to ELFOSABI_LINUX if
the binary contains ifunc symbols.
* elfcode.h (elf_slurp_symbol_table): Translate the STT_GNU_IFUNC
symbol type into a BSF_GNU_INDIRECT_FUNCTION flag.
* elf32-i386.c (is_indirect_function): New function.
(elf_i386_check_relocs): Create an ifunc output section.
(allocate_dynrelocs): Create dynamic relocs in the ifunc output
section if necessary.
(elf_i386_relocate_section): Emit a reloc against an ifunc symbol
if necessary.
(elf_i386_add_symbol_hook): New function. Set the
has_ifunc_symbols field of the elf_obj_data structure if an ifunc
symbol is encountered.
(elf_backend_post_process_headers): Define.
(elf_backend_add_symbol_hook): Define.
(elf_i386_post_process_headers): Rename to
elf_i388_fbsd_post_process_headers.
* elf64-x86_64.c (IS_X86_64_PCREL_TYPE): New macro.
(is_indirect_function): New function.
(elf64_x86_64_check_relocs): Create an ifunc output section.
(allocate_dynrelocs): Create dynamic relocs in the ifunc output
section if necessary.
(elf64_x86_64_relocate_section): Emit a reloc against an ifunc
symbol if necessary.
(elf_i386_add_symbol_hook): Set the has_ifunc_symbols field of the
elf_obj_data structure if an ifunc symbol is encountered.
(elf_backend_post_process_headers): Define.
* elflink.c (_bfd_elf_adjust_dynamic_symbol): Always create a PLT
if we have ifunc symbols to handle.
(get_ifunc_reloc_section_name): New function. Computes the name
for an ifunc section.
(_bfd_elf_make_ifunc_reloc_section): New function. Creates a
section to hold ifunc relocs.
* syms.c (BSF_GNU_INDIRECT_FUNCTION): Define.
(bfd_print_symbol_vandf): Handle ifunc symbols.
(bfd_decode_symclass): Likewise.
* bfd-in2.h: Regenerate.
binutils
2009-04-30 Nick Clifton <nickc@redhat.com>
* readelf.c (dump_relocations): Display a relocation against an
ifunc symbol as if it were a function invocation.
(get_symbol_type): Handle STT_GNU_IFUNC.
ld
2009-04-30 Nick Clifton <nickc@redhat.com>
* NEWS: Mention support for IFUNC symbols.
ld/testsuite
2009-04-30 Nick Clifton <nickc@redhat.com>
* ld-ifunc: New directory.
* ld-ifunc/ifunc.exp: New file: Run the IFUNC tests.
* ld-ifunc/prog.c: New file.
* ld-ifunc/lib.c: New file.
* elf.c (copy_elf_program_header): Do not check that PT_GNU_RELRO
p_filesz and p_memsz are equal. Use p_memsz as the segment size.
(assign_file_positions_for_non_load_sections): Zap PT_GNU_RELRO
if we don't find matching PT_LOAD when copying.
2009-03-13 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/9945
* elf.c (assign_section_numbers): Generate symbol table if there
is any relocation in output.
(_bfd_elf_compute_section_file_positions): Likewise.
binutils/
2009-03-13 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/9945
* objcopy.c (copy_object): Clear HAS_RELOC when stripping all.
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
* common.h (STT_IFUNC): Define.
elfcpp/
* elfcpp.h (enum STT): Add STT_IFUNC.
bfd/
* syms.c (struct bfd_symbol): Add new flag BSF_INDIRECT_FUNCTION.
Remove redundant flag BFD_FORT_COMM_DEFAULT_VALUE. Renumber flags
to remove gaps.
(bfd_print_symbol_vandf): Return 'i' for BSF_INDIRECT_FUNCTION.
(bfd_decode_symclass): Likewise.
* elf.c (swap_out_syms): Translate BSF_INDIRECT_FUNCTION into
STT_IFUNC.
(elf_find_function): Treat STT_IFUNC in the same way as STT_FUNC.
(_bfd_elf_is_function_type): Likewise.
* elf32-arm.c (arm_elf_find_function): Likewise.
(elf32_arm_adjust_dynamic_symbol): Likewise.
(elf32_arm_swap_symbol_in): Likewise.
(elf32_arm_additional_program_headers): Likewise.
* elf32-i386.c (is_indirect_symbol): New function.
(elf_i386_check_relocs): Also generate dynamic relocs for
relocations against STT_IFUNC symbols.
(allocate_dynrelocs): Likewise.
(elf_i386_relocate_section): Likewise.
* elf64-x86-64.c (is_indirect_symbol): New function.
(elf64_x86_64_check_relocs): Also generate dynamic relocs for
relocations against STT_IFUNC symbols.
(allocate_dynrelocs): Likewise.
(elf64_x86_64_relocate_section): Likewise.
* elfcode.h (elf_slurp_symbol_table): Translate STT_IFUNC into
BSF_INDIRECT_FUNCTION.
* elflink.c (_bfd_elf_adjust_dynamic_reloc_section): Add support
for STT_IFUNC symbols.
(get_ifunc_reloc_section_name): New function.
(_bfd_elf_make_ifunc_reloc_section): New function.
* elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs field.
* bfd-in2.h: Regenerate.
gas/
* config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type.
* doc/as.texinfo: Document new feature.
* NEWS: Mention new feature.
gas/testsuite/
* gas/elf/type.s: Add test of STT_IFUNC symbol type.
* gas/elf/type.e: Update expected disassembly.
* gas/elf/elf.exp: Update grep of symbol types.
ld/
* NEWS: Mention new feature.
* pe-dll.c (process_def_file): Replace use of redundant
BFD_FORT_COMM_DEFAULT_VALUE with 0.
* scripttempl/elf.sc: Add .rel.ifunc.dyn and .rela.ifunc.dyn
sections.
ld/testsuite/
* ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc
descriptions.
* ld-mips-elf/reloc-1-n64.d: Likewise.
* ld-i386/ifunc.d: New test.
* ld-i386/ifunc.s: Source file for the new test.
* ld-i386/i386.exp: Run the new test.
* elf.c (assign_file_positions_for_load_sections): Use header_size
to avoid moving the load address of file headers.
(assign_file_positions_for_load_sections): Set header_size for
segments containing the file header.
include/elf/
* internal.h (struct elf_segment_map): Add header_size field.
* elf.c (assign_file_positions_for_load_sections): Allocate phrds
with bfd_zalloc2 instead of bfd_alloc2. For the amount, use
the possibly-preset header-size, not the computed one.
(bfd_section_from_shdr): Don't change SHT_GROUP section name.
* elflink.c (section_signature): New function.
(_bfd_elf_section_already_linked): Use it.
* elf-bfd.h (elf_backend_data): Add a "rela_plts_and_copies_p" field.
* elfxx-target.h (elf_backend_rela_plts_and_copies_p): New macro.
(elfNN_bed): Use it.
* elf.c (_bfd_elf_get_synthetic_symtab): Use rela_plts_and_copies_p
instead of default_use_rela_p to choose between ".rel.plt" and
".rela.plt".
* elflink.c (_bfd_elf_create_dynamic_sections): Use
rela_plts_and_copies_p instead of default_use_rela_p to choose
between ".rel.plt" and ".rela.plt", and between ".rel.bss" and
".rela.bss".
* 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.
* 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.
* 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.