aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2013-11-03Remove incorrect ATTRIBUTE_UNUSED from nios2 bfdSandra Loosemore2-13/+29
2013-11-03 Sandra Loosemore <sandra@codesourcery.com> bfd/ * elf32-niso2.c (nios2_elf32_do_hi16_relocate): Remove incorrect ATTRIBUTE_UNUSED from parameter. (nios2_elf_do_lo16_relocate): Likewise. (nios2_elf32_do_hiadj16_relocate): Likewise. (nios2_elf32_do_pcrel_lo16_relocate): Likewise. (nios2_elf32_do_pcrel_hiadj16_relocate): Likewise. (nios2_elf32_do_pcrel16_relocate): Likewise. (nios2_elf32_do_call26_relocate): Likewise. (nios2_elf32_do_gprel_relocate): Likewise. (nios2_elf32_do_ujmp_relocate): Likewise. (nios2_elf32_do_cjmp_relocate): Likewise. (nios2_elf32_do_callr_relocate): Likewise. (nios2_elf32_gc_mark_hook): Likewise.
2013-11-04Edit ELFv2 global entry prologue to non-PICAlan Modra2-0/+38
Changing addis r2,r12,..; addi r2,r2,.. to lis r2,..; addi r2,r2.. in non-PIC executables has the benefit of removing a dependency on r12. bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Edit global entry prologue to non-PIC in non-PIC executables. ld/testsuite/ * ld-powerpc/elfv2exe.d: Adjust for non-PIC global entry.
2013-11-04PowerPC64 ELFv2 symbols defined in pltAlan Modra2-48/+276
In a non-pic executable, ELFv2 like other targets, needs to emit a plt entry even for non-call references to functions defined in shared libraries, and define the function on the plt code. * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Copy pointer_equality_needed flag. (ppc64_elf_check_relocs): For ELFv2 arrange to emit plt entries for references to functions in shared libraries on non-call relocs. (readonly_dynrelocs): Split into function of the same name and.. (maybe_set_textrel): ..this new function. Update call. (ppc64_elf_adjust_dynamic_symbol): Don't emit dynrelocs for ELFv2 in most cases if we have a plt entry. Use new readonly_relocs. (allocate_dynrelocs): For ELFv2, don't allocate dynreloc space for ifunc in static executables. (size_global_entry_stubs): New function. (ppc64_elf_size_dynamic_sections): Call size_global_entry_stubs. Save end of glink branch table. (ppc64_elf_hash_symbol): New function. (build_global_entry_stubs): New function. (ppc64_elf_build_stubs): Call build_global_entry_stubs. Adjust glink sizing. (ppc64_elf_relocate_section): Tidy plt16/32/64 reloc code. (ppc64_elf_finish_dynamic_symbol): For ELFv2, adjust symbols defined on plt code.
2013-11-04daily updateAlan Modra1-1/+1
2013-11-03daily updateAlan Modra1-1/+1
2013-11-02Remove unnecessary _bfd_new_bfd initialisationAlan Modra2-15/+4
nbfd is allocated by bfd_zmalloc. * opncls.c (_bfd_new_bfd): Don't init vars already zeroed.
2013-11-02Simplify ppc64 code setting toc_off.Alan Modra2-35/+23
Every function has a nominal toc pointer value, even if it isn't used, so set toc_off for every code section to the value used in that object file. The thinking here was that if a code section didn't use the toc it could use the previous object file's toc pointer value. It can, but doing so is only a gain if functions in that section are called mostly from previous objects sharing the same toc. We lose if the functions in question are called mostly from the current object or following objects, and it's a good bet they will probably mostly be called from the current object. * elf64-ppc.c (ppc64_elf_next_input_section): Always set toc_off to value for object file.
2013-11-02daily updateAlan Modra1-1/+1
2013-11-01*-*-nacl* layout: Drop requirement that some section have SEC_HAS_CONTENTS set.Roland McGrath2-5/+9
bfd/ * elf-nacl.c (segment_eligible_for_headers): Drop requirement that some section have SEC_HAS_CONTENTS set. It's not set for .note.gnu.build-id, and a segment of only read-only SHT_NOBITS sections is implausible and not really supportable anyway.
2013-11-01daily updateAlan Modra1-1/+1
2013-10-31daily updateAlan Modra1-1/+1
2013-10-30Replace DT_PPC_TLSOPT with DT_PPC_OPT.Alan Modra3-6/+24
This removes the DT_PPC_TLSOPT/DT_PPC64_TLSOPT dynamic tag and replaces it with DT_PPC_OPT/DT_PPC64_OPT tag to provide the same functionality and more. This isn't backwards compatible, but the TLSOPT tag hasn't been used since the tls optimisation support was never submitted to glibc. /include/elf/ * ppc.h (DT_PPC_TLSOPT): Delete. (DT_PPC_OPT, PPC_OPT_TLS): Define. * ppc64.h (DT_PPC64_TLSOPT): Delete. (DT_PPC64_OPT, PPC64_OPT_TLS, PPC64_OPT_MULTI_TOC): Define. bfd/ * elf32-ppc.c (ppc_elf_size_dynamic_sections): Use new DT_PPC_OPT tag to specify tls optimisation. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise. (ppc64_elf_finish_dynamic_sections): Specify whether multiple toc pointers are used via DT_PPC64_OPT. binutils/ * readelf.c (get_ppc_dynamic_type): Replace PPC_TLSOPT with PPC_OPT. (get_ppc64_dynamic_type): Replace PPC64_TLSOPT with PPC64_OPT.
2013-10-30Support ELFv2 stack frame.Alan Modra2-17/+32
The toc pointer save slot changes on ELFv2 from 40(1) to 24(1). * elf64-ppc.c (STK_LR, STK_TOC, STK_LINKER): Define. (savegpr0_tail, restgpr0_tail, savefpr0_tail, restfpr0_tail) build_plt_stub, build_tls_get_addr_stub, ppc_build_one_stub, ppc64_elf_relocate_section): Use new defines.
2013-10-30ELFv2 stub, plt and glink changesAlan Modra2-119/+220
An ELFv2 PLT entry is simply the address of the target function rather than three (or two) words to specify entry, toc and static chain. PLT call stubs are correspondingly simpler and need no thread safety barrier. The glink resolver stub and branch table also is simplified, a change that could be applied to ELFv1 too, but isn't as yet. * elf64-ppc.c (PLT_ENTRY_SIZE, PLT_INITIAL_ENTRY_SIZE): Add htab parameter and adjust for ELFv2. Update all uses. (PLT_CALL_STUB_SIZE): Delete. (ppc64_elf_get_synthetic_symtab): Support new glink layout. (allocate_dynrelocs): Likewise. (plt_stub_size, build_plt_stub): Adjust for ELFv2. (get_r2off): Return 0 for ELFv2 -R. (ppc_build_one_stub, ppc_size_one_stub): Adjust for ELFv2. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_build_stubs): Add new ELFv2 glink.
2013-10-30Add ELFv2 .localentry support.Alan Modra2-9/+80
This defines the ELF symbol st_other field used to encode the number of instructions between a function "global entry" and its "local entry", and adds support related to the local entry offset. include/elf/ * ppc64.h (STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Define. (ppc64_decode_local_entry, ppc64_encode_local_entry): New functions. (PPC64_LOCAL_ENTRY_OFFSET, PPC64_SET_LOCAL_ENTRY_OFFSET): Define. bfd/ * elf64-ppc.c (struct ppc_stub_hash_entry): Add "other". (stub_hash_newfunc): Init new ppc_stub_hash_entry field, and one we forgot, "plt_ent". (ppc64_elf_add_symbol_hook): Check ELFv1 objects don't have st_other bits only valid in ELFv2. (ppc64_elf_merge_symbol_attribute): New function. (ppc_type_of_stub): Add local_off param to test branch range. (ppc_build_one_stub): Adjust destinations for ELFv2 locals. (ppc_size_one_stub, toc_adjusting_stub_needed): Similarly. (ppc64_elf_size_stubs): Pass local_off to ppc_type_of_stub. Set "other" field. (ppc64_elf_relocate_section): Adjust destination for ELFv2 local calls. gas/ * config/tc-ppc.c (md_pseudo_table): Add .localentry. (ppc_elf_localentry): New function. (ppc_force_relocation): Force relocs on all branches to localenty symbols. (ppc_fix_adjustable): Don't reduce such symbols to section+offset. binutils/ * readelf.c (get_ppc64_symbol_other): New function. (get_symbol_other): Use it for EM_PPC64.
2013-10-30Add .abiversion related support for ELFv2Alan Modra2-15/+138
Defines bits in ELF e_flags to differentiate ELFv2 objects from ELFv2, adds .abiversion directive to explicitly choose the ABI, and code to check and automatically select ABI. include/elf/ * ppc64.h (EF_PPC64_ABI): Define. bfd/ * elf64-ppc.c (abiversion, set_abiversion): New functions. (ppc64_elf_get_synthetic_symtab): Handle ELFv2 objects without .opd. (struct ppc_link_hash_table): Add opd_abi. (ppc64_elf_check_relocs): Check no .opd with ELFv2. (ppc64_elf_merge_private_bfd_data): New function. (ppc64_elf_print_private_bfd_data): New function. (ppc64_elf_tls_setup): Set htab->opd_abi. (ppc64_elf_size_dynamic_sections): Don't emit OPD related dynamic tags for ELFv2. (ppc_build_one_stub): Use R_PPC64_IRELATIVE for ELFv2 ifunc. (ppc64_elf_finish_dynamic_symbol): Likewise binutils/ * readelf.c (get_machine_flags): Display ABI version for EM_PPC64. gas/ * config/tc-ppc.c: Include elf/ppc64.h. (ppc_abiversion): New variable. (md_pseudo_table): Add .abiversion. (ppc_elf_abiversion, ppc_elf_end): New functions. * config/tc-ppc.h (md_end): Define.
2013-10-30Change plt stubs to have destination in r12.Alan Modra2-63/+70
This change is to support the new ELFv2 ABI, which uses the value in r12 on function entry to calculate the got/toc pointer. bfd/ * elf64-ppc.c (build_plt_stub): Switch stubs to use r11 as base reg and r12 as destination. (ppc_build_one_stub): Likewise. (ppc64_elf_build_stubs): Likewise for glink. ld/testsuite/ * ld-powerpc/tls.s: Add proper .opd entry for _start. * ld-powerpc/tlstoc.s: Likewise. * ld-powerpc/relbrlt.d: Update for changed stubs. * ld-powerpc/tls.d: Update for changed stubs and _start .opd entry. * ld-powerpc/tls.g: Likewise. * ld-powerpc/tlsexe.d: Likewise. * ld-powerpc/tlsexe.g: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.d: Likewise. * ld-powerpc/tlsexetoc.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso.d: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstoc.d: Likewise. * ld-powerpc/tlstoc.g: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-powerpc/tlstocso.r: Likewise.
2013-10-30Report overflow on PowerPC64 @h and @ha relocations.Alan Modra5-32/+191
This changes the behaviour of @h and @ha on PowerPC64 to report errors on 32-bit overflow. The motivation for this change is that on PowerPC64, most uses of @h and @ha modifiers and their corresponding relocations are to build up 32-bit offsets. We'd like to know when such offsets overflow. Only rarely do people use @h or @ha with the high 32-bit modifiers to build a 64-bit constant. Those uses will now need to use two new modifiers, @high and @higha, if the constant isn't known at assembly time. For now, we won't report overflow at assembly time.. This also fixes an error when applying some of the HIGHER and HIGHEST relocations. include/elf/ * ppc64.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA, R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA, R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): New. (IS_PPC64_TLS_RELOC): Match new tls relocs. bfd/ * reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA, BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA, BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New. * elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs. Make all _HA and _HI relocs report signed overflow. (ppc64_elf_reloc_type_lookup): Handle new relocs. (must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise. (dec_dynrel_count, ppc64_elf_relocate_section): Likewise. (ppc64_elf_relocate_section): Don't apply 0x8000 adjust to R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST, R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. gas/ * config/tc-ppc.c (SEX16): Don't mask. (REPORT_OVERFLOW_HI): Define as zero. (ppc_elf_suffix): Support @high, @higha, @dtprel@high, @dtprel@higha, @tprel@high, and @tprel@higha modifiers. (md_assemble): Ignore X_unsigned when applying 16-bit insn fields. Add (disabled) code to check @h and @ha reloc overflow for powerpc64. Handle new relocs. (md_apply_fix): Similarly. elfcpp/ * powerpc.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA, R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA, R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): Define. gold/ * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs. (Target_powerpc::Scan::global, local): Likewise. (Target_powerpc::Relocate::relocate): Likewise. Check for overflow on all ppc64 @h and @ha relocs.
2013-10-29BFD: elf64-x86-64-nacl: Correct 9-byte nop sequence used in PLT0 entry.Roland McGrath2-1/+6
bfd/ * elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Correct 9-byte nop sequence to match what the assembler generates.
2013-10-30daily updateAlan Modra1-1/+1
2013-10-30daily updateAlan Modra1-1/+1
2013-10-29ld/ELF: refine fake STT_FILE symbol emissionJan Beulich2-16/+25
There's no real need to emit these always: They're needed only if we indeed want to emit a localized symbol. Hence defer emission until we at least did the basic early checks that would lead to no such symbol getting emitted. This in particular avoids emitting such a symbol in the majority of (if not all) "ld -r" cases. I hope my set of cross build tests caught all the test cases needing adjustment - please forgive if I missed a few. bfd/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * elflink.c (struct elf_outext_info): Add field file_sym_done. (bfd_elf_final_link): Initialize new field. Move fake STT_FILE symbol emission from here ... (elf_link_output_extsym): ... to here. gas/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * gas/microblaze/relax_size.elf: Drop expectation of no longer present STT_FILE symbol. * gas/microblaze/relax_size2.elf: Likewise. ld/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer present STT_FILE symbol. * ld-mmix/bpo-18.d: Likewise. * ld-mmix/bpo-22.d: Likewise. * ld-mmix/greg-6.d: Likewise. * ld-mmix/greg-7.d: Likewise. * ld-mmix/loc4.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/loct-1.d: Likewise. * ld-sh/sh64/abi32.xd: Likewise. * ld-sh/sh64/abi64.xd: Likewise. * ld-sh/sh64/cmpct1.xd: Likewise. * ld-sh/sh64/crange1.rd: Likewise. * ld-sh/sh64/crange2.rd: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crange3.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-sh/sh64/mix1.xd: Likewise. * ld-sh/sh64/mix2.xd: Likewise. * ld-sh/sh64/shdl32.xd: Likewise. * ld-sh/sh64/shdl64.xd: Likewise.
2013-10-25 PR binutils/15994Nick Clifton1-1/+1
* dwarf2.c (lookup_address_in_line_info_table): Change return type to be the range of addresses covered by the table. (comp_unit_find_nearest_line): Likewise. (find_line): Search all CUs. Select the one that matches and covers the smallest address range.
2013-10-25 PR binutils/15994Nick Clifton2-28/+76
* dwarf2.c (lookup_address_in_line_info_table): Change return type to be the range of addresses covered by the table. (comp_unit_find_nearest_line): Likewise. (find_line): Search all CUs. Select the one that matches and covers the smallest address range.
2013-10-25binutils doc updateTom Tromey1-2/+2
Here's another small patch to lay the groundwork for the git conversion. This one updates the BFD and binutils documentation for the move. bfd: * doc/bfdint.texi (BFD generated files): Mention git, not cvs. binutils: * MAINTAINERS: Mention git, not cvs. * README: Mention git, not cvs.
2013-10-20daily updateAlan Modra1-1/+1
2013-10-19daily updateAlan Modra1-1/+1
2013-10-18daily updateAlan Modra1-1/+1
2013-10-18 * elf32-cris.c (cris_elf_check_relocs): Don't assumeHans-Peter Nilsson2-5/+15
a registered dynobj means that a .got has been created.
2013-10-17daily updateAlan Modra1-1/+1
2013-10-17 PR 16056Alan Modra2-2/+9
* elf.c (copy_elf_program_header): Only consider SEC_ALLOC sections when finding lowest_section.
2013-10-16daily updateAlan Modra1-1/+1
2013-10-15daily updateAlan Modra1-1/+1
2013-10-142013-10-14 Chao-ying Fu <Chao-ying.Fu@imgtec.com>Chao-ying Fu2-0/+57
* elfxx-mips.c (mips_elf_obj_tdata): Add abi_msa_bfd. (mips_elf_merge_obj_attributes): Set abi_msa_bfd to the first object file that has a Tag_GNU_MIPS_ABI_MSA attribute. Merge Tag_GNU_MIPS_ABI_MSA attributes.
2013-10-14 * gen-aout.c (main): Fix formatting. Close file.Nick Clifton4-44/+62
* emultempl/aix.em (_read_file): Close file at end of function. * gas/all/itbl-test.c (main): Close fas. * read.c (add_include_dir): Use xrealloc. * config/tc-score.c (do_macro_bcmp): Initialise inst_main. * config/tc-tic6x.c (tic6x_parse_operand): Initialise second_reg. * readelf.c (decode_arm_unwind): Initialise addr structure. (process_symbol_table): Free lengths. * srcconv.c (wr_sc): Free info. * chew.c (perform): Free next.
2013-10-13daily updateAlan Modra1-1/+1
2013-10-13bfd/Richard Sandiford2-75/+96
* elfxx-mips.c (mips_use_local_got_p): New function. (mips_elf_count_got_symbols, mips_elf_calculate_relocation): Use it. (_bfd_mips_elf_check_relocs): Set pointer_equality_needed for GOT and absolute references. ld/testsuite/ * ld-mips-elf/pic-and-nonpic-6-n32.ad, ld-mips-elf/pic-and-nonpic-6-n32.dd, ld-mips-elf/pic-and-nonpic-6-n32.gd, ld-mips-elf/pic-and-nonpic-6-n32.nd, ld-mips-elf/pic-and-nonpic-6-n32.rd, ld-mips-elf/pic-and-nonpic-6-n64.ad, ld-mips-elf/pic-and-nonpic-6-n64.dd, ld-mips-elf/pic-and-nonpic-6-n64.gd, ld-mips-elf/pic-and-nonpic-6-n64.nd, ld-mips-elf/pic-and-nonpic-6-n64.rd, ld-mips-elf/pic-and-nonpic-6-o32.ad, ld-mips-elf/pic-and-nonpic-6-o32.dd, ld-mips-elf/pic-and-nonpic-6-o32.gd, ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/pic-and-nonpic-6-o32.rd: Fix symbol value of extf4. No longer expect extf3, extf4 and extd2 to be in the global GOT.
2013-10-12daily updateAlan Modra1-1/+1
2013-10-11daily updateAlan Modra1-1/+1
2013-10-10daily updateAlan Modra1-1/+1
2013-10-09daily updateAlan Modra1-1/+1
2013-10-09bfd/Roland McGrath2-2/+7
* elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Cast switch expression to int to silence over-eager compiler warnings.
2013-10-09bfd/Roland McGrath2-2/+5
* xcofflink.c (_bfd_xcoff_bfd_final_link): Don't touch EREL in loop that doesn't use (or initialize) it.
2013-10-09bfd/Roland McGrath2-3/+8
* elfxx-tilegx.c (tilegx32_plt_tail_entry, tilegx32_plt_tail_entry): Move second const qualifier so it applies to the pointer.
2013-10-09 PR binutils/16022Nick Clifton2-15/+19
* elf32-rx.c (rx_dump_symtab): Add missing break statements.
2013-10-09 * opncls.c (get_alt_debug_link_info_shim): Update type of 'len'.Tom Tromey2-1/+5
2013-10-09 PR ld/16021Nick Clifton2-84/+6
* elf32-rl78.c (rl78_dump_symtab): Delete. (rl78_get_reloc): Delete.
2013-10-09bfdTom Tromey3-3/+11
* bfd-in2.h: Rebuild. * opncls.c (bfd_get_alt_debug_link_info): Change type of buildid_len to bfd_size_type. gdb * dwarf2read.c (dwarf2_get_dwz_file): Update for type change in bfd_get_alt_debug_link_info.
2013-10-09bfd/ChangeLogSergio Durigan Junior2-17/+69
2013-10-09 Sergio Durigan Junior <sergiodj@redhat.com> PR binutils/15993 * elf32-m32c.c (dump_symtab): Add missing "break;" statement on each "case". Reindent "switch" statements.
2013-10-08daily updateAlan Modra1-1/+1