aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2019-07-24[ARC] Add linker relaxation.Claudiu Zissulescu2-0/+183
Add linker relaxation. The first relaxation added is converting GOTPC32 to PCREL relocations. This relaxation doesn't change the size of the binary. bfd/ xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com> * elf32-arc.c (bfd_get_32_me): New function. (bfd_put_32_me): Likewise. (arc_elf_relax_section): Likewise. (bfd_elf32_bfd_relax_section): Define. ld/testsuite/ xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com> * ld-arc/relax-local-pic.d: New test. * ld-arc/relax-local-pic.s: New file.
2019-07-24Complain about mbind, ifunc, and unique in final_writeAlan Modra33-125/+187
It's not as good as complaining in gas/config/obj-elf.c since you lose any reference to the source file. bfd/ * elf-bfd.h (struct elf_backend_data): Return bfd_boolean from elf_backend_final_write_processing, don't pass linker arg. (_bfd_elf_final_write_processing): Update prototype. * elf.c (_bfd_elf_write_object_contents): Adjust call. (_bfd_elf_final_write_processing): Return error on incompatible OSABI and has_gnu_osabi. Remove linker arg. * elf-nacl.h (nacl_final_write_processing): Update prototype. * elf-vxworks.h (elf_vxworks_final_write_processing): Likewise. * elfxx-mips.h (_bfd_mips_final_write_processing): Likewise. (_bfd_mips_elf_final_write_processing): Likewise. * elf-hppa.h (elf_hppa_final_write_processing): Return status and remove linker arg. * elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise. * elf-nacl.c (nacl_final_write_processing): Likewise. * elf-vxworks.c (elf_vxworks_final_write_processing): Likewise. * elf32-arc.c (arc_elf_final_write_processing): Likewise. * elf32-arm.c (arm_final_write_processing): Likewise. (elf32_arm_final_write_processing): Likewise. (elf32_arm_nacl_final_write_processing): Likewise. (elf32_arm_vxworks_final_write_processing): Likewise. * elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise. * elf32-bfin.c (elf32_bfin_final_write_processing): Likewise. * elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise. * elf32-cris.c (cris_elf_final_write_processing): Likewise. * elf32-h8300.c (elf32_h8_final_write_processing): Likewise. * elf32-lm32.c (lm32_elf_final_write_processing): Likewise. * elf32-m32r.c (m32r_elf_final_write_processing): Likewise. * elf32-m68k.c (elf_m68k_final_write_processing): Likewise. * elf32-mips.c (mips_vxworks_final_write_processing): Likewise. * elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise. * elf32-nds32.c (nds32_elf_final_write_processing): Likewise. * elf32-or1k.c (or1k_elf_final_write_processing): Likewise. * elf32-pj.c (pj_elf_final_write_processing): Likewise. * elf32-ppc.c (ppc_final_write_processing): Likewise. (ppc_elf_final_write_processing): Likewise. (ppc_elf_vxworks_final_write_processing): Likewise. * elf32-sparc.c (sparc_final_write_processing): Likewise. (elf32_sparc_final_write_processing): Likewise. (elf32_sparc_vxworks_final_write_processing): Likewise. * elf32-v850.c (v850_elf_final_write_processing): Likewise. * elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise. * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise. * elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise. * elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise. * elfxx-mips.c (_bfd_mips_final_write_processing): Likewise. (_bfd_mips_elf_final_write_processing): Likewise. gas/ * config/obj-elf.c (obj_elf_section, obj_elf_type): Set has_gnu_osabi. * testsuite/gas/elf/section12a.d: Update xfails. * testsuite/gas/elf/section12b.d: Likewise.
2019-07-24Re: ELF final_write_processingAlan Modra4-20/+20
I missed some early exits from final_write_processing that mean _bfd_elf_final_write_processing could be missed. * elf-vxworks.c (elf_vxworks_final_write_processing): Don't return early. * elf32-arc.c (arc_elf_final_write_processing): Likewise. * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
2019-07-24Define ELF_OSABI for visiumAlan Modra2-1/+7
and update expected results for gas mbind tests. bfd/ * elf32-visium.c (visium_elf_post_process_headers): Don't set EI_OSABI header byte here. (ELF_OSABI): Define. gas/ * testsuite/gas/elf/section12a.d: xfail visium and cloudabi. * testsuite/gas/elf/section12b.d: Likewise. * testsuite/gas/elf/section13.d: Likewise.
2019-07-24Automatic date update in version.inGDB Administrator1-1/+1
2019-07-23SHF_GNU_MBIND requires ELFOSABI_GNUAlan Modra4-36/+67
When SHF_GNU_MBIND was added in the SHF_LOOS to SHF_HIOS range, it should have required ELFOSABI_GNU since these flags are already in use by other OSes. HPUX SHF_HP_TLS in fact has the same value. That means no place in binutils should test SHF_GNU_MBIND without first checking OSABI, and SHF_GNU_MBIND should not be set without also setting OSABI. At least, that's the ideal, but the patch accepts SHF_GNU_MBIND on ELFOSABI_NONE object files since gas didn't always set OSABI. However, to reinforce the fact that SHF_GNU_MBIND isn't proper without a non-zero OSABI, readelf will display the flag as LOOS+0 if OSABI isn't set. The clash with SHF_HP_TLS means that hppa64-linux either has that flag on .tbss sections or supports GNU_MBIND, not both. (hppa64-linux users, if there are any, may have noticed that GNU ld since 2017 mysteriously aligned their .tbss sections to a 4k boundary. That was one consequence of SHF_HP_TLS being blindly interpreted as SHF_GNU_MBIND.) Since it seems that binutils, gdb, gcc, glibc, and the linux kernel don't care about SHF_HP_TLS I took that flag out of .tbss for hppa64-linux. bfd/ * elf-bfd.h (enum elf_gnu_osabi): Add elf_gnu_osabi_mbind. * elf.c (_bfd_elf_make_section_from_shdr): Set elf_gnu_osabi_mbind. (get_program_header_size): Formatting. Only test SH_GNU_MBIND when elf_gnu_osabi_mbind is set. (_bfd_elf_map_sections_to_segments): Likewise. (_bfd_elf_init_private_section_data): Likewise. (_bfd_elf_final_write_processing): Update comment. * elf64-hppa.c (elf64_hppa_special_sections): Move .tbss entry. (elf_backend_special_sections): Define without .tbss for linux. binutils/ * readelf.c (get_parisc_segment_type): Split off hpux entries.. (get_ia64_segment_type): ..and these.. (get_hpux_segment_type): ..to here. (get_segment_type): Condition GNU_MBIND on osabi. Use get_hpux_segment_type. (get_symbol_binding): Do not print UNIQUE for ELFOSABI_NONE. (get_symbol_type): Do not print IFUNC for ELFOSABI_NONE. gas/ * config/obj-elf.c (obj_elf_change_section): Don't emit a fatal error for non-SHF_ALLOC SHF_GNU_MBIND here. (obj_elf_parse_section_letters): Return SHF_GNU_MBIND in new gnu_attr param. (obj_elf_section): Adjust obj_elf_parse_section_letters call. Formatting. Set SHF_GNU_MBIND and elf_osabi from gnu_attr. Emit normal error for non-SHF_ALLOC SHF_GNU_MBIND and wrong osabi. (obj_elf_type): Set elf_osabi for ifunc. * testsuite/gas/elf/section12a.d: xfail msp430 and hpux. * testsuite/gas/elf/section12b.d: Likewise. * testsuite/gas/elf/section13.d: Likewise. * testsuite/gas/elf/section13.l: Adjust expected error. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Condition SHF_GNU_MBIND on osabi. Set output elf_gnu_osabi_mbind.
2019-07-23ELF final_write_processingAlan Modra40-99/+175
Move setting of OSABI to final_write_processing, after symbols are written. This allows OSABI to be set based on symbols actually written to the output rather than assuming input symbols will be output. Corrects object files such as the one generated on powerpc64le-linux by ld-powerpc/pr23927.s which has a local STT_GNU_IFUNC symbol but prior to this patch the file was marked ELFOSABI_NONE. * elf-bfd.h (enum elf_gnu_osabi): Rename from elf_gnu_symbols. Remove none, any, all enums. (struct elf_obj_tdata): Rename has_gnu_symbols field to has_gnu_osabi. (_bfd_elf_final_write_processing): Declare. * elf.c (_bfd_elf_write_object_contents): Unconditionally call elf_backend_final_write_processing. (_bfd_elf_post_process_headers): Move body of function to.. (_bfd_elf_final_write_processing): ..here, but set EI_OSABI byte only when not already set. Adjust for rename. * elfxx-target.h (elf_backend_final_write_processing): Default to _bfd_elf_final_write_processing. * elf-hppa.h (elf_hppa_final_write_processing): Call _bfd_elf_final_write_processing. * elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise. * elf-nacl.c (nacl_final_write_processing): Likewise. * elf-vxworks.c (elf_vxworks_final_write_processing): Likewise. * elf32-arc.c (arc_elf_final_write_processing): Likewise. * elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise. * elf32-bfin.c (elf32_bfin_final_write_processing): Likewise. * elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise. * elf32-cris.c (cris_elf_final_write_processing): Likewise. * elf32-h8300.c (elf32_h8_final_write_processing): Likewise. * elf32-lm32.c (lm32_elf_final_write_processing): Likewise. * elf32-m32r.c (m32r_elf_final_write_processing): Likewise. * elf32-m68k.c (elf_m68k_final_write_processing): Likewise. * elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise. * elf32-nds32.c (nds32_elf_final_write_processing): Likewise. * elf32-or1k.c (or1k_elf_final_write_processing): Likewise. * elf32-pj.c (pj_elf_final_write_processing): Likewise. * elf32-v850.c (v850_elf_final_write_processing): Likewise. * elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise. * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise. * elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise. * elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise. * elf32-arm.c (arm_final_write_processing): Split out from.. (elf32_arm_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (elf32_arm_nacl_final_write_processing): Adjust. * elfxx-mips.c (_bfd_mips_final_write_processing): Split out from.. (_bfd_mips_elf_final_write_processing): ..here. Call _bfd_elf_final_write_processing. * elfxx-mips.h (_bfd_mips_final_write_processing): Declare. * elf32-mips.c (mips_vxworks_final_write_processing): Adjust. * elf32-ppc.c (ppc_final_write_processing): Split out from.. (ppc_elf_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (ppc_elf_vxworks_final_write_processing): Adjust. * elf32-sparc.c (sparc_final_write_processing): Split out from.. (elf32_sparc_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (elf32_sparc_vxworks_final_write_processing): Adjust. * elf32-d10v.c (elf_backend_final_write_processing): Don't define. * elf32-d30v.c (elf_backend_final_write_processing): Don't define. * elf32-m68hc11.c (elf_backend_final_write_processing): Don't define. * elf32-m68hc12.c (elf_backend_final_write_processing): Don't define. * elf32-s12z.c (elf_backend_final_write_processing): Don't define. * elf32-i386.c (elf_i386_check_relocs): Don't set has_gnu_symbols. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elflink.c (elf_link_add_object_symbols): Likewise. (elf_link_output_symstrtab): Set has_gnu_osabi for symbols here instead.
2019-07-23Allow objdump to recognise the System.Runtime.dll files that get shipped ↵Omar Majid3-0/+23
with .NET Core 2.1. include * coff/i386.h (IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE): Define. (I386_APPLE_MAGIC): Define. (I386_FREEBSD_MAGIC): Define. (I386_LINUX_MAGIC): Define. (I386_NETBSD_MAGIC): Define. (I386BADMAG): Extend macro to allow new magic numbers. * coff/x86_64.h (IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE): Define. (AMD64_APPLE_MAGIC): Define. (AMD64_FREEBSD_MAGIC): Define. (AMD64_LINUX_MAGIC): Define. (AMD64_NETBSD_MAGIC): Define. (AMD64BADMAG): Extend macro to allow new magic numbers. bfd * coffcode.h (coff_set_arch_mach_hook): Handle I386_APPLE_MAGIC, I386_FREEBSD_MAGIC, I386_LINUX_MAGIC, I386_NETBSD_MAGIC, AMD64_APPLE_MAGIC, AMD64_FREEBSD_MAGIC, AMD64_LINUX_MAGIC, AMD64_NETBSD_MAGIC. * peXXigen.c: Add comment about source of .NET magic numbers. binutils* Makefile.am (AUTOMAKE_OPTIONS): Add subdir-objects (GENTESTDLLSPROG): Define. (TEST_PROGS): Add GENTESTDLLSPROG. * Makefile.in: Regenerate. * testsuite/binutils-all/objdump.exp (test_objdump_dotnet_assemblies): New proc. Run the new proc. * testsuite/gentestdlls.c: New source file.
2019-07-23Automatic date update in version.inGDB Administrator1-1/+1
2019-07-22Automatic date update in version.inGDB Administrator1-1/+1
2019-07-21Automatic date update in version.inGDB Administrator1-1/+1
2019-07-20Automatic date update in version.inGDB Administrator1-1/+1
2019-07-19[PowerPC64] pc-relative TLS relocationsAlan Modra5-28/+251
This patch supports using pcrel instructions in TLS code sequences. A number of new relocations are needed, gas operand modifiers to generate those relocations, and new TLS optimisation. For optimisation it turns out that the new pcrel GD and LD sequences can be distinguished from the non-pcrel GD and LD sequences by there being different relocations on the new sequence. The final "add ra,rb,13" on IE sequences similarly needs a new relocation, or as I chose, a modification of R_PPC64_TLS. On pcrel IE code, the R_PPC64_TLS points one byte into the "add" instruction rather than being on the instruction boundary. GD: pla 3,z@got@tlsgd@pcrel # R_PPC64_GOT_TLSGD34 bl __tls_get_addr@notoc(z@tlsgd) # R_PPC64_TLSGD and R_PPC64_REL24_NOTOC edited to IE pld 3,z@got@tprel@pcrel add 3,3,13 edited to LE paddi 3,13,z@tprel nop LD: pla 3,z@got@tlsld@pcrel # R_PPC64_GOT_TLSLD34 bl __tls_get_addr@notoc(z@tlsld) # R_PPC64_TLSLD and R_PPC64_REL24_NOTOC .. paddi 9,3,z2@dtprel pld 10,z3@got@dtprel@pcrel add 10,10,3 edited to LE paddi 3,13,0x1000 nop IE: pld 9,z@got@tprel@pcrel # R_PPC64_GOT_TPREL34 add 3,9,z@tls@pcrel # R_PPC64_TLS at insn+1 ldx 4,9,z@tls@pcrel lwax 5,9,z@tls@pcrel stdx 5,9,z@tls@pcrel edited to LE paddi 9,13,z@tprel nop ld 4,0(9) lwa 5,0(9) std 5,0(9) LE: paddi 10,13,z@tprel include/ * elf/ppc64.h (R_PPC64_TPREL34, R_PPC64_DTPREL34), (R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34), (R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define. (IS_PPC64_TLS_RELOC): Include new tls relocs. bfd/ * reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34), (BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34), (BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34), (BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs. * elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs. (ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs. (must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64. (ppc64_elf_check_relocs): Support pcrel tls relocs. (ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.c (ppc_elf_suffix): Map "tls@pcrel", "got@tlsgd@pcrel", "got@tlsld@pcrel", "got@tprel@pcrel", and "got@dtprel@pcrel". (fixup_size, md_assemble): Handle pcrel tls relocs. (ppc_force_relocation, ppc_fix_adjustable): Likewise. (md_apply_fix, tc_gen_reloc): Likewise. ld/ * testsuite/ld-powerpc/tlsgd.d, * testsuite/ld-powerpc/tlsgd.s, * testsuite/ld-powerpc/tlsie.d, * testsuite/ld-powerpc/tlsie.s, * testsuite/ld-powerpc/tlsld.d, * testsuite/ld-powerpc/tlsld.s: New tests. * testsuite/ld-powerpc/powerpc.exp: Run them.
2019-07-19Automatic date update in version.inGDB Administrator1-1/+1
2019-07-18[PowerPC64] Use STN_UNDEF internally for edited relocsAlan Modra2-33/+12
It's not correct to use non-STT_TLS symbols with TLS relocation, not that it matters much when editing relocs, but this edited reloc can be output by --emit-relocs. So don't use a symbol on the reloc. * elf64-ppc.c (ppc64_elf_relocate_section): Don't bother selecting a TLS section symbol for edited relocs. Tighten TLS symbol/reloc match test.
2019-07-18[PowerPC64] Don't store TLS_EXPLICIT in tls_maskAlan Modra2-8/+19
This saves a bit in tls_mask, and fixes a bug that could be triggered in the unlikely case that both @got (usual ELF style) and @toc (PowerOpen style) code was used to set up args for __tls_get_addr. * elf64-ppc.c (TLS_EXPLICIT): Define as 256. (ppc64_elf_check_relocs): Don't store TLS_EXPLICIT even if char is more than 8 bits. (ppc64_elf_tls_optimize): Likewise. Make tls_set, tls_clear, and tls_type vars unsigned int. (ppc64_elf_relocate_section): Use r_type rather than TLS_EXPLICIT to select r_type edit.
2019-07-18[PowerPC] Rename TLS_TPRELGD to TLS_GDIEAlan Modra3-25/+27
Choose a better name, that reflects why the flag is set (GD to IE optimisation) rather than what the flag produces (TPREL64 reloc on a single GOT entry replacing a tls_index pair). * elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file. Correct comment. * elf64-ppc.c (TLS_GDIE): Likewise.
2019-07-18[PowerPC64] correct tprel offset limitAlan Modra2-3/+7
I don't expect anyone will have hit this bug. You'd need a TLS segment of 2G before you'd notice. * elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed range of tp-relative offsets.
2019-07-18Automatic date update in version.inGDB Administrator1-1/+1
2019-07-17Automatic date update in version.inGDB Administrator1-1/+1
2019-07-16Automatic date update in version.inGDB Administrator1-1/+1
2019-07-15Fix __bss_start assertion failure in _bfd_elf_fix_symbol_flagsAlan Modra2-3/+15
> Building LLVM 6.0 on FreeBSD/powerpc (devel/llvm60 port) the assertion > in the subject trips (displays twice) when linking libLTO.so.1. The > issue has been filed in FreeBSD's bugzilla, at > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237068 . It appears > the 'llvm::hashing::detail::get_execution_seed()::seed@@JL_LLVM_6.0' > symbol is being weakly aliased to an indirect symbol > __bss_start@@JL_LLVM_6.0. Since __bss_start@@JL_LLVM_6.0 is an > indirect symbol, it fails the assertion. I haven't looked under a debugger at your testcase but I think I know what is going on here. You have a shared library with a weakly defined llvm::hashing::detail::get_execution_seed()::seed which happens to be at the same location as __bss_start in that library. At the time the linker loads symbols for that library, it sees they are both versioned and thus introduces non-versioned indirect symbols for them. The linker considers the symbols as possibly being aliases, setting up h->u.alias and h->is_weakalias such that __bss_start@@JL_LLVM_6.0 is the definition. No real problem so far, the definition is bfd_link_hash_defined, except that the zero size, no type __bss_start symbol possibly should not be considered an alias in the first place. Later, __bss_start as defined by the linker script is entered into the linker symbol table. This is similar to __bss_start being defined by a regular object file in that ELF symbol resolution rules say that the value of __bss_start in the library is overridden by __bss_start in the executable/library being produced. So to accomplish the override, ld flips __bss_start from being an indirect symbol pointing at __bss_start@@JL_LLVM_6.0 to __bss_start@@JL_LLVM_6.0 being an indirect symbol pointing at __bss_start. That's how we get an unexpected indirect symbol and hit the assert. What should happen I think, is for the def->def_regular code above the assert to run in this case. The symbols are no longer aliases. * elflink.c (_bfd_elf_fix_symbol_flags): If the def for an alias is no longer bfd_link_hash_defined, clear the alias.
2019-07-15Automatic date update in version.inGDB Administrator1-1/+1
2019-07-14Automatic date update in version.inGDB Administrator1-1/+1
2019-07-13Dynamic TLS section symbolsAlan Modra4-36/+74
It is possible to create shared libraries on PowerPC using -ftls-model=inital-exec or -ftls-model=local-exec. The first is half reasonable, getting you a shared library that can't be dlopen'd but otherwise is reasonable. The second is quite bad. Not only do you lose being able to dlopen, the library also has dynamic text relocations. Worse, the TPREL16_LO, TPREL16_HA and other TPREL16 dynamic relocs emitted were wrong, resulting in wrong values being applied by ld.so. Using the first TLS section symbol in dynamic relocations for local TLS symbols doesn't work. It's wrong because TLS symbols used by TLS relocs have values relative to the TLS segment, whereas the TLS section symbols are addresses. This patch instead uses a symbol index of zero which is used elsewhere by PowerPC on dynamic TLS relocs. It's not strictly ABI compliant to use a non-TLS symbol with TLS relocs but symbol index zero can be interpreted as "no symbol". Not using the first TLS section symbol means it doesn't need to be dynamic. The patch also fixes a further problem with PowerPC32 dynamic TPREL16* relocs, which shouldn't have the symbol value in the addend as we do for non-TLS symbols. bfd/ * elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep tls_sec. (_bfd_elf_init_1_index_section): Prefer not using TLS sections. (_bfd_elf_init_2_index_sections): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): When emitting dynamic relocations for local TLS symbols, use STN_UNDEF as the relocation symbol. * elf32-ppc.c (ppc_elf_relocate_section): Likewise, and don't leave TLS symbol value in the addend. ld/ * testsuite/ld-powerpc/tlsso.r: Update. * testsuite/ld-powerpc/tlsso32.g: Update. * testsuite/ld-powerpc/tlsso32.r: Update. * testsuite/ld-powerpc/tlstocso.r: Update. * testsuite/ld-cris/tls-dso-dtpoffd2.d: Update. * testsuite/ld-cris/tls-dso-dtpoffd4.d: Update. * testsuite/ld-cris/tls-dso-tpoffgotcomm1.d: Update. * testsuite/ld-cris/tls-gd-1.d: Update. * testsuite/ld-cris/tls-gd-1h.d: Update. * testsuite/ld-cris/tls-gd-2.d: Update. * testsuite/ld-cris/tls-gd-2h.d: Update. * testsuite/ld-cris/tls-ie-10.d: Update. * testsuite/ld-cris/tls-ie-11.d: Update. * testsuite/ld-cris/tls-ie-8.d: Update. * testsuite/ld-cris/tls-ie-9.d: Update. * testsuite/ld-cris/tls-js1.d: Update. * testsuite/ld-cris/tls-ld-4.d: Update. * testsuite/ld-cris/tls-ld-5.d: Update. * testsuite/ld-cris/tls-ld-6.d: Update. * testsuite/ld-cris/tls-ld-7.d: Update. * testsuite/ld-cris/tls-ldgd-14.d: Update. * testsuite/ld-cris/tls-ldgd-15.d: Update. * testsuite/ld-cris/tls-ldgdx-14.d: Update. * testsuite/ld-cris/tls-ldgdx-15.d: Update. * testsuite/ld-cris/tls-local-54.d: Update. * testsuite/ld-cris/tls-local-60.d: Update. * testsuite/ld-cris/tls-local-61.d: Update. * testsuite/ld-cris/tls-local-63.d: Update. * testsuite/ld-cris/tls-local-64.d: Update. * testsuite/ld-cris/tls-ok-30.d: Update. * testsuite/ld-cris/tls-ok-32.d: Update. * testsuite/ld-cris/tls-ok-34.d: Update. * testsuite/ld-mips-elf/tls-multi-got-1.got: Update. * testsuite/ld-mips-elf/tls-multi-got-1.r: Update. * testsuite/ld-mips-elf/tlsdyn-pie-o32.d: Update. * testsuite/ld-mips-elf/tlsdyn-pie-o32.got: Update. * testsuite/ld-mips-elf/tlslib-o32-hidden.got: Update. * testsuite/ld-mips-elf/tlslib-o32-ver.got: Update. * testsuite/ld-mips-elf/tlslib-o32.got: Update. * testsuite/ld-s390/tlspic.rd: Update. * testsuite/ld-s390/tlspic_64.rd: Update. * testsuite/ld-sparc/tlssunnopic32.rd: Update. * testsuite/ld-sparc/tlssunnopic64.rd: Update. * testsuite/ld-sparc/tlssunpic32.rd: Update. * testsuite/ld-sparc/tlssunpic64.rd: Update.
2019-07-13Automatic date update in version.inGDB Administrator1-1/+1
2019-07-12Automatic date update in version.inGDB Administrator1-1/+1
2019-07-11Automatic date update in version.inGDB Administrator1-1/+1
2019-07-10Automatic date update in version.inGDB Administrator1-1/+1
2019-07-09Automatic date update in version.inGDB Administrator1-1/+1
2019-07-08PR24785, bfd crashes on empty .PPC.EMB.apuinfo sectionAlan Modra2-1/+9
PR 24785 * elf32-ppc.c (_bfd_elf_ppc_set_arch): Sanity check .PPC.EMB.apuinfo size before reading first word.
2019-07-08Automatic date update in version.inGDB Administrator1-1/+1
2019-07-07Automatic date update in version.inGDB Administrator1-1/+1
2019-07-06Automatic date update in version.inGDB Administrator1-1/+1
2019-07-05Automatic date update in version.inGDB Administrator1-1/+1
2019-07-04Automatic date update in version.inGDB Administrator1-1/+1
2019-07-03Automatic date update in version.inGDB Administrator1-1/+1
2019-07-02Stop the BFD library from issuing a warning message when processing ↵Nick Clifton3-1/+47
allocated sections in debuginfo files that lie outside of any loadable segment. PR 24717 * elf.c (is_debuginfo_file): New function. (assign_file_positions_for_non_load_sections): Do not warn about allocated sections outside of loadable segments if they are found in a debuginfo file. * elf-bfd.h (is_debuginfo_file): Prototype.
2019-07-02Fix a bug recently introduced to the linker where it would complain about a ↵Nick Clifton2-0/+9
section being larger than a file, even if the section was artificial. PR 24753 bfd * compress.c (bfd_get_full_section_contents): Do not complain about linker created sections that are larger than the file size. ld * emultempl/aarch64elf.em (_aarch64_add_stub_section): Include the LINKER_CREATED section flag when creating the stub section.
2019-07-02PR ld/24709 [arm] linker crash and assertion failure with CMSEChristophe Lyon2-1/+31
As discussed in the PR, we do not support the case where CMSE stubs are inserted too far from their destination. This would require an intermediate long-branch stub, which is tricky in this context. Instead of crashing, this patch emit an error message and exits. 2019-07-02 Christophe Lyon <christophe.lyon@linaro.org> * bfd/elf32-arm.c (CMSE_STUB_NAME): New define. (elf32_arm_get_stub_entry): Do not try to emit long-branch stubs for CMSE stubs. (arm_dedicated_stub_output_section_name): Use CMSE_STUB_NAME. Change-Id: I6d4e1c0fdee6bb9f4b07e5e1b46700b5ba31c62e
2019-07-02Ensure that debug information is retained for ARMv8-M security functions.Srinath Parvathaneni2-0/+25
Consider a file containing only Armv8-M secure entry functions. This file is compiled and linked with "-march=armv8-m.main -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mcmse -static --specs=rdimon.specs -Wl,--section-start,.gnu.sgstubs=0x190000 -ffunction-sections -fdata-sections -Wl,--gc-sections -g" options to generate an executable. The executable generated does not contain any debug information of these secure entry functions even though it contains secure entry functions in the .text section. This patch fixes this problem.
2019-07-02Automatic date update in version.inGDB Administrator1-1/+1
2019-07-01Correct the calculation of offsets for ARM exidx relocs when performing a ↵Nick Clifton2-1/+7
partial link. PR 23839 bfd * elf32-arm.c (elf32_arm_update_relocs): Do not include the section VMA in the offset used to update exidx relocs. ld * testsuite/ld-arm/unwind-4.d: Adjust for corrected calculation of exidx relocs.
2019-07-01Automatic date update in version.inGDB Administrator1-1/+1
2019-06-30Automatic date update in version.inGDB Administrator1-1/+1
2019-06-29Automatic date update in version.inGDB Administrator1-1/+1
2019-06-28Prevent attempts to allocate excessive amounts of memory when parsing ↵Nick Clifton3-0/+37
corrupt ELF files. PR 24708 * elf.c (_bfd_elf_slurp_version_tables): Check for an excessively large version reference section. * compress.c (bfd_get_full_section_contents): Check for an uncompressed section whose size is larger than the file size.
2019-06-28Plugin target handlingAlan Modra6-26/+37
This patch fixes failures with LTO on mingw32 targets. Since git commit 7cf7fcc83c all possible targets (minus binary) are matched in bfd_check_format_matches rather than lower priority targets being excluded once a higher priority target matches. During linking that results in the ld/plugin.c plugin_object_p function being called with the input file xvec set to plugin_vec, which means plugin_get_ir_dummy_bfd doesn't see the real format of the file (pe-i386). It defaults to the output format instead, which happens to be pei-i386, and this wrong choice persists for the dummy bfd. pei-i386 isn't recognised as a valid linker input file. So, omit recognizing a plugin object in bfd_check_format_matches when some other object format matches, and make sure those other object formats are checked first. * format.c (bfd_check_format_matches): Don't match plugin target if another target matches. Expand comment. * targets.c (_bfd_target_vector): Move plugin_vec after all other non-corefile targets, outside !SELECT_VECS. * config.bfd: Don't handle targ=plugin here. * configure.ac: Don't add plugin to enable_targets or handle in target loop setting selvecs and other target vars. * configure: Regenerate.
2019-06-28Automatic date update in version.inGDB Administrator1-1/+1
2019-06-27Automatic date update in version.inGDB Administrator1-1/+1