summaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
Commit message (Collapse)AuthorAgeFilesLines
* Arm: Fix LSB of GOT for Thumb2 only PLT.Tamar Christina2020-04-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you have a Thumb only PLT then the address in the GOT for PLT0 needs to have the Thumb bit set since the instruction used in PLTn to get there is `ldr.w pc` which is an inter-working instruction: the PLT sequence in question is 00000120 <foo@plt>: 120: f240 0c98 movw ip, #152 ; 0x98 124: f2c0 0c01 movt ip, #1 128: 44fc add ip, pc 12a: f8dc f000 ldr.w pc, [ip] 12e: e7fc b.n 12a <foo@plt+0xa> Disassembly of section .text: 00000130 <bar>: 130: b580 push {r7, lr} 132: af00 add r7, sp, #0 134: f7ff fff4 bl 120 <foo@plt> and previously the linker would generate Hex dump of section '.got': ... 0x000101b8 40010100 00000000 00000000 10010000 @............... Which would make it jump and transition out of thumb mode and crash since you only have thumb mode on such cores. Now it correctly generates Hex dump of section '.got': ... 0x000101b8 40010100 00000000 00000000 11010000 @............... Thanks to Amol for testing patch and to rgujju for reporting it. bfd/ChangeLog: PR ld/16017 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0 address in the GOT if in thumb only mode. ld/ChangeLog: PR ld/16017 * testsuite/ld-arm/arm-elf.exp (thumb-plt-got): New. * testsuite/ld-arm/thumb-plt-got.d: New test. (cherry picked from commit a7618269b727da9cf56727c22cb538ff5f0e4d25) (cherry picked from commit 3ce23ca1de4c769c4b7247f0724a10ef5fb24a11)
* Arm: Fix thumb2 PLT branch offsets.Tamar Christina2020-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | When I previously changed these offsets I had incorrectly used an offset of -2 for this Thumb2 PLT. Unfortunately because we had no tests for this PLT I had missed that the result was incorrect. This patch fixes the offset to PC .-4 so that it correctly addresses the previous instruction and adds a test for this PLT stub. bfd/ChangeLog: * elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset. ld/ChangeLog: * testsuite/ld-arm/arm-elf.exp (thumb-plt): New. * testsuite/ld-arm/thumb-plt.d: New test. * testsuite/ld-arm/thumb-plt.s: New test. (cherry picked from commit 15ccbdd717530f81f545a716f0df1de62aee1157) (cherry picked from commit 3ce23ca1de4c769c4b7247f0724a10ef5fb24a11)
* [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIESzabolcs Nagy2020-01-101-4/+2
| | | | | | | | | | | | | | | | | | | | | | With static PIE linking undefined weak symbols are resolved to 0, so no dynamic relocation is needed for them. The UNDEFWEAK_NO_DYNAMIC_RELOC macro was introduced so this case can be handled easily, but it was not applied consistently in the first attempt to fix ld/22269 for arm: commit 95b03e4ad68e7a90f5096b47df595636344b783a arm: Check UNDEFWEAK_NO_DYNAMIC_RELOC This patch fixes spurious relative relocs in static PIE binaries against GOT entries created for undefined weak symbols on arm*-*, this fixes FAIL: pr22269-1 (static pie undefined weak) bfd/ChangeLog: PR ld/22269 * elf32-arm.c (elf32_arm_final_link_relocate): Use UNDEFWEAK_NO_DYNAMIC_RELOC. (allocate_dynrelocs_for_symbol): Likewise.
* Fix potential illegal memory access failures in the BFD library by ensuring ↵Nick Clifton2020-01-031-5/+6
| | | | | | | | | | | | | | | | | | that the return value from bfd_malloc() is checked before it is used. PR 25308 * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the return value from bfd_malloc. * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise. (elf32_arm_filter_cmse_symbols): Likewise. (elf32_arm_write_section): Likewise. * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise. (bfd_mach_o_follow_dsym): Likewise. * pef.c (bfd_pef_print_loader_section): Likewise. (bfd_pef_scan_start_address): Likewise. (bfd_pef_parse_function_stubs): Likewise. (bfd_pef_parse_symbols): Likewise.
* Update year range in copyright notice of binutils filesAlan Modra2020-01-011-1/+1
|
* bfd signed overflow fixesAlan Modra2019-12-111-9/+9
| | | | | | | | | | | | | | | | | | | | Aimed at quietening ubsan. include/ * opcode/mmix.h (PUSHGO_INSN_BYTE): Make unsigned. (GO_INSN_BYTE, SETL_INSN_BYTE, INCML_INSN_BYTE, INCMH_INSN_BYTE), (INCH_INSN_BYTE, SWYM_INSN_BYTE, JMP_INSN_BYTE): Likewise. bfd/ * elf32-rx.c (elf32_rx_relax_section): Avoid signed overflow. * libaout.h (N_SET_INFO, N_SET_FLAGS): Likewise. * netbsd.h (write_object_contents): Likewise. * elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Likewise. * libhppa.h (HPPA_R_CONSTANT): Don't signed extend with shifts. (stm32l4xx_create_replacing_stub_vldm): Don't truncate high bits with shifts. * elf32-nds32.h (R_NDS32_RELAX_ENTRY_DISABLE_RELAX_FLAG): Define using 1u shifted left. Ditto for other macros. * mmo.c (LOP): Make unsigned.
* PR23652, Use symbols from debug bfd for _bfd_elf_find_functionAlan Modra2019-11-271-111/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes DWARF info for a function is incomplete, and the function can be retrieved by examining symbols. However, when separate debug files are used it may be that the original file is completely stripped of symbols. This patch teaches BFD to look at symbols from the debug file in that case. The patch also removes arm_elf_find_function, instead implementing elf_backend_maybe_function_sym. arm_elf_find_function was written before the generic _bfd_elf_find_function called maybe_function_sym. aarch64 copied arm, so that file gets the same treatment. There is some chance this will speed up arm and aarch64 lookup of function/line. PR 23652 * dwarf2.c (_bfd_dwarf2_stash_syms): New function. (_bfd_dwarf2_find_nearest_line): Use it here, passing syms to _bfd_elf_find_function. Call _bfd_elf_find_function in cases where _bfd_elf_find_nearest_line would do so. * elf.c (_bfd_elf_find_nearest_line): Omit _bfd_elf_find_function for dwarf2. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. Tidy. * elf32-arm.c (elf32_arm_maybe_function_sym): New function. (elf_backend_maybe_function_sym): Define. (arm_elf_find_function, elf32_arm_find_nearest_line): Delete. (bfd_elf32_find_nearest_line): Don't define. * elfnn-aarch64.c (elfNN_aarch64_maybe_function_sym): New function. (elf_backend_maybe_function_sym): Define. (aarch64_elf_find_function, elfNN_aarch64_find_nearest_line): Delete. (bfd_elfNN_find_nearest_line): Don't define.
* ARM cmse_scan segfaultAlan Modra2019-11-211-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | This code in elf_link_add_object_symbols: ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed); if (ret < 0) goto error_return; /* If we have already included this dynamic object in the link, just ignore it. There is no reason to include a particular dynamic object more than once. */ if (ret > 0) return TRUE; prevents a shared library from being loaded twice by ensuring that any library soname doesn't match the soname of one already loaded. This happens before sym_hashes are allocated, which leaves sym_hashes NULL. cmse_scan looks at library symbols, and when attempting to look up a global symbol will segfault if sym_hashes is zero. * elf32-arm.c (elf32_arm_size_stubs): Exclude dynamic library BFDs that have not been loaded.
* elf_backend_init_file_headerAlan Modra2019-11-181-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch renames elf_backend_post_process_headers and moves the prep_headers code into the new function. Naming the backend functions elf_backend_init_file_header and elf_backend_modify_headers makes it clear which function is called first. * elf-bfd.h (struct elf_backend_data <elf_backend_init_file_header>): Rename from elf_backend_post_process_headers. (_bfd_elf_post_process_headers): Delete. (_bfd_elf_init_file_header): Declare. * elf.c (_bfd_elf_compute_section_file_positions): Call new function in place of prep_headers and elf_backend_post_process_headers. (_bfd_elf_init_file_header): Renamed from prep_headers with updated args and made global. Delete dead code. (_bfd_elf_post_process_headers): Delete. * elf32-arm.c (elf32_arm_init_file_header): Rename from elf32_arm_post_process_headers and call _bfd_elf_init_file_header. Return status. (elf_backend_init_file_header): Define. (elf_backend_post_process_headers): Don't define. * elf32-i386.c (elf_i386_fbsd_init_file_header): Similarly. * elf32-m68hc1x.c (elf32_m68hc11_init_file_header): Similarly. * elf32-metag.c (elf_metag_init_file_header): Similarly. * elf32-spu.c (spu_elf_init_file_header * elf32-visium.c (visium_elf_init_file_header * elf64-alpha.c (elf64_alpha_fbsd_init_file_header * elf64-hppa.c (elf64_hppa_init_file_header * elf64-ia64-vms.c (elf64_vms_init_file_header * elfnn-aarch64.c (elfNN_aarch64_init_file_header * elfnn-ia64.c (elfNN_hpux_init_file_header * elfxx-mips.c (_bfd_mips_init_file_header * elfxx-mips.h (_bfd_mips_post_process_headers): Delete. (_bfd_mips_init_file_header): Declare. (elf_backend_post_process_headers): Delete. (elf_backend_init_file_header): Define. * elfxx-target.h (elf_backend_post_process_headers): Delete. (elf_backend_init_file_header): Define and use. * elf32-m68hc12.c (elf_backend_init_file_header): Define. (elf_backend_post_process_headers): Don't define. * elf32-m68hc1x.h (elf32_m68hc11_post_process_headers): Delete. (elf32_m68hc11_init_file_header): Declare. * elf32-ppc.c (elf_backend_post_process_headers): Remove unnecessary undef.
* elf_backend_modify_headersAlan Modra2019-11-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch renames elf_backend_modify_program_headers and moves the elf.c code tweaking the ELF file header for -pie -Ttext-segment to a new function, _bfd_elf_modify_headers, which then becomes the default elf_backed_modify_headers and is called from any other target elf_backed_modify_headers. * elf-bfd.h (struct elf_backend_data <elf_backend_modify_headers>): Rename from elf_backend_modify_program_headers. (_bfd_elf_modify_headers): Declare. * elf.c (assign_file_positions_except_relocs): Set elf_program_header_size. Always call elf_backend_modify_headers. Extract code modifying file header.. (_bfd_elf_modify_headers): ..to here. New function. * elf32-arm.c (elf_backend_modify_headers): Renamed from elf_backend_modify_program_headers. * elf32-i386.c: Similarly. * elf64-x86-64.c: Similarly. * elfxx-target.h: Similarly. Default elf_backend_modify_headers to _bfd_elf_modify_headers. * elf-nacl.h (nacl_modify_headers): Rename from nacl_modify_program_headers. * elf-nacl.c (nacl_modify_headers): Rename from nacl_modify_program_headers and call _bfd_elf_modify_headers. * elf32-rx.c (elf32_rx_modify_headers): Similarly. * elf32-spu.c (spu_elf_modify_headers): Similarly. * elfnn-ia64.c (elfNN_ia64_modify_headers): Similarly. * elf32-sh.c (elf_backend_modify_program_headers): Don't undef.
* remove more xmalloc in bfdAlan Modra2019-10-151-1/+4
| | | | | | | | | | | | | | | | | | Also fixes m68hc1x printf arguments which would have bombed when compiling on a 32-bit host with --enable-64-bit-bfd. bfd/ PR 24955 * elf32-arm.c (set_cmse_veneer_addr_from_implib): Use bfd_malloc rather than xmalloc. * elf32-m68hc1x.c (reloc_warning): New function. (elf32_m68hc11_relocate_section): Use it here. Cast bfd_vma values corresponding to %lx in format strings. * elf32-nds32.c (nds32_insertion_sort): Use a stack temporary. gas/ * config/tc-nds32.c (nds32_set_section_relocs): Use relocs and n parameters rather than equivalent sec->orelocation and sec->reloc_count. Don't sort for n <= 1. Tidy.
* [PR ld/22263][PR ld/25056] arm: Avoid dynamic TLS relocs in PIESzabolcs Nagy2019-10-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Dynamic relocs are only needed in an executable for TLS symbols if those are defined in an external module and even then TLS access can be relaxed to use IE model instead of GD. Several bfd_link_pic checks are turned into bfd_link_dll checks to fix TLS handling in PIE, for the same fix some other targets used !bfd_link_executable checks, but that includes relocatable objects so dll seems safer (in most cases either should work, since dynamic relocations are not applied in relocatable objects). On arm* fixes FAIL: Build pr22263-1 bfd/ PR ld/22263 PR ld/25056 * elf32-arm.c (elf32_arm_tls_transition): Use bfd_link_dll instead of bfd_link_pic for TLS checks. (elf32_arm_final_link_relocate): Likewise. (allocate_dynrelocs_for_symbol): Likewise.
* [PR ld/25062] arm: sign extend the addend of R_ARM_TLS_GOTDESCSzabolcs Nagy2019-10-041-2/+2
| | | | | | | | | | | | | | | | | On 64-bit host the 32-bit addend was loaded without sign extension into an unsigned long. bfd/ChangeLog: PR ld/25062 * elf32-arm.c (elf32_arm_final_link_relocate): Sign extend data. ld/ChangeLog: PR ld/25062 * testsuite/ld-arm/arm-elf.exp: Update. * testsuite/ld-arm/tls-gdesc-neg.d: New test. * testsuite/ld-arm/tls-gdesc-neg.s: New test.
* arm bfd.h tidyAlan Modra2019-09-231-0/+2
| | | | | | | | | | | | | | | | | | | bfd/ * bfd-in.h: Move arm declaraions.. * cpu-arm.h: ..to here, new file.. * coff-arm.h: ..and here, new file.. * elf32-arm.h: ..and here, new file. * cpu-arm.c: Include cpu-arm.h. * coff-arm.c: Include cpu-arm.h and coff-arm.h. * elf32-arm.c: Include cpu-arm.h and elf32-arm.h. * pe-arm.c: Move function rename defines later. * pe-arm-wince.c: Likewise and include sysdep.h and bfd.h early. * bfd-in2.h: Regenerate. gas/ * config/tc-arm.c: Include cpu-arm.h. ld/ * emultempl/armelf.em: Include elf32-arm.h. * emultempl/pe.em: Move func defines later and include coff-arm.h.
* bfd_section_* macrosAlan Modra2019-09-191-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
* bfd_asymbol_* macrosAlan Modra2019-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main point of this patch is to give bfd_get_section a better name, bfd_asymbol_section. bfd/ * bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section. (bfd_get_output_section): Delete. (bfd_asymbol_base): Delete. (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name), (bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy. (bfd_set_asymbol_name): New macro. * bfd-in2.h: Regenerate. * aout-cris.c: Update throughout to use bfd_asymbol_section. * aoutx.h: Likewise. * cofflink.c: Likewise. * dwarf2.c: Likewise. * ecoff.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-mips.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elfn32-mips.c: Likewise. * elfnn-aarch64.c: Likewise. * elfxx-mips.c: Likewise. * linker.c: Likewise. * pdp11.c: Likewise. * elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section. binutils/ * nm.c: Update bfd_get_section to bfd_asymbol_section throughout. * objcopy.c: Likewise. * objdump.c: Likewise. * rdcoff.c: Likewise. * objcopy.c (create_new_symbol): Use bfd_set_asymbol_name. (filter_symbols): Likewise. gas/ * symbols.c (S_IS_LOCAL): Update bfd_get_section to bfd_asymbol_section. gdb/ * arm-tdep.c (arm_record_special_symbol): Update bfd_get_section to bfd_asymbol_section. ld/ * ldcref.c (check_reloc_refs): Update bfd_get_section to bfd_asymbol_section.
* ARM CMSE symbolsAlan Modra2019-08-221-20/+6
| | | | | | | | | | | | | | | | | | | | | | This patch removes use of st_target_internal to cache the result of comparing symbol names against CMSE_PREFIX. The problem with setting a bit in st_target_internal in swap_symbol_in is that calling bfd_elf_sym_name from swap_symbol_in requires symtab_hdr, and you don't know for sure whether swap_symbol_in is operating on dynsyms (and thus elf_tdata (abfd)->dynsymtab_hdr should be used) or on the normal symtab (thus elf_tdata (abfd)->symtab_hdr). You can make an educated guess based on abfd->flags & DYNAMIC but that relies on knowing a lot about calls to bfd_elf_get_elf_syms, and is fragile in the face of possible future changes. include/ * elf/arm.h (ARM_GET_SYM_CMSE_SPCL, ARM_SET_SYM_CMSE_SPCL): Delete. bfd/ * elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL, instead recognize CMSE_PREFIX in symbol name. (elf32_arm_gc_mark_extra_sections): Likewise. (elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL. (elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.
* Arm: Fix performance issue with thumb-2 tailcallsTamar Christina2019-08-201-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use a padding NOP after a Thumb to Arm interworking veneer (BX pc). The NOP is never executed but may result in a performance penalty on some cores. For this reason this patch changes the NOPs after Thumb to Arm veneers into B .-2 and adds a note to this in the source code for future reference. bfd/ChangeLog: * elf32-arm.c (elf32_thumb2_plt_entry, elf32_arm_plt_thumb_stub, elf32_arm_stub_long_branch_v4t_thumb_thumb, elf32_arm_stub_long_branch_v4t_thumb_arm, elf32_arm_stub_short_branch_v4t_thumb_arm, elf32_arm_stub_long_branch_v4t_thumb_arm_pic, elf32_arm_stub_long_branch_v4t_thumb_thumb_pic, elf32_arm_stub_long_branch_v4t_thumb_tls_pic): Change nop to branch to previous instruction. ld/ChangeLog: * testsuite/ld-arm/cortex-a8-fix-b-plt.d: Update Testcase. * testsuite/ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise. * testsuite/ld-arm/cortex-a8-fix-bcc-plt.d: Likewise. * testsuite/ld-arm/farcall-cond-thumb-arm.d: Likewise. * testsuite/ld-arm/farcall-mixed-app.d: Likewise. * testsuite/ld-arm/farcall-mixed-app2.d: Likewise. * testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise. * testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d: Likewise. * testsuite/ld-arm/farcall-thumb-arm-short.d: Likewise. * testsuite/ld-arm/farcall-thumb-arm.d: Likewise. * testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise. * testsuite/ld-arm/farcall-thumb-thumb.d: Likewise. * testsuite/ld-arm/fix-arm1176-on.d: Likewise. * testsuite/ld-arm/ifunc-10.dd: Likewise. * testsuite/ld-arm/ifunc-2.dd: Likewise. * testsuite/ld-arm/ifunc-4.dd: Likewise. * testsuite/ld-arm/ifunc-6.dd: Likewise. * testsuite/ld-arm/ifunc-8.dd: Likewise. * testsuite/ld-arm/jump-reloc-veneers-long.d: Likewise. * testsuite/ld-arm/mixed-app.d: Likewise. * testsuite/ld-arm/thumb2-b-interwork.d: Likewise. * testsuite/ld-arm/tls-longplt.d: Likewise. * testsuite/ld-arm/tls-thumb1.d: Likewise.
* Remove _bfd_dwarf2_find_nearest_line addr_size parameterAlan Modra2019-08-141-1/+1
| | | | | | | | | | | | | | | | | | This parameter might appear to be used to set up offset_size, but since git commit 024b2372f5 offset_size is either set from the debug_info data or is set to 4. * dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter. * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype. * coffgen.c (coff_find_nearest_line_with_names): Adjust _bfd_dwarf2_find_nearest_line calls. * elf.c (_bfd_elf_find_nearest_line, _bfd_elf_find_line): Likewise. * elf32-arm.c (elf32_arm_find_nearest_line): Likewise. * elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise. * elfnn-aarch64.c (elfNN_aarch64_find_nearest_line): Likewise. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise. * mach-o.c (bfd_mach_o_find_nearest_line): Likewise. * libbfd.h: Regenerate.
* Complain about mbind, ifunc, and unique in final_writeAlan Modra2019-07-241-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* ELF final_write_processingAlan Modra2019-07-231-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* PR ld/24709 [arm] linker crash and assertion failure with CMSEChristophe Lyon2019-07-021-1/+24
| | | | | | | | | | | | | | | | | 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
* Ensure that debug information is retained for ARMv8-M security functions.Srinath Parvathaneni2019-07-021-0/+19
| | | | | | | | | | | | | 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.
* Correct the calculation of offsets for ARM exidx relocs when performing a ↵Nick Clifton2019-07-011-1/+1
| | | | | | | | | | | 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.
* Prevent a seg-fault from objdup when disassembling binaries which do not ↵Adam Lackorzymski2019-06-121-2/+8
| | | | | | | | | contain a symbol table. PR 24643 * elf32-arm.c (arm_elf_find_function): Fail if the symol table is absent, or the bfd is not in the ELF formart. * elfnn-aarch64.c (aarch64_elf_find_function): Likewise.
* ARM STM32L4XX erratum test failure with MALLOC_PERTURB_Alan Modra2019-05-221-1/+1
| | | | | * elf32-arm.c (arm_allocate_glue_section_space): Clear section contents.
* [binutils][Arm] Fix Branch Future relocation handling and testismsAndre Vieira2019-05-211-69/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ChangeLog: 2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com> PR/target 24460 * elf32-arm.c (get_value_helper): Remove. (elf32_arm_final_link_relocate): Fix branch future relocations. gas/ChangeLog: 2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com> * testsuite/gas/arm/armv8_1-m-bf.d: Allow different branch target naming conventions. * testsuite/gas/arm/armv8_1-m-bfl.d: Likewise. * testsuite/gas/arm/armv8_1-m-bfcsel.d: Likewise. * testsuite/gas/arm/armv8_1-m-loloop.d: Likewise. * testsuite/gas/arm/armv8_1-m-bf-rel.d: Skip for vxworks. * testsuite/gas/arm/armv8_1-m-bf-rela.d: New test. * testsuite/gas/arm/armv8_1-m-bfl-rel.d: Skip for vxworks. * testsuite/gas/arm/armv8_1-m-bfl-rela.d: New test. ld/ChangeLog: 2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com> * testsuite/ld-arm/arm-elf.exp: Add tests * testsuite/ld-arm/bfs-0.s: New test. * testsuite/ld-arm/bfs-1.s: New test. * testsuite/ld-arm/branch-futures.d: New test.
* [PATCH 1/57][Arm][GAS]: Add support for +mve and +mve.fpAndre Vieira2019-05-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ChangeLog: 2019-05-16 Andre Vieira <andre.simoesdiasvieira@arm.com> * elf32-arm.c (elf32_arm_merge_eabi_attributes): Add case for Tag_MVE_arch. binutils/ChangeLog: 2019-05-16 Andre Vieira <andre.simoesdiasvieira@arm.com> * readelf.c (arm_attr_tag_MVE_arch): New array for Tag_MVE_arch values. (arm_attr_public_tag arm_attr_public_tags): Add case for Tag_MVE_arch. elfcpp/ChangeLog: 2019-05-16 Andre Vieira <andre.simoesdiasvieira@arm.com> * arm.h (Tag_MVE_arch): Define new enum value. gas/ChangeLog: 2019-05-16 Andre Vieira <andre.simoesdiasvieira@arm.com> * config/tc-arm.c (mve_ext, mve_fp_ext): New features. (armv8_1m_main_ext_table): Add new extensions. (aeabi_set_public_attributes): Translate new features to new build attributes. (arm_convert_symbolic_attribute): Add Tag_MVE_arch. * doc/c-arm.texi: Document new extensions and new build attribute. include/ChangeLog: 2019-05-16 Andre Vieira <andre.simoesdiasvieira@arm.com> * elf/arm.h (Tag_MVE_arch): Define new enum value. * opcode/arm.h (FPU_MVE, FPU_MVE_FP): New MACROs for new features.
* Revert "ARM STM32L4XX erratum test failure"Alan Modra2019-05-161-6/+3
| | | | This reverts commit 3a1bb98c3c4f983b950fbaf2797ddcd21fcb5211.
* ARM STM32L4XX erratum test failureAlan Modra2019-05-151-3/+6
| | | | | | | | Fixes a failure seen with MALLOC_PERTURB_=1. * elf32-arm.c (elf32_arm_write_section): Don't leave error case of STM32L4XX_ERRATUM_BRANCH_TO_VENEER with unitialised section contents.
* [binutils, ARM, 10/16] BFCSEL infrastructure with new global reloc ↵Andre Vieira2019-04-151-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | R_ARM_THM_BF12 This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This adds infrastructure for the BFCSEL instructions which is one of the first instructions in Arm that have more than one relocations in them. This adds a new relocation R_ARM_THM_BF12. The inconsistency between external R_ARM_THM_BF12 and internal BFD_RELOC_ARM_THUMB_BF13 is because internally we count the static bit-0 of the immediate and we don't externally. ChangeLog entries are as follows : ChangeLog entries are as follows : *** bfd/ChnageLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_BF13): New. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF13. (elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF13 and R_ARM_THM_BF12 together. (elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF13. *** elfcpp/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * arm.h (R_ARM_THM_BF12): New relocation code. *** gas/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * config/tc-arm.c (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_BF13. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. *** include/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF12. *** opcodes/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %Z pattern.
* [binutils, ARM, 8/16] BFL infrastructure with new global reloc R_ARM_THM_BF18Andre Vieira2019-04-151-1/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This adds infrastructure for the BFL instructions which is one of the first instructions in Arm that have more than one relocations in them. This adds a new relocation R_ARM_THM_BF18. The inconsistency between external R_ARM_THM_BF18 and internal BFD_RELOC_ARM_THUMB_BF19 is because internally we count the static bit-0 of the immediate and we don't externally. ChangeLog entries are as follows : *** bfd/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_BF19): New * libbfd.h: Regenerated. * bfd-in2.h: Regenerated. * bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF18. (elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF19 and R_ARM_THM_BF18 together. (elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF19. *** elfcpp/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm.h (R_ARM_THM_BF18): New relocation code. *** gas/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * config/tc-arm.c (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_BF19. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. *** include/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF18. *** opcodes/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %Y pattern.
* [binutils, ARM, 5/16] BF insns infrastructure with new global reloc ↵Andre Vieira2019-04-151-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | R_ARM_THM_BF16 This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This adds infrastructure for the BF instructions which is one of the first instructions in Arm that have more than one relocations in them. This is the third infrastructure patch that adds a new relocation R_ARM_THM_BF16. The inconsistency between external R_ARM_THM_BF16 and internal BFD_RELOC_ARM_THUMB_BF17 is because internally we count the static bit-0 of the immediate and we don't externally. ChangeLog entries are as follows : *** bfd/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_BF17): New enum. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF16. (elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF17 and R_ARM_THM_BF16 together. (get_value_helper): New reloc helper. (elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF16. *** elfcpp/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm.h (R_ARM_THM_BF16): New relocation code. *** gas/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * config/tc-arm.c (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_BF17. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. *** include/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF16. *** opcodes/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %W pattern.
* [binutils, ARM, 1/16] Add support for Armv8.1-M Mainline CLIAndre Vieira2019-04-151-6/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch is straightforward, it does the following: - support the new Tag_CPU_arch build attribute value, ie.: + declare the new value + update all the asserts forcing logic to be reviewed for new architectures + create a corresponding bfd_mach_arm_8_1M_MAIN enumerator in bfd and add mapping from Tag_CPU_arch to it + teach readelf about new Tag_CPU_arch value - declare armv8.1-m.main as a supported architecture value - define Armv8.1-M Mainline in terms of feature bits available - tell objdump mapping from bfd_mach_arm_8_1M_MAIN enumerator to feature bits available - update architecture-specific logic in gas and bfd guarded by the asserts mentioned above. - tests for all the above ChangeLog entries are as follows: *** bfd/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * archures.c (bfd_mach_arm_8_1M_MAIN): Define. * bfd-in2.h: Regenerate. * cpu-arm.c (arch_info_struct): Add entry for Armv8.1-M Mainline. * elf32-arm.c (using_thumb_only): Return true for Armv8.1-M Mainline and update assert. (using_thumb2): Likewise. (using_thumb2_bl): Update assert. (arch_has_arm_nop): Likewise. (bfd_arm_get_mach_from_attributes): Add case for Armv8.1-M Mainline. (tag_cpu_arch_combine): Add logic for Armv8.1-M Mainline merging. *** binutils/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * readelf.c (arm_attr_tag_CPU_arch): Add entry for Armv8.1-M Mainline. *** gas/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * config/tc-arm.c (cpu_arch_ver): Add entry for Armv8.1-M Mainline Tag_CPU_arch build attribute value. Reindent. (get_aeabi_cpu_arch_from_fset): Update assert. (aeabi_set_public_attributes): Update assert for Tag_DIV_use logic. * testsuite/gas/arm/attr-march-armv8_1-m.main.d: New test. *** include/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * elf/arm.h (TAG_CPU_ARCH_V8_1M_MAIN): new macro. (MAX_TAG_CPU_ARCH): Set value to above macro. * opcode/arm.h (ARM_EXT2_V8_1M_MAIN): New macro. (ARM_AEXT_V8_1M_MAIN): Likewise. (ARM_AEXT2_V8_1M_MAIN): Likewise. (ARM_ARCH_V8_1M_MAIN): Likewise. *** ld/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * testsuite/ld-arm/attr-merge-13.attr: New test. * testsuite/ld-arm/attr-merge-13a.s: New test. * testsuite/ld-arm/attr-merge-13b.s: New test. *** opcodes/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm-dis.c (select_arm_features): Add logic for Armv8.1-M Mainline.
* Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentryH.J. Lu2019-04-111-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of BFD_ASSERT (h != NULL) with ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562 ld: bad.o: invalid string offset 50331648 >= 371 for section `nterp' check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with ld: bad.o: section 'g': corrupt VTENTRY entry * elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of "h != NULL". Don't check "h != NULL" before calling. bfd_elf_gc_record_vtentry. * elf32-arm.c (elf32_arm_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-csky.c (csky_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-i386.c (elf_i386_check_relocs): Likewise. * elf32-iq2000.c (iq2000_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-or1k.c (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_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-mmix.c (mmix_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_s390_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt VTENTRY entry.
* BFD whitespace fixesAlan Modra2019-04-031-18/+19
| | | | | | | | | * coff-i386.c, * coff-x86_64.c, * coffgen.c, * dwarf2.c, * elf-m10200.c, * elf.c, * elf32-arm.c, * elf32-bfin.c, * elf32-csky.c, * elf32-m32r.c, * elf32-microblaze.c, * elf32-pru.c, * elf32-rx.c, * elf32-xgate.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-riscv.c, * elfxx-sparc.c, * linker.c, * mach-o.c, * pe-x86_64.c, * pei-x86_64.c, * plugin.c: Whitespace fixes.
* Fix GCC9 warning on elf32-arm.c:elf32_arm_final_link_relocateSergio Durigan Junior2019-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Fedora Rawhide has just switched to GCC9, and now GDB doesn't compile because of a BFD warning: BUILDSTDERR: ../../bfd/elf32-arm.c: In function 'elf32_arm_final_link_relocate': BUILDSTDERR: ../../bfd/elf32-arm.c:10907:10: error: absolute value function 'labs' given an argument of type 'bfd_signed_vma' {aka 'long long int'} but has parameter of type 'long int' which may cause truncation of value [-Werror=absolute-value] BUILDSTDERR: 10907 | value = labs (relocation); BUILDSTDERR: | ^~~~ You can take a look at the full build log here: https://kojipkgs.fedoraproject.org//work/tasks/4828/32174828/build.log The fix is (apparently) simple: instead of using 'labs', we should use 'llabs', since we're passing a 'bfd_signed_vma' to it, which is at least a 'long long int', as far as I have checked. This is what this patch does. bfd/ChangeLog: 2019-01-25 Sergio Durigan Junior <sergiodj@redhat.com> * elf32-arm.c (elf32_arm_final_link_relocate): Use 'llabs' instead of 'labs' (and fix GCC warning).
* Update year range in copyright notice of binutils filesAlan Modra2019-01-011-1/+1
|
* Include bfd_stdint.h in bfd.hAlan Modra2018-12-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds bfd_stdint.h to bfd.h, so that BFD can use size_t where appropriate in function parameters and return values. I also tidy a few other cases where headers are included twice. bfd/ * Makefile.am (bfdinclude_HEADERS): Add bfd_stdint.h. (BFD_H_DEPS): Add include/diagnostics.h. (LOCAL_H_DEPS): Add bfd_stdint.h. * bfd-in.h: Include bfd_stdint.h. * arc-plt.h: Don't include stdint.h. * coff-rs6000.c: Likewise. * coff64-rs6000.c: Likewise. * elfxx-riscv.c: Likewise. * cache.c: Don't include bfd_stdint.h. * elf32-arm.c: Likewise. * elf32-avr.c: Likewise. * elf32-nds32.c: Likewise. * elf32-rl78.c: Likewise. * elf32-rx.c: Likewise. * elf32-wasm32.c: Likewise. * elf64-nfp.c: Likewise. * elflink.c: Likewise. * elfnn-aarch64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-x86.h: Likewise. * wasm-module.c: Likewise, and don't include sysdep.h twice. * elf-nacl.h: Don't include bfd.h. * mach-o.h: Likewise. * elfxx-aarch64.c: Include bfd.h and elf-bfd.h. * elfxx-aarch64.h: Don't include bfd.h, elf-bfd.h or stdint.h. * mach-o-aarch64.c: Include mach-o.h later. * mach-o-arm.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-x86-64.c: Likewise. * mach-o.c: Likewise. * sysdep.h: Don't include ansidecl.h or sys/stat.h. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. opcodes/ * arm-dis.c: Include bfd.h. * aarch64-opc.c: Include bfd_stdint.h rather than stdint.h. * csky-dis.c: Likewise. * nds32-asm.c: Likewise. * riscv-dis.c: Likewise. * s12z-dis.c: Likewise. * wasm32-dis.c: Likewise.
* cmse_scan segfaultAlan Modra2018-10-241-1/+2
| | | | | | | | | elf_sym_hashes for as-needed libs will be zeroed if the library is found to be not needed. More than that, the local symbols for such a library should not be considered by cmse_scan. * elf32-arm.c (elf32_arm_size_stubs): Ignore as-needed libs that were not needed.
* Suppress string diagnostics for pre-release GCCAlan Modra2018-07-251-3/+3
| | | | | | | | | | | | Extends commit 898ade12ee8 to cover other targets. * elf32-arm.c (elf32_arm_nabi_write_core_note): Disable -Wstringop-truncation warning for gcc-8.0 too. * elf32-ppc.c (ppc_elf_write_core_note): Likewise. * elf64-ppc.c (ppc64_elf_write_core_note): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise. * elf32-s390.c (elf_s390_write_core_note): Comment fix. * elf64-s390.c (elf_s390_write_core_note): Likewise.
* Initialize GOT slot for local symbol in non-PIC link.Eric Botcazou2018-07-211-28/+38
| | | | | | | | | | | | | | On ARM/VxWorks 7, the R_ARM_TARGET2 relocation used for exception handling is R_ARM_GOT_PREL; moreover in Ada you can define local exceptions. In this case, you may end up with a GOT relocation against a local symbol in a non-PIC link and the ARM linker leaves the GOT slot uninitialized, unlike for example the i386 or the SPARC linkers in the same situation. bfd/ * elf32-arm.c (elf32_arm_final_link_relocate) <R_ARM_GOT32>: Small cleanup for the case of a global symbol that binds locally. Also install a value in the GOT slot in the case of a local symbol in a non-PIC link.
* Fix diagnostic errorsAlan Modra2018-07-061-1/+3
| | | | | | | | | | | | | | | | | | | Fixes a number of build errors like the following .../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note': .../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions .../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions See the comment in diagnostics.h. include/ * diagnostics.h: Comment on macro usage. bfd/ * elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally. * elf32-ppc.c (ppc_elf_write_core_note): Likewise. * elf32-s390.c (elf_s390_write_core_note): Likewise. * elf64-ppc.c (ppc64_elf_write_core_note): Likewise. * elf64-s390.c (elf_s390_write_core_note): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
* [ARM] Update bfd's Tag_CPU_arch knowledgeThomas Preud'homme2018-07-021-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BFD's bfd_get_mach () function returns a bfd specific value representing the architecture of the target which is populated from the Tag_CPU_arch build attribute value of that target. Among other users of that interfacem, objdump which uses it to print the architecture version of the binary being examinated and to decide what instruction is available if run with "-m arm" via its own mapping from bfd_mach_arm_X values to feature bits available. However, both BFD and objdump's most recent known architecture is Armv5TE. When encountering a newer architecture bfd_get_mach will return bfd_mach_arm_unknown. This is unfortunate since objdump uses that value to allow all instructions on all architectures which is already what it does by default, making the "-m arm" trick useless. This patch updates BFD and objdump's knowledge of Arm architecture versions up to the latest Armv8-M Baseline and Mainline, Armv8-R and Armv8.4-A architectures. Since several architecture versions (eg. 8.X-A) share the same Tag_CPU_arch build attribute value and bfd_mach_arm values, the mapping from bfd machine value to feature bits need to return the most featureful feature bits that would yield the given bfd machine value otherwise some instruction would not disassemble under "-m arm" mode. The patch rework that mapping to make this clearer and simplify writing the mapping rules. In particular, for simplicity all FPU instructions are allowed in all cases. Finally, the patch also rewrite the cpu_arch_ver table in GAS to use the TAG_CPU_ARCH_X macros rather than hardcode their value. 2018-07-02 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * archures.c (bfd_mach_arm_5TEJ, bfd_mach_arm_6, bfd_mach_arm_6KZ, bfd_mach_arm_6T2, bfd_mach_arm_6K, bfd_mach_arm_7, bfd_mach_arm_6M, bfd_mach_arm_6SM, bfd_mach_arm_7EM, bfd_mach_arm_8, bfd_mach_arm_8R, bfd_mach_arm_8M_BASE, bfd_mach_arm_8M_MAIN): Define. * bfd-in2.h: Regenerate. * cpu-arm.c (arch_info_struct): Add entries for above new bfd_mach_arm values. * elf32-arm.c (bfd_arm_get_mach_from_attributes): Add Tag_CPU_arch to bfd_mach_arm mapping logic for pre Armv4 and Armv5TEJ and later architectures. Force assert failure for any new Tag_CPU_arch value. gas/ * config/tc-arm.c (cpu_arch_ver): Use symbolic TAG_CPU_ARCH macros rather than hardcode their values. ld/ * arm-dis.c (select_arm_features): Fix typo in heading comment. Allow all FPU features and add mapping from new bfd_mach_arm values to allowed CPU feature bits. opcodes/ * testsuite/ld-arm/tls-descrelax-be8.d: Add architecture version in expected result. * testsuite/ld-arm/tls-descrelax-v7.d: Likewise. * testsuite/ld-arm/tls-longplt-lib.d: Likewise. * testsuite/ld-arm/tls-longplt.d: Likewise.
* Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1H.J. Lu2018-06-041-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 8.1 warns about destination size with -Wstringop-truncation: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643 Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence it. bfd/ PR binutils/23146 * bfd-in.h: Include "diagnostics.h". * bfd-in2.h: Regenerated. * elf32-arm.c (elf32_arm_nabi_write_core_note): Use DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and DIAGNOSTIC_POP to silence GCC 8.1 warnings with -Wstringop-truncation. * elf32-ppc.c (ppc_elf_write_core_note): Likewse. * elf32-s390.c (elf_s390_write_core_note): Likewse. * elf64-ppc.c (ppc64_elf_write_core_note): Likewse. * elf64-s390.c (elf_s390_write_core_note): Likewse. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse. include/ * diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): Always define for GCC.
* ld: Unify STT_GNU_IFUNC handlingH.J. Lu2018-05-281-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Take STT_GNU_IFUNC handling scattered across targets and gather it in the generic ELF linker. bfd/ PR ld/23238 * elf-s390-common.c (elf_s390_add_symbol_hook): Removed. * elf32-arc.c (elf_arc_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf32-s390.c (elf_backend_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf64-s390.c (elf_backend_add_symbol_hook): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC handling. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elflink.c (elf_link_add_object_symbols): Set elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols. ld/ PR ld/23238 * testsuite/ld-ifunc/ifunc-26.d: New file. * testsuite/ld-ifunc/ifunc-26.s: Likewise. * testsuite/ld-ifunc/ifunc.exp: Run *.d tests without a working compiler.
* -Wstringop-truncation warningsAlan Modra2018-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is aimed at silencing gcc8 -Wstringop-truncation warnings. Unfortunately adding __attribute__ ((__nonstring)) doesn't work in a number of the places patched here, (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643) so if you have recent glibc headers installed you'll need to configure binutils with --disable-werror to compile using gcc8 or gcc9. include/ * ansidecl.h: Import from gcc. * coff/internal.h (struct internal_scnhdr): Add ATTRIBUTE_NONSTRING to s_name. (struct internal_syment): Add ATTRIBUTE_NONSTRING to _n_name. bfd/ * elf-linux-core.h (struct elf_external_linux_prpsinfo32_ugid32), (struct elf_external_linux_prpsinfo32_ugid16), (struct elf_external_linux_prpsinfo64_ugid32), (struct elf_external_linux_prpsinfo64_ugid16): Add ATTRIBUTE_NONSTRING to pr_fname and pr_psargs fields. Remove GCC diagnostic pragmas. Move comment to.. * elf.c (elfcore_write_prpsinfo): ..here. Indent nested preprocessor directives. * elf32-arm.c (elf32_arm_nabi_write_core_note): Add ATTRIBUTE_NONSTRING to data. * elf32-ppc.c (ppc_elf_write_core_note): Likewise. * elf32-s390.c (elf_s390_write_core_note): Likewise. * elf64-s390.c (elf_s390_write_core_note): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise. * elf64-x86-64.c (elf_x86_64_write_core_note): Add GCC diagnostic pragmas. * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Use strnlen to avoid false positive gcc-8 warning. gas/ * config/obj-evax.c (shorten_identifier): Use memcpy in place of strncpy. * config/obj-macho.c (obj_mach_o_make_or_get_sect): Ensure segname and sectname fields are NUL terminated.
* [ARM] FDPIC: Implement Thumb-only PLT for FDPIC.Christophe Lyon2018-04-251-21/+43
| | | | | | | | | | | | | | | | | | | | | 2018-04-25 Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (elf32_arm_fdpic_thumb_plt_entry): New. (elf32_arm_plt_needs_thumb_stub_p): Handle thumb-only case. (elf32_arm_populate_plt_entry): Likewise. (elf32_arm_output_plt_map_1): Likewise. (elf32_arm_output_arch_local_syms): Likewise. ld/testsuite/ * arm-elf.exp: Execute the new FDPIC Thumb-only tests. * fdpic-main-m.d: New test. * fdpic-main-m.s: New. * fdpic-main-m.sym: New. * fdpic-shared-m.d: New test. * fdpic-shared-m.s: New. * fdpic-shared-m.sym: New.
* [ARM] FDPIC: Make _GLOBAL_OFFSET_TABLE_ a relative symbolChristophe Lyon2018-04-251-3/+3
| | | | | | | | | 2018-04-25 Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Handle _GLOBAL_OFFSET_TABLE_ in FDPIC mode.
* [ARM] FDPIC: Translate R_ARM_TARGET2 relocation into R_ARM_GOT32 relocation ↵Christophe Lyon2018-04-251-1/+3
| | | | | | | | | | | for FDPIC platform 2018-04-25 Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> bfd/ * elf32-arm.c (bfd_elf32_arm_set_target_params): Handle FDPIC case for R_ARM_TARGET2.