* 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.