summaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
Commit message (Collapse)AuthorAgeFilesLines
* More PowerPC64 ELFv2 --just-symbols fixesAlan Modra2013-12-031-15/+15
| | | | | | | | | | I don't know what I was thinking here to omit the save of r2. Possibly I was looking at -msave-toc-indirect code at the time, where r2 is saved in the function prologue. * elf64-ppc.c (ppc_build_one_stub <ppc_stub_plt_branch_r2off>): Don't omit saving of r2 for ELFv2. Don't addi 2,2,0. (ppc_size_one_stub <ppc_stub_plt_branch_r2off>): Adjust to suit.
* PowerPC64 linking of --just-symbols objects (klibc)Alan Modra2013-12-031-4/+2
| | | | | | | | | | With -mcmodel=medium we can't assume that a -R object doesn't use toc-relative addressing if there's no toc. Lots of things are accessed via r2, not just the toc/got section. Also, testing for .opd is plain wrong for ELFv2. * elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check. Handle ELFv2.
* PowerPC64 ELFv2, allocate dynreloc space for ifuncAlan Modra2013-11-111-2/+1
| | | | * elf64-ppc.c (allocate_dynrelocs): Revert 2013-11-04 change.
* Correct elf64-ppc.c handling of protected symbolsAlan Modra2013-11-111-14/+10
| | | | | | | | | | | | | | | | | | Some places in elf64-ppc.c carelessly used SYMBOL_CALLS_LOCAL when the proper test is SYMBOL_REFERENCES_LOCAL for cases where we take the address of a protected symbol. This works OK for function descriptors but not for ELFv2. Setting symbols to their global entry stub a little earlier is to ensure _bfd_elf_hash_symbol allows such symbols in .gnu.hash. * elf64-ppc.c (ppc64_elf_edit_toc): Use SYMBOL_REFERENCES_LOCAL here, not SYMBOL_CALLS_LOCAL. (ppc64_elf_relocate_section): Likewise. (size_global_entry_stubs): Set undefined symbols on their global entry stubs here.. (build_global_entry_stubs): ..rather than here. (ppc64_elf_build_stubs): Don't reset glink->size before calling build_global_entry_stubs.
* Pass ignored unresolved relocations to ld backendH.J. Lu2013-11-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ PR ld/4409 * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add an argument for error ignored. * elf-m10200.c (mn10200_elf_relocate_section): Updated. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. (bfin_relocate_section): Likewise. * elf32-cr16.c (elf32_cr16_relocate_section): Likewise. * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-crx.c (elf32_crx_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-epiphany.c (epiphany_elf_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. * elf32-lm32.c (lm32_elf_relocate_section): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-metag.c (elf_metag_relocate_section): Likewise. * elf32-microblaze.c (microblaze_elf_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_relocate_section): Likewise. * elf32-moxie.c (moxie_elf_relocate_section): Likewise. * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. * elf32-mt.c (mt_elf_relocate_section): Likewise. * elf32-nios2.c (nios2_elf32_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-rl78.c (rl78_elf_relocate_section): Likewise. * elf32-rx.c (rx_elf_relocate_section): Likewise. * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise. * elf64-mmix.c (mmix_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise. * elfnn-ia64.c (elfNN_ia64_relocate_section): Skip if error from RELOC_FOR_GLOBAL_SYMBOL in executable is ignored. ld/testsuite/ PR ld/4409 * ld-ia64/error1.d: New file. * ld-ia64/error1.s: Likewise. * ld-ia64/error2.d: Likewise. * ld-ia64/error3.d: Likewise.
* Hide ppc64 .TOC. from --export-dynamicAlan Modra2013-11-051-3/+12
| | | | | | | | | | I can't see any good reason why anyone would want a dynamic .TOC., so hide it in a way that is respected by _bfd_elf_export_symbol. This also fixes an abort in relocate_section on not finding sreloc for .TOC. * elf64-ppc.c (ppc64_elf_func_desc_adjust): Make .TOC. defined and hidden. (ppc64_elf_set_toc): Adjust.
* Update elf64-ppc.c to use elf_link_hash_table shortcuts.Alan Modra2013-11-051-81/+67
| | | | | | | | | These shortcuts to dynamic sections in ppc_link_hash_table predated their geneneric elf hash table equivalents. * elf64-ppc.c (struct ppc_link_hash_table): Remove got, plt, relplt, iplt, reliplt. Update all references to use elf.sgot, elf.splt, elf.srelplt, elf.iplt and elf.irelplt.
* Edit ELFv2 global entry prologue to non-PICAlan Modra2013-11-041-0/+33
| | | | | | | | | | | 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.
* PowerPC64 ELFv2 symbols defined in pltAlan Modra2013-11-041-48/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Simplify ppc64 code setting toc_off.Alan Modra2013-11-021-35/+18
| | | | | | | | | | | | | | | 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.
* Replace DT_PPC_TLSOPT with DT_PPC_OPT.Alan Modra2013-10-301-5/+15
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Support ELFv2 stack frame.Alan Modra2013-10-301-17/+25
| | | | | | | | | 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.
* ELFv2 stub, plt and glink changesAlan Modra2013-10-301-119/+207
| | | | | | | | | | | | | | | | | | | 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.
* Add ELFv2 .localentry support.Alan Modra2013-10-301-9/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add .abiversion related support for ELFv2Alan Modra2013-10-301-15/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Change plt stubs to have destination in r12.Alan Modra2013-10-301-63/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Report overflow on PowerPC64 @h and @ha relocations.Alan Modra2013-10-301-32/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * elf-bfd.h (struct elf_backend_data): Remove as_needed_cleanup.Alan Modra2013-08-271-8/+12
| | | | | | | | | | | | | Add notice_as_needed. * elf64-ppc.c (elf_backend_as_needed_cleanup): Don't define. (elf_backend_notice_as_needed): Define. (ppc64_elf_as_needed_cleanup): Rename and adjust.. (ppc64_elf_notice_as_needed): ..to this. * elflink.c (_bfd_elf_notice_as_needed): New function, extracted.. (elf_link_add_object_symbols): ..from here. * elfxx-target.h (elf_backend_as_needed_cleanup): Don't define. (elf_backend_notice_as_needed): Define.. (elfNN_bed): ..and use here.
* * elf64-ppc.c (struct ppc64_elf_obj_tdata): Replace opd_relocsAlan Modra2013-07-251-9/+18
| | | | | | with a union. (opd_entry_value): Cache .opd section contents. (ppc64_elf_relocate_section): Adjust.
* * elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't hide .TOC.Alan Modra2013-07-031-6/+4
| | | | | when relocatable. Don't change root.type or type here. (ppc64_elf_set_toc): Set type of .TOC. to STT_OBJECT.
* bfd/Alan Modra2013-07-031-43/+68
| | | | | | | | | | | | * elf64-ppc.c (struct ppc_stub_hash_entry): Delete "addend". (ppc64_elf_size_stubs): Don't set "addend". (ppc64_elf_relocate_section): Don't allow calls via toc-adjusting stubs without a following nop even in an executable, except for self-calls and both libc_start_main and .libc_start_main. gold/ * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call comment.
* * elf64-ppc.c (ppc64_elf_func_desc_adjust): Hide ".TOC.".Alan Modra2013-07-031-0/+7
|
* bfd/Alan Modra2013-07-021-7/+8
| | | | | | | * elf64-ppc.c (ppc64_elf_relocate_section): Set "relocation" for .TOC. after relocatable check. gas/ * config/tc-ppc.c (ppc_elf_adjust_symtab): Don't make .TOC. weak.
* bfd/Alan Modra2013-07-011-14/+29
| | | | | | | | | | | | | | | | | | | | | | * elf64-ppc.h (ppc64_elf_toc): Delete. (ppc64_elf_set_toc): Declare. * elf64-ppc.c (ppc64_elf_toc_reloc): Replace call to ppc64_elf_toc with call the ppc64_elf_set_toc. (ppc64_elf_toc_ha_reloc, ppc64_elf_toc64_reloc): Likewise. (ppc64_elf_start_multitoc_partition): Likewise. (struct ppc_link_hash_table): Delete dot_toc_dot. Replace all uses with elf.hgot. (ppc64_elf_process_dot_syms): Don't make a fake function descriptor for ".TOC.". (ppc64_elf_check_relocs): Mark sections with a reference to .TOC. as needing a toc pointer. (ppc64_elf_size_stubs): Don't set dot_toc_dot here. (ppc64_elf_set_toc): Rename from ppc64_elf_toc. Add info param. Set elf.hgot value. ld/ * emultempl/ppc64elf.em: (ppc_layout_sections_again): Call ppc64_elf_set_toc rather than ppc64_elf_toc/_bfd_set_gp_value. (gld${EMULATION_NAME}_after_allocation): Likewise.
* * elf64-ppc.c (opd_entry_value): Handle case where symbolAlan Modra2013-05-061-5/+24
| | | | hashes are not available.
* bfd/Alan Modra2013-04-221-88/+84
| | | | | | | | | | | | | | | | | | | | | * elf64-ppc.c (ppc64_elf_check_relocs): Don't call create_linkage_sections here.. (ppc64_elf_init_stub_bfd): ..do so here. Return status. (create_linkage_sections): Move earlier in file. (ppc64_elf_setup_section_lists): Remove now useless htab->brlt test. * elf64-ppc.h (ppc64_elf_init_stub_bfd): Update proto. ld/ * emultempl/ppc64elf.em (ppc_create_output_section_statements): Check return from ppc64_elf_init_stub_bfd. ld/testsuite/ * ld-powerpc/tlsexe.d: Adjust. * ld-powerpc/tlsexe.r: Adjust. * ld-powerpc/tlsexetoc.d: Adjust. * ld-powerpc/tlsexetoc.r: Adjust. * ld-powerpc/tlsso.d: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlstocso.d: Adjust. * ld-powerpc/tlstocso.r: Adjust.
* * elf32-ppc.c (ppc_elf_check_relocs): Use SYMBOLIC_BIND.Alan Modra2013-04-061-2/+2
| | | | * elf64-ppc.c (ppc64_elf_check_relocs, dec_dynrel_count): Likewise.
* PR ld/15323Alan Modra2013-03-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ * elf-m10300.c (mn10300_elf_check_relocs): Set non_ir_ref for global symbols referenced by relocs. * elf32-arm.c (elf32_arm_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Likewise. * elf32-cr16.c (cr16_elf_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-d10v.c (elf32_d10v_check_relocs): Likewise. * elf32-dlx.c (elf32_dlx_check_relocs): Likewise. * elf32-fr30.c (fr30_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise. * elf32-lm32.c (lm32_elf_check_relocs): Likewise. * elf32-m32c.c (m32c_elf_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-mcore.c (mcore_elf_check_relocs): Likewise. * elf32-metag.c (elf_metag_check_relocs): Likewise. * elf32-microblaze.c (microblaze_elf_check_relocs): Likewise. * elf32-moxie.c (moxie_elf_check_relocs): Likewise. * elf32-msp430.c (elf32_msp430_check_relocs): Likewise. * elf32-mt.c (mt_elf_check_relocs): Likewise. * elf32-nios2.c (nios2_elf32_check_relocs): Likewise. * elf32-openrisc.c (openrisc_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-rl78.c (rl78_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise. * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise. * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. * elf64-aarch64.c (elf64_aarch64_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Likewise. * elf64-ia64-vms.c (elf64_ia64_check_relocs): Likewise. * elf64-mmix.c (mmix_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. * elfnn-ia64.c (elfNN_ia64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. Don't test indirect/warning links for NULL. ld/testsuite/ * ld-plugin/lto.exp (pr15323a.c): Compile without -flto rather than using -r to effectively strip out lto info.
* * elf64-ppc.c (struct ppc_dyn_relocs): New.Alan Modra2013-03-281-101/+163
| | | | | | | | | | | | (ppc64_elf_check_relocs): Separate dynrel counts for local syms into ifunc and non-ifunc. (dec_dynrel_count): Pass in sym rather than sym_sec. Handle separate ifunc/non-ifunc dynrel counts. (allocate_got): Always use reliplt for ifunc. (allocate_dynrelocs): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (ppc64_elf_layout_multitoc): Likewise. (ppc64_elf_relocate_section): Likewise.
* * elf-bfd.h (enum elf_reloc_type_class): Add reloc_class_ifunc.Alan Modra2013-03-271-3/+9
| | | | | | | | | | | | | | | | | | | | | | | (struct elf_backend_data <elf_backed_reloc_type_class>): Add bfd_link_info* and asection* params. (_bfd_elf_reloc_type_class): Likewise. * elf.c (_bfd_elf_reloc_type_class): Likewise. * elflink.c (elf_link_sort_cmp2): Sort first on reloc class. (elf_link_sort_relocs): Update elf_backed_reloc_type_class call. * elf32-ppc.c (ppc_elf_reloc_type_class): Return reloc_class_ifunc for any reliplt reloc. Don't return reloc_class_plt for R_PPC_REL24 and R_PPC_ADDR24. * elf64-ppc.c (allocate_got): Formatting. (ppc64_elf_reloc_type_class): Return reloc_class_ifunc for any reliplt reloc. * elf-m10300.c, * elf32-arm.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cris.c, * elf32-hppa.c, * elf32-i386.c, * elf32-lm32.c, * elf32-m32r.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-s390.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilepro.c, * elf32-vax.c, * elf32-xtensa.c, * elf64-aarch64.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elfnn-ia64.c, * elfxx-tilegx.c, * elfxx-tilegx.h: Add extra params to the various reloc_type_class functions.
* * elf-bfd.h (struct core_elf_obj_tdata): New.Alan Modra2013-02-211-5/+5
| | | | | | | | | | | | | | | (struct elf_obj_tdata): Delete core_signal, core_pid, core_lwpid, core_program, and core_command. Add "core". * elf.c (bfd_elf_mkcorefile): Allocate "core" struct. Update all refs to tdata core fields. * elf32-am33lin.c, * elf32-arm.c, * elf32-cris.c, * elf32-frv.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68k.c, * elf32-mips.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-xtensa.c, * elf64-aarch64.c, * elf64-hppa.c, * elf64-mips.c, * elf64-ppc.c, * elf64-tilegx.c, * elf64-x86-64.c, * elfcore.h, * elfn32-mips.c: Update all refs to tdata core fields.
* * elfcode.h (elf_checksum_contents): Free contents.Alan Modra2013-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
* * elf64-ppc.c (dec_dynrel_count): Don't error when elf_gc_sweep_symbolAlan Modra2013-02-011-6/+7
| | | | clears def_regular.
* bfd/Alan Modra2013-01-311-11/+11
| | | | | | | | | | | | | * elf64-ppc.c (ppc_stub_name): Trim off trailing "+0". ld/testsuite/ * ld-powerpc/tlsexe.d: Update for changed stub names. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.d: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso.d: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.r: Likewise.
* * elf64-ppc.c (build_plt_stub): Correct plt stub branch to glink.Alan Modra2013-01-301-1/+1
|
* * elf64-ppc.c: Use %T to print symbols names and remove redundantAlan Modra2013-01-281-43/+46
| | | | | | | | "relocation" in error messages throughout file. (ppc64_elf_relocate_section): Remove sibling call error message, replace with "call lacks nop". Specially report errors for branches to function entry points via OPD lookup and branches to stubs. Remove NULL symbol handling now done by %T.
* bfd/Alan Modra2013-01-151-1/+3
| | | | | | | | | | | | | | * elf64-ppc.c (ppc64_elf_size_stubs): Default shared libs to plt-thread-safe. gold/ * powerpc.cc (Target_powerpc::do_relax): Default shared libs to plt-thread-safe. ld/testsuite/ * ld-powerpc/tlsso.d: Adjust for plt-thread-safe stubs. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.g: Likewise.
* Remove trailing white spaces in bfdH.J. Lu2013-01-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * aout0.c: Remove trailing white spaces. * archive.c: Likewise. * archures.c: Likewise. * bfd-in.h: Likewise. * bfd-in2.h: Likewise. * coff-alpha.c: Likewise. * coff-i860.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-tic80.c: Likewise. * coff-x86_64.c: Likewise. * coff-z80.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * compress.c: Likewise. * corefile.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-crx.c: Likewise. * cpu-h8300.c: Likewise. * cpu-i386.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m68k.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-sh.c: Likewise. * cpu-xc16x.c: Likewise. * dwarf2.c: Likewise. * ecofflink.c: Likewise. * ecoffswap.h: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-vxworks.c: Likewise. * elf32-avr.c: Likewise. * elf32-avr.h: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.h: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-v850.c: Likewise. * elf32-xc16x.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * ieee.c: Likewise. * libcoff.h: Likewise. * libpei.h: Likewise. * libxcoff.h: Likewise. * linker.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mach-o.h: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c: Likewise. * pef-traceback.h: Likewise. * pei-x86_64.c: Likewise. * peicode.h: Likewise. * plugin.c: Likewise. * reloc.c: Likewise. * riscix.c: Likewise. * section.c: Likewise. * som.c: Likewise. * syms.c: Likewise. * tekhex.c: Likewise. * ticoff.h: Likewise. * vaxbsd.c: Likewise. * xcofflink.c: Likewise. * xtensa-isa.c: Likewise.
* * elf64-ppc.c (build_plt_stub): Fix off by one error in branchAlan Modra2012-12-051-2/+2
| | | | to glink.
* bfd/Alan Modra2012-11-061-0/+13
| | | | | | | | | | | | * elf64-ppc.c (struct ppc_link_hash_table): Add dot_toc_dot. (ppc64_elf_size_stubs): Lookup ".TOC.". (ppc64_elf_relocate_section): Resolve special symbol ".TOC.". gas/ * config/tc-ppc.c (ppc_elf_adjust_symtab): New function, split out.. (ppc_frob_file_before_adjust): ..from here. (md_apply_fix): Set BSF_KEEP on .TOC. if not @tocbase. * config/tc-ppc.h (ppc_elf_adjust_symtab): Declare. (tc_adjust_symtab): Define.
* * elf64-ppc.c (maybe_strip_output): Heed SEC_KEEP.Alan Modra2012-11-061-0/+1
|
* * elf64-ppc.c (ppc64_elf_edit_toc): Clear "repeat" insideAlan Modra2012-11-051-126/+132
| | | | | loop. Really mark toc entry referring to another toc entry only if the first is used.
* 2012-09-12 Doug Kwan <dougkwan@google.com>Doug Kwan2012-09-121-6/+8
| | | | | * elf64-ppc.c (ppc64_elf_relocate_section): Use pre-adjusted relocation for stub lookup.
* PR ld/14464Alan Modra2012-08-311-0/+27
| | | | | * elf64-ppc.c (ppc64_elf_relocate_section): Map symbols defined by a linker script in .opd to corresponding input .opd section.
* * elf32-ppc.c (ppc_elf_relocate_section): Assert that dynindx isMaciej W. Rozycki2012-08-281-1/+5
| | | | | not minus one. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* * section.c (bfd_get_linker_section): New function.Alan Modra2012-06-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * elf32-arm.c: When retrieving SEC_LINKER_CREATED sections, use the above throughout rather than bfd_get_section_by_name. Use bfd_make_section_anyway rather than bfd_make_section when creating them. * elf32-bfin.c: Likewise. * elf32-cr16.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i370.c: Likewise. * elf32-i386.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68k.c: Likewise. * elf32-microblaze.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-sh.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-vax.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-sparc.c: Likewise. * elf64-x86-64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * elflink.c: Likewise. * elf-vxworks.c: Likewise. * elf-m10300.c: Likewise. Also make use of htab plt, got and gotplt shortcuts. * bfd-in2.h: Regenerate. * elf32-lm32.c (lm32_elf_check_relocs): Use the correct bfd when calling create_rofixup_section. * elflink.c (bfd_elf_final_link): Simplify test for .dynstr.
* * elf64-ppc.c (ppc64_elf_next_toc_section): Don't error if inputAlan Modra2012-06-261-2/+5
| | | | | file has multiple .got/.toc sections and all don't fit in current toc group.
* * elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't emit out-of-lineAlan Modra2012-06-221-4/+5
| | | | save/restore functions when relocatable. Make "funcs" static.
* PR binutils/13897Alan Modra2012-06-031-52/+88
| | | | | | | | | | | | * 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.
* PR binutils/13897Alan Modra2012-06-011-36/+33
| | | | * elf64-ppc.c (opd_entry_value): Rewrite cache code.