aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
AgeCommit message (Collapse)AuthorFilesLines
2012-07-04Check number of sections overflowH.J. Lu1-0/+7
* elf.c (assign_section_numbers): Check if number of sections >= SHN_LORESERVE. * elfcode.h (elf_object_p): Likewise.
2012-07-03Don't compress empty debug sectionH.J. Lu1-1/+1
2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14319 * elf.c (_bfd_elf_make_section_from_shdr): Don't compress empty debug section. 2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14319 * binutils-all/compress.exp: Test compress empty debug sections. * binutils-all/dw2-empty.S: New file.
2012-07-03 PR ld/14207Alan Modra1-10/+8
* elf.c (assign_file_positions_for_load_sections): Remove assertions that only PT_LOAD headers include file header and section headers. (assign_file_positions_for_non_load_sections): Similarly don't assert PT_GNU_RELRO header does not include file and section headers. Compare first section vma rather than PT_LOAD p_vaddr against relro_start when looking for PT_LOAD covering PT_GNU_RELRO. Replace abort with assertion.
2012-07-01* elf.c (_bfd_elf_make_section_from_shdr): Fix typo in errorAndreas Schwab1-2/+2
message.
2012-06-22bfd/Roland McGrath1-0/+49
* elf.c (assign_file_positions_for_non_load_sections): Define __ehdr_start symbol if it's referenced and there's a PT_LOAD segment that covers both the file and program headers. ld/ * NEWS: Mention __ehdr_start. ld/testsuite/ * ld-elf/ehdr_start.s: New file. * ld-elf/ehdr_start.d: New file.
2012-06-12Abort if PT_GNU_RELRO segment doesn't fit in PT_LOAD segmentH.J. Lu1-0/+5
bfd/ PR bfd/14207 * elf.c (assign_file_positions_for_non_load_sections): Abort if PT_GNU_RELRO segment doesn't fit in PT_LOAD segment. ld/testsuite/ PR ld/14207 * ld-x86-64/x86-64.exp: Run pr14207. * ld-x86-64/pr14207.d: New file. * ld-x86-64/pr14207.s: Likewise.
2012-06-12 PR ld/14207Alan Modra1-7/+14
* elf.c (_bfd_elf_map_sections_to_segments): Disregard bss type sections at end of PT_LOAD segment when searching for segment that contains end of relro extent.
2012-06-11Reindent assign_file_positions_for_non_load_sectionsH.J. Lu1-8/+9
* elf.c (assign_file_positions_for_non_load_sections): Reindent.
2012-06-11Reindent _bfd_elf_map_sections_to_segmentsH.J. Lu1-1/+1
* elf.c (_bfd_elf_map_sections_to_segments): Reindent.
2012-06-04bfd/Jan Kratochvil1-1/+1
* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument of target_read_memory as bfd_size_type. * bfd-in2.h: Regenerate. * elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN argument of target_read_memory as bfd_size_type. (_bfd_elf32_bfd_from_remote_memory): Likewise. (_bfd_elf64_bfd_from_remote_memory): Likewise. * elf.c (bfd_elf_bfd_from_remote_memory): Likewise. * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise. gdb/ * symfile-mem.c: 3 new gdb_static_assert for target_read_memory_bfd parameters. (target_read_memory_bfd): New function. (symbol_file_add_from_memory): Use it.
2012-06-03 PR binutils/13897Alan Modra1-56/+79
* elf.c (elf_find_function): Cache last function sym info. (_bfd_elf_maybe_function_sym): Return function size, pass in section of interest. * elf-bfd.h (struct elf_backend_data <maybe_function_sym>): Likewise. (_bfd_elf_maybe_function_sym): Likewise. * elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise. (opd_entry_value): Add in_code_sec param. Revert caching code. Return -1 if in_code_sec and function found in wrong section. Update all calls.
2012-06-01bfd/Jan Kratochvil1-1/+1
* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument of target_read_memory as size_t. * bfd-in2.h: Regenerate. * elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN argument of target_read_memory as size_t. (_bfd_elf32_bfd_from_remote_memory): Likewise. (_bfd_elf64_bfd_from_remote_memory): Likewise. * elf.c (bfd_elf_bfd_from_remote_memory): Likewise. * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise. gdb/ * target.c (target_read_memory): Make LEN argument as size_t. * target.h (target_read_memory): Likewise.
2012-05-17 * elf.c (ignore_section_sym): Correct comment. Don't returnAlan Modra1-15/+15
true for absolute section. (elf_map_symbols): Move stray comment. Adjust for above change. Don't discard global section symbols.
2012-05-16 PR ld/13962Alan Modra1-1/+19
PR ld/7023 * elf.c (bfd_section_from_shdr): Fail when .dynsym sh_info is out of range. As a special case, fix sh_info for zero sh_size. Do the same for .symtab.
2012-05-082012-05-08 Ben Cheng <bccheng@google.com>Doug Kwan1-2/+8
* bfd/elf.c: Preserve the original p_align and p_flags if they are valid.
2012-04-24 PR ld/13991Alan Modra1-5/+5
bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-09bfd/Roland McGrath1-5/+9
* elf.c (_bfd_elf_map_sections_to_segments): Set INFO->user_phdrs. * elf-nacl.c (nacl_modify_segment_map): Do nothing if INFO->user_phdrs. (nacl_modify_program_headers): Likewise. include/ * bfdlink.h (struct bfd_link_info): Add new member user_phdrs.
2012-03-23 * elf.c (assign_file_positions_for_non_load_sections): Don't warnAlan Modra1-6/+7
on empty alloc sections.
2012-02-07 * elf.c (elf_find_function): Don't use internal_elf_sym.Alan Modra1-34/+25
(_bfd_elf_maybe_function_sym): Likewise. Replace elf_symbol_type parameter with asymbol. * elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise. * elf-bfd.h (_bfd_elf_maybe_function_sym): Update prototype. (struct elf_backend_data <maybe_function_sym>): Likewise.
2012-01-23 * elf-bfd.h: Formatting.Alan Modra1-8/+27
(struct elf_backend_data): Add "maybe_function_sym". (_bfd_elf_maybe_function_sym): Declare. * elfxx-target.h (elf_backend_maybe_function_sym): Define. (elfNN_bed): Init new field. * elf.c (elf_find_function): Use maybe_function_sym. (_bfd_elf_maybe_function_sym): New function. * elf64-ppc.c (elf_backend_maybe_function_sym): Define. (ppc64_elf_maybe_function_sym): New function.
2012-01-20 * elf.c (elfcore_write_prpsinfo): Provide unconditionally.Ulrich Weigand1-10/+14
Return NULL if core file generation is unsupported. (elfcore_write_prstatus): Likewise. * elf32-arm.c (elf32_arm_nabi_write_core_note): New function. (elf_backend_write_core_note): Define.
2011-12-132011-12-13 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>Tristan Gingold1-3/+4
* dwarf2.c (bfd_dwarf2_cleanup_debug_info): Accept stash as an argument like other functions to support formats other than ELF. * elf-bfd.h (bfd_dwarf2_cleanup_debug_info): Move to bfd-in.h. * elf.c (_bfd_elf_close_and_cleanup): Pass dwarf2_find_line_info in tdata as a parameter. * libbfd-in.h (bfd_dwarf2_cleanup_debug_info): Move from elf-bfd.h. * libbfd.h (bfd_dwarf2_cleanup_debug_info): Regenerate. * mach-o-target.c (bfd_mach_o_close_and_cleanup): Remove the fallback macro. (bfd_mach_o_find_nearest_line): Likewise. * mach-o.c (bfd_mach_o_find_nearest_line): Add the definition which calls _bfd_dwarf2_find_nearest_line. (bfd_mach_o_close_and_cleanup): Likewise. * mach-o.h (mach_o_data_struct): Add dwarf2_find_line_info. (bfd_mach_o_find_nearest_line): Add declaration. (bfd_mach_o_close_and_cleanup): Add declaration.
2011-12-06include/elf/ChangeLog:Ulrich Weigand1-0/+56
* common.h (NT_S390_LAST_BREAK): Define. (NT_S390_SYSTEM_CALL): Likewise. bfd/ChangeLog: * elf-bfd.h (elfcore_write_s390_last_break): Add prototype. (elfcore_write_s390_system_call): Likewise. * elf.c (elfcore_write_s390_last_break): New function. (elfcore_write_s390_system_call): Likewise. (elfcore_write_register_note): Call them. (elfcore_grok_s390_last_break): New function. (elfcore_grok_s390_system_call): Likewise. (elfcore_grok_note): Call them.
2011-09-302011-09-30 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-1/+2
* dwarf2.c (struct dwarf2_debug): Add field debug_sections. (read_section): Add sec argument. Adjust the code to get section names from it. (read_indirect_string): Adjust call to read_section. (read_abbrevs): Ditto. (decode_line_info): Ditto. (read_debug_ranges): Ditto. (DWARF2_DEBUG_INFO, DWARF2_COMPRESSED_DEBUG_INFO): Remove. (find_debug_info): Add debug_sections parameter. Use it instead the above macros. (place_sections): Get section names from stash. (find_line): Add debug_sections argument. Initialize debug_sections field of stash from it. Adjust calls to find_debug_info. (_bfd_dwarf2_find_nearest_line): Add debug_sections argument. Adjust call to find_line. (_bfd_dwarf2_find_line): Adjust call to find_line. * libcoff-in.h (struct dwarf_debug_section): New declaration. (coff_find_nearest_line_with_names): Likewise. * libcoff.h: Regenerate. * libbfd-in.h (struct dwarf_debug_section): Move declaration. (dwarf_debug_sections): Likewise. (_bfd_dwarf2_find_nearest_line): Add debug_sections argument. * libbfd.h: Regenerate. * elf.c (_bfd_elf_find_nearest_line): Adjust call to _bfd_dwarf2_find_nearest_line. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Ditto. * elf64-alpha.c (elf64_alpha_find_nearest_line): Ditto. * elf32-arm.c (elf32_arm_find_nearest_line): Ditto. * coffgen.c (coff_find_nearest_line_with_names): New function. (coff_find_nearest_line): Calls coff_find_nearest_line_with_names. * coff-rs6000.c (xcoff_debug_sections): New constant. (xcoff_find_nearest_line): New function. (rs6000coff_vec): Use xcoff_find_nearest_line. (pmac_xcoff_vec): Ditto.
2011-07-03ELFOSABI_GNUThomas Schwinge1-2/+2
bfd/ * elf.c (_bfd_elf_set_osabi): Use ELFOSABI_GNU name instead of ELFOSABI_LINUX alias. * elf32-hppa.c: Likewise. * elf32-i370.c: Likewise. * elf64-hppa.c: Likewise. binutils/ * elfedit.c (osabis): Use ELFOSABI_GNU name instead of ELFOSABI_LINUX alias and ELFOSABI_HURD. Add GNU alias. * readelf.c (get_osabi_name, get_symbol_binding, get_symbol_type): Likewise. * doc/binutils.texi <elfedit>: Update accordingly. elfcpp/ * elfcpp.h (ELFOSABI): Add ELFOSABI_GNU with value of ELFOSABI_LINUX, keep ELFOSABI_LINUX as an alias. Remove ELFOSABI_HURD. gas/ * config/obj-elf.c (obj_elf_type): Use ELFOSABI_GNU name instead of ELFOSABI_LINUX alias. * config/tc-ia64.c: Likewise. include/elf/ * common.h (ELFOSABI_GNU): Define, replaces... (ELFOSABI_LINUX): ... this, kept as an alias. (ELFOSABI_HURD): Remove. ld/testsuite/ * ld-ifunc/ifunc.exp: Update for changed output. * ld-unique/unique.exp: Likewise.
2011-06-24 PR ld/12921Alan Modra1-17/+19
* elf.c (assign_file_positions_for_load_sections): Don't align sh_offset for all SHT_NOBITS sections here, just .tbss sections that don't get a PT_LOAD.
2011-06-16 * elf.c (elf_find_function): Fail if not provided with a symbolNick Clifton1-0/+3
table.
2011-06-15include/elf/Ulrich Weigand1-0/+27
* common.h (NT_ARM_VFP): Define. bfd/ * elf-bfd.h (elfcore_write_arm_vfp): Add prototype. * elf.c (elfcore_grok_arm_vfp): New function. (elfcore_grok_note): Call it to handle NT_ARM_VFP notes. (elfcore_write_arm_vfp): New function. (elfcore_write_register_note): Call it to handle .reg-arm-vfp. binutils/ * readelf.c (get_note_type): Handle NT_ARM_VFP.
2011-06-09 PR ld/12845Nick Clifton1-0/+2
* 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.
2011-05-23 PR 12763Alan Modra1-4/+17
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.
2011-05-20 PR 12763Alan Modra1-12/+23
* 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.
2011-05-12bfd/Jan Kratochvil1-0/+4
* config.in: Regenerated. * configure: Regenerated. * configure.in: New tests for HAVE_PRPSINFO_T_PR_PID, HAVE_PRPSINFO32_T_PR_PID, HAVE_PSINFO_T_PR_PID and HAVE_PSINFO32_T_PR_PID. * elf.c (elfcore_grok_psinfo): Protect reading psinfo.pr_pid by HAVE_PRPSINFO_T_PR_PID, HAVE_PRPSINFO32_T_PR_PID, HAVE_PSINFO_T_PR_PID and HAVE_PSINFO32_T_PR_PID. * hosts/x86-64linux.h (HAVE_PRPSINFO32_T_PR_PID): New redefinition.
2011-05-10bfd/Jan Kratochvil1-0/+2
* elf.c (elfcore_grok_psinfo): Initialize CORE_PID for both native and 32bit psinfo. * elf32-ppc.c (ppc_elf_grok_psinfo): Initialize core_pid. * elf64-ppc.c (ppc64_elf_grok_psinfo): Likewise.
2011-05-07Reverse copy .ctors/.dtors sections if needed.H.J. Lu1-0/+6
bfd/ 2011-05-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/12730 * elf.c (_bfd_elf_section_offset): Check SEC_ELF_REVERSE_COPY. * elflink.c (elf_link_input_bfd): Reverse copy .ctors/.dtors sections if needed. * section.c (SEC_ELF_REVERSE_COPY): New. * bfd-in2.h: Regenerated. ld/testsuite/ 2011-05-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/12730 * ld-elf/elf.exp (array_tests): Add "pr12730". (array_tests_pie): New. (array_tests_static): Add -static for "static init array mixed". Add "static pr12730". Run array_tests_pie for Linux. * ld-elf/init-mixed.c (ctor1007): Renamed to ... (ctor1007a): This. (ctor1007b): New. (ctors1007): Remove ctor1007. Add ctor1007b and ctor1007a. (dtor1007): Renamed to ... (dtor1007a): This. (dtor1007b): New. (dtors1007): Remove dtor1007. Add dtor1007b and dtor1007a. (ctor65535): Renamed to ... (ctor65535a): This. (ctor65535b): New. (ctors65535): Remove ctor65535. Add ctor65535b and ctor65535a. (dtor65535): Renamed to ... (dtor65535a): This. (dtor65535b): New. (dtors65535): Remove dtor65535. Add dtor65535b and dtor65535a. * ld-elf/pr12730.cc: New. * ld-elf/pr12730.out: Likewise.
2011-04-28bfd: constify a few arraysMike Frysinger1-1/+1
2011-04-15 * elf-bfd.h (struct sdt_note): New struct.Nick Clifton1-0/+35
(struct elf_obj_tdata) <sdt_note_head>: New field. * elf.c (elfobj_grok_stapsdt_note_1): New function. (elfobj_grok_stapsdt_note): Likewise. (elf_parse_notes): Added code to treat SystemTap note sections. * common.h (NT_STAPSDT): New define.
2011-04-11 PR 10549Nick Clifton1-2/+2
* elf-bfd.h (has_ifunc_symbols): Renamed to has_gnu_symbols. (has_gnu_symbols): Renamed from has_ifunc_symbols. * elf.c (_bfd_elf_set_osabi): Use new has_gnu_symbols name. * elf32-arm.c (elf32_arm_add_symbol_hook): Set has_gnu_symbols also if STB_GNU_UNIQUE symbol binding was seen. * elf32-i386.c (elf_i386_add_symbol_hook): Likewise. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise. * ld-unique: New directory. * ld-unique/unique.exp: New file: Run the UNIQUE tests. * ld-unique/unique.s: New test file. * ld-unique/unique_empty.s: Likewise. * ld-unique/unique_shared.s: Likewise.
2011-03-14include/elf/Richard Sandiford1-2/+10
* 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.
2011-02-08 PR binutils/12467Nick Clifton1-2/+12
* 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.
2011-01-14 * bfd.c (bfd_perror): Flush stdout before and stderr after printingAlan Modra1-1/+3
error. (_bfd_default_error_handler): Likewise. * elf.c (print_segment_map): Likewise. * libbfd.c (warn_deprecated): Likewise. * som.c (som_sizeof_headers): No need to do so here. * coff-i860.c: Replace use of printf for error messages with _bfd_error_handler. * coff-ppc.c: Likewise. * coff-sh.c: Likewise. * elf32-bfin.c: Likewise. * elf32-dlx.c: Likewise. * elf32-mep.c: Likewise. * elf32-v850.c: Likewise. * mach-o.c: Likewise. * pef.c: Likewise.
2010-12-15Add SORT_BY_INIT_PRIORITY.H.J. Lu1-3/+10
bfd/ 2010-12-15 H.J. Lu <hongjiu.lu@intel.com> * elf.c (_bfd_elf_new_section_hook): Special handling for .init_array/.fini_array output sections. ld/ 2010-12-15 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (GENSCRIPTS): Add @enable_initfini_array@. * NEWS: Mention SORT_BY_INIT_PRIORITY. * configure.in: Add AC_CANONICAL_BUILD. Add --enable-initfini-array. * genscripts.sh (ENABLE_INITFINI_ARRAY): New. * ld.h (sort_type): Add by_init_priority. * ld.texinfo: Document SORT_BY_INIT_PRIORITY. * ldgram.y (SORT_BY_INIT_PRIORITY): New. (wildcard_spec): Handle SORT_BY_INIT_PRIORITY. * ldlang.c (get_init_priority): New. (compare_section): Use get_init_priority for by_init_priority. * ldlex.l (SORT_BY_INIT_PRIORITY): New. * scripttempl/elf.sc: Support ENABLE_INITFINI_ARRAY. * Makefile.in: Regenerated. * aclocal.m4: Regenerated. * config.in: Likewise. * configure: Likewise. ld/testsuite/ 2010-12-15 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/elf.exp (array_tests): Add init-mixed. (array_tests_static): Likewise. Also delete tmpdir/init-mixed. * ld-elf/init-mixed.c: New. * ld-elf/init-mixed.out: Likewise.
2010-12-12Mark .gnu.lto_* sections with SHF_EXCLUDE.H.J. Lu1-0/+1
bfd/ 2010-12-12 H.J. Lu <hongjiu.lu@intel.com> * elf.c (special_sections_g): Add ".gnu.lto_". gas/testsuite/ 2010-12-12 H.J. Lu <hongjiu.lu@intel.com> * gas/elf/elf.exp: Run section9. * gas/elf/section9.d: New. * gas/elf/section9.s: Likewise.
2010-11-08bfd/Alan Modra1-5/+26
* hash.c (bfd_hash_hash): Extract from.. (bfd_hash_lookup): ..here. (bfd_hash_rename): New function. * section.c (bfd_rename_section): New function. * bfd-in.h (bfd_hash_rename): Declare. * bfd-in2.h: Regenerate. * elf.c (_bfd_elf_make_section_from_shdr): Rename input sections when compressing or decompressing. Don't assert name match. * elf64-hppa.c (get_reloc_section): Don't assert name match. * elfxx-ia64.c (get_reloc_section): Likewise. binutils/ * objcopy.c (copy_main): No need to rename sections when compressing or decompressing. binutils/testsuite/ * binutils-all/objdump.W: Adjust expected result for debug section rename.
2010-10-29Add compressed debug section support to binutils and ld.H.J. Lu1-0/+46
bfd/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> Cary Coutant <ccoutant@google.com> * archive.c (bfd_openr_next_archived_file): Copy BFD_COMPRESS and BFD_DECOMPRESS. * bfd.c (BFD_COMPRESS): New. (BFD_DECOMPRESS): Likewise. (BFD_FLAGS_SAVED): Likewise. (bfd_preserve_save): Replace BFD_IN_MEMORY with BFD_FLAGS_SAVED. * compress.c (bfd_uncompress_section_contents): Removed. (get_uncompressed_size): New. (decompress_contents): Likewise. (bfd_compress_section_contents): Likewise. (bfd_get_full_section_contents): Likewise. (bfd_is_section_compressed): Likewise. (bfd_init_section_decompress_status): Likewise. (bfd_init_section_compress_status): Likewise. * dwarf2.c (dwarf_debug_sections): New. (dwarf_debug_section_enum): Likewise. (read_section): Remove section_name and compressed_section_name. Add dwarf_debug_section_enum. Try compressed debug section. (read_indirect_string): Updated. (read_abbrevs): Likewise. (decode_line_info): Likewise. (read_debug_ranges): Likewise. (find_line): Updated. * ecoff.c (bfd_debug_section): Add compress_status and compressed_size. * elf.c (_bfd_elf_make_section_from_shdr): Call bfd_is_section_compressed to check if a DWARF debug section is compressed. Call bfd_init_section_compress_status or bfd_init_section_decompress_status if needed. * elflink.c (elf_link_input_bfd): Replace bfd_get_section_contents with bfd_get_full_section_contents. * merge.c (_bfd_add_merge_section): Likewise. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * simple.c (bfd_simple_get_relocated_section_contents): Likewise. * elfxx-target.h (TARGET_BIG_SYM): Allow BFD_COMPRESS and BFD_DECOMPRESS. (TARGET_LITTLE_SYM): Likewise. * libbfd-in.h (dwarf_debug_section): New. (dwarf_debug_sections): Likewise. * libbfd.c (_bfd_generic_get_section_contents): Issue an error when getting contents on compressed/decompressed section. * section.c (COMPRESS_SECTION_NONE): New. (COMPRESS_SECTION_DONE): Likewise. (DECOMPRESS_SECTION_SIZED): Likewise. (BFD_FAKE_SECTION): Add compress_status and compressed_size. (bfd_malloc_and_get_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. binutils/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * addr2line.c (process_file): Set BFD_DECOMPRESS. * objcopy.c (do_debug_sections): New. (OPTION_COMPRESS_DEBUG_SECTIONS): New. (OPTION_DECOMPRESS_DEBUG_SECTIONS): Likewise. (copy_options): Add OPTION_COMPRESS_DEBUG_SECTIONS and OPTION_DECOMPRESS_DEBUG_SECTIONS. (copy_usage): Add --compress-debug-sections and --decompress-debug-sections. (copy_file): Set BFD_COMPRESS or BFD_DECOMPRESS. (copy_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. (copy_main): Handle OPTION_COMPRESS_DEBUG_SECTIONS and OPTION_DECOMPRESS_DEBUG_SECTIONS. Check do_debug_sections to rename DWARF debug sections. * objdump.c (load_specific_debug_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. Remove bfd_uncompress_section_contents. (dump_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. (display_file): Set BFD_DECOMPRESS if needed. * readelf.c (uncompress_section_contents): Set buffer to NULL to indiate decompression failure. (load_specific_debug_section): Always call uncompress_section_contents. * doc/binutils.texi: Document --compress-debug-sections and --decompress-debug-sections. binutils/testsuite/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * binutils-all/compress.exp: New. * binutils-all/dw2-1.S: Likewise. * binutils-all/dw2-2.S: Likewise. * binutils-all/libdw2-compressed.out: Likewise. * binutils-all/libdw2.out: Likewise. gas/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * write.c (compress_debug): Optimize section flags check. gas/testsuite/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * elf/dwarf2-1.s: Replace .zdebug_abbrev section with .debug_abbrev section. * elf/dwarf2-2.3: Likewise. * elf/dwarf2-1.d: Pass --compress-debug-sections to assembler. Updated. * elf/dwarf2-2.d: Likewise. * gas/i386/i386.exp: Remove xfail on dw2-compress-2 and x86-64-dw2-compress-2. ld/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * ldfile.c (ldfile_try_open_bfd): Set BFD_DECOMPRESS after bfd_openr returns. * emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Likewise. * scripttempl/elf.sc: Include compressed DWARF debug sections. ld/testsuite/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/compress.exp: New. * ld-elf/compress1.s: Likewise. * ld-elf/compress1a.d: Likewise. * ld-elf/compress1b.d: Likewise. * ld-elf/compress1c.d: Likewise.
2010-10-08Fix build with -DDEBUG=7Alan Modra1-3/+2
2010-10-04bfd/Bernd Schmidt1-58/+118
* 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.
2010-09-23ld/Alan Modra1-1/+1
* 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.
2010-09-16bfd/Alan Modra1-2/+1
* 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.
2010-09-09Don't warn zero LMA adjustment.H.J. Lu1-2/+3
bfd/ 2010-09-09 H.J. Lu <hongjiu.lu@intel.com> PR ld/11998 * elf.c (assign_file_positions_for_load_sections): Don't warn zero LMA adjustment. ld/testsuite/ 2010-09-09 H.J. Lu <hongjiu.lu@intel.com> PR ld/11998 * ld-scripts/rgn-at5.d: New. * ld-scripts/rgn-at5.s: Likewise. * ld-scripts/rgn-at5.t: Likewise.
2010-08-30 PR binutils/11953Alan Modra1-16/+33
* 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.