aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-01-01Automatic date update in version.inGDB Administrator1-1/+1
2016-12-31Create sdynrelro for elfn32 mips tooAlan Modra2-0/+5
* elfn32-mips.c (elf_backend_want_dynrelro): Define.
2016-12-31PRU BFD supportDimitar Dimitrov15-0/+1654
include/ * elf/common.h: Add PRU ELF. * elf/pru.h: New file. * opcode/pru.h: New file. * dis-asm.h (print_insn_pru): Declare. bfd/ * archures.c: Add bfd_arch_pru. * Makefile.am: Add PRU target. * config.bfd: Ditto. * configure.ac: Ditto. * elf-bfd.h (enum elf_target_id): Add PRU_ELF_DATA. * targets.c: Add pru_elf32_vec. * reloc.c: Add PRU relocations. * cpu-pru.c: New file. * elf32-pru.c: New file. * Makefile.in: Regenerate. * configure: Regenerate. * po/SRC-POTFILES.in: Regenerate. * bfd-in2.h: Regenerate * libbfd.h: Regenerate. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2016-12-31Automatic date update in version.inGDB Administrator1-1/+1
2016-12-30Automatic date update in version.inGDB Administrator1-1/+1
2016-12-29link_hash_copy_indirect and symbol flagsAlan Modra11-47/+63
A while ago HJ fixed PR ld/18720 with commit 6e33951ed, which, among other things, modified _bfd_elf_link_hash_copy_indirect to not copy ref_dynamic, ref_regular, ref_regular_nonweak, non_got_ref, needs_plt and pointer_equality_needed when setting up an indirect non-versioned symbol pointing to a non-default versioned symbol. I didn't notice at the time, but the pr18720 testcase fails on hppa-linux with "internal error, aborting at binutils-gdb-2.28/bfd/elf32-hppa.c:3933 in elf32_hppa_relocate_section". Now hppa-linux creates entries in the plt even for local functions, if they are referenced using plabel (function pointer) relocations. So needs_plt is set for foo when processing pr18720a.o. When the aliases in pr28720b.o are processed, we get an indirection from foo to foo@FOO, but don't copy needs_plt. Since foo@FOO is the "real" symbol that is used after that point, no plt entry is made for foo and we bomb when relocating the plabel. As shown by the hppa-linux scenario, needs_plt should be copied even for non-default versioned symbols. I believe all of the others ought to be copied too, with the exception of ref_dynamic. Not copying ref_dynamic is right because if a shared lib references "foo" it should not be satisfied by any non-default version "foo@FOO". * elflink.c (_bfd_elf_link_hash_copy_indirect): Only omit copying one flag, ref_dynamic, when versioned_hidden. * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Use same logic for copying weakdef flags. Copy plabel flag and merge tls_type. * elf32-i386.c (elf_i386_copy_indirect_symbol): Use same logic for copying weakdef flags. * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Likewise. * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise. * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise. * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise. * elf64-x86-64.c (elf_x86_64_copy_indirect_symbol): Likewise. Simplify.
2016-12-29Automatic date update in version.inGDB Administrator1-1/+1
2016-12-28Use dynrelro for symbols in relro sections tooAlan Modra2-0/+22
PR ld/20995 bfd/ * elflink.c (elf_link_add_object_symbols): Mark relro sections in dynamic objects SEC_READONLY. ld/ * testsuite/ld-elf/pr20995c.s: New test file. * testsuite/ld-elf/pr20995-2so.r: Likewise. * testsuite/ld-elf/elf.exp: Run it.
2016-12-28Automatic date update in version.inGDB Administrator1-1/+1
2016-12-27Automatic date update in version.inGDB Administrator1-1/+1
2016-12-26dynrelro section for read-only dynamic symbols copied into executableAlan Modra29-154/+521
Variables defined in shared libraries are copied into an executable's .bss section when code in the executable is non-PIC and thus would require dynamic text relocations to access the variable directly in the shared library. Recent x86 toolchains also copy variables into the executable to gain a small speed improvement. The problem is that if the variable was originally read-only, the copy in .bss is writable, potentially opening a security hole. This patch cures that problem by putting the copy in a section that becomes read-only after ld.so relocation, provided -z relro is in force. The patch also fixes a microblaze linker segfault on attempting to use dynamic bss variables. bfd/ PR ld/20995 * elf-bfd.h (struct elf_link_hash_table): Add sdynrelro and sreldynrelro. (struct elf_backend_data): Add want_dynrelro. * elfxx-target.h (elf_backend_want_dynrelro): Define. (elfNN_bed): Update initializer. * elflink.c (_bfd_elf_create_dynamic_sections): Create sdynrelro and sreldynrelro sections. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Place variables copied into the executable from read-only sections into sdynrelro. (elf32_arm_size_dynamic_sections): Handle sdynrelro. (elf32_arm_finish_dynamic_symbol): Select sreldynrelro for dynamic relocs in sdynrelro. (elf_backend_want_dynrelro): Define. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol) (elf32_hppa_size_dynamic_sections, elf32_hppa_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-i386.c (elf_i386_adjust_dynamic_symbol) (elf_i386_size_dynamic_sections, elf_i386_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-metag.c (elf_metag_adjust_dynamic_symbol) (elf_metag_size_dynamic_sections, elf_metag_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol) (microblaze_elf_size_dynamic_sections) (microblaze_elf_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol) (nios2_elf32_adjust_dynamic_symbol) (nios2_elf32_size_dynamic_sections) (elf_backend_want_dynrelro): As above. * elf32-or1k.c (or1k_elf_finish_dynamic_symbol) (or1k_elf_adjust_dynamic_symbol, or1k_elf_size_dynamic_sections) (elf_backend_want_dynrelro): As above. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol) (ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-s390.c (elf_s390_adjust_dynamic_symbol) (elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol) (elf32_tic6x_size_dynamic_sections) (elf32_tic6x_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol) (tilepro_elf_size_dynamic_sections) (tilepro_elf_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol) (ppc64_elf_size_dynamic_sections, ppc64_elf_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf64-s390.c (elf_s390_adjust_dynamic_symbol) (elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol) (elf_x86_64_size_dynamic_sections) (elf_x86_64_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol) (elfNN_aarch64_size_dynamic_sections) (elfNN_aarch64_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol) (riscv_elf_size_dynamic_sections, riscv_elf_finish_dynamic_symbol) (elf_backend_want_dynrelro): As above. * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol) (_bfd_mips_elf_size_dynamic_sections) (_bfd_mips_vxworks_finish_dynamic_symbol): As above. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol) (_bfd_sparc_elf_size_dynamic_sections) (_bfd_sparc_elf_finish_dynamic_symbol): As above. * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol) (tilegx_elf_size_dynamic_sections) (tilegx_elf_finish_dynamic_symbol): As above. * elf32-mips.c (elf_backend_want_dynrelro): Define. * elf64-mips.c (elf_backend_want_dynrelro): Define. * elf32-sparc.c (elf_backend_want_dynrelro): Define. * elf64-sparc.c (elf_backend_want_dynrelro): Define. * elf32-tilegx.c (elf_backend_want_dynrelro): Define. * elf64-tilegx.c (elf_backend_want_dynrelro): Define. * elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol): Tidy. (microblaze_elf_size_dynamic_sections): Handle sdynbss. * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Make use of linker shortcuts to dynamic sections rather than comparing names. Correctly set "got" flag. ld/ PR ld/20995 * testsuite/ld-arm/farcall-mixed-app-v5.d: Update to suit changed stub hash table traversal caused by section id increment. Accept the previous output too. * testsuite/ld-arm/farcall-mixed-app.d: Likewise. * testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise. * testsuite/ld-arm/farcall-mixed-lib.d: Likewise. * testsuite/ld-elf/pr20995a.s, * testsuite/ld-elf/pr20995b.s, * testsuite/ld-elf/pr20995.r: New test. * testsuite/ld-elf/elf.exp: Run it.
2016-12-26Put .dynbss and .rel.bss shortcuts in main elf hash tableAlan Modra24-487/+168
Also, create .rel{,a}.bss for PIEs on all targets, not just x86. * elf-bfd.h (struct elf_link_hash_table): Add sdynbss and srelbss. * elflink.c (_bfd_elf_create_dynamic_sections): Set them. Create .rel.bss/.rela.bss for executables, both PIE and non-PIE. * elf32-arc.c (struct elf_arc_link_hash_table): Delete srelbss. Use ELF hash table var throughout. * elf32-arm.c (struct elf32_arm_link_hash_table): Delete sdynbss and srelbss. Use ELF hash table vars throughout. * elf32-hppa.c (struct elf32_hppa_link_hash_table): Likewise. * elf32-i386.c (struct elf_i386_link_hash_table): Likewise. * elf32-metag.c (struct elf_metag_link_hash_table): Likewise. * elf32-microblaze.c (struct elf32_mb_link_hash_table): Likewise. * elf32-nios2.c (struct elf32_nios2_link_hash_table): Likewise. * elf32-or1k.c (struct elf_or1k_link_hash_table): Likewise. * elf32-ppc.c (struct ppc_elf_link_hash_table): Likewise. * elf32-s390.c (struct elf_s390_link_hash_table): Likewise. * elf32-tic6x.c (struct elf32_tic6x_link_hash_table): Likewise. * elf32-tilepro.c (struct tilepro_elf_link_hash_table): Likewise. * elf64-ppc.c (struct ppc_link_hash_table): Likewise. * elf64-s390.c (struct elf_s390_link_hash_table): Likewise. * elf64-x86-64.c (struct elf_x86_64_link_hash_table): Likewise. * elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Likewise. * elfnn-riscv.c (struct riscv_elf_link_hash_table): Likewise. * elfxx-mips.c (struct mips_elf_link_hash_table): Likewise. * elfxx-sparc.h (struct _bfd_sparc_elf_link_hash_table): Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c (struct tilegx_elf_link_hash_table): Likewise. * elf32-arc.c (arc_elf_create_dynamic_sections): Delete. (elf_backend_create_dynamic_sections): Use base ELF version. * elf32-microblaze.c (microblaze_elf_create_dynamic_sections): Delete. (elf_backend_create_dynamic_sections): Use base ELF version. * elf32-or1k.c (or1k_elf_create_dynamic_sections): Delete. (elf_backend_create_dynamic_sections): Use base ELF version. * elf32-s390.c (elf_s390_create_dynamic_sections): Delete. (elf_backend_create_dynamic_sections): Use base ELF version. * elf64-ppc.c (ppc64_elf_create_dynamic_sections): Delete. (elf_backend_create_dynamic_sections): Use base ELF version. * elf64-s390.c (elf_s390_create_dynamic_sections): Delete. (elf_backend_create_dynamic_sections): Use base ELF version. * elf32-tilepro.c (tilepro_elf_create_dynamic_sections): Remove extraneous tests. * elfnn-aarch64.c (elfNN_aarch64_create_dynamic_sections): Likewise. * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Likewise. * elfxx-tilegx.c (tilegx_elf_create_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_create_dynamic_sections): Don't create ".rel.bss" for executables. * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't create ".rela.bss" for executables. * elf32-nios2.c (nios2_elf32_create_dynamic_sections): Don't ignore return status from _bfd_elf_create_dynamic_sections.
2016-12-26Automatic date update in version.inGDB Administrator1-1/+1
2016-12-25Automatic date update in version.inGDB Administrator1-1/+1
2016-12-24Automatic date update in version.inGDB Administrator1-1/+1
2016-12-23MIPS/BFD: Remove EI_ABIVERSION 5 allocation for PT_GNU_STACK supportMaciej W. Rozycki2-3/+5
Revert commit 17733f5be961 ("Increment the ABIVERSION to 5 for MIPS objects with non-executable stacks.") and remove EI_ABIVERSION 5 allocation for PT_GNU_STACK support, which has not made it to glibc and will be reassigned. bfd/ * bfd/elfxx-mips.c (_bfd_mips_post_process_headers): Revert 2016-02-23 change and remove EI_ABIVERSION 5 support.
2016-12-24Call target specific add_symbols functionAlan Modra2-1/+6
This allows targets that have target specific code to add object symbols to make use of the generic archive handling. * linker.c (generic_link_check_archive_element): Call target bfd_link_add_symbols to add element symbols.
2016-12-24Remove "collect" forms of generic linker add symbols functionsAlan Modra4-102/+31
Nothing calls them and they were in the way of a bug fix. * linker.c (generic_link_add_symbols): Delete. Merge into.. (_bfd_generic_link_add_symbols): ..here. (generic_link_check_archive_element_no_collect): Delete. (generic_link_check_archive_element_collect): Likewise. (generic_link_add_object_symbols): Remove "collect" param. Update callers. (generic_link_add_symbol_list): Likewise. (generic_link_check_archive_element): Likewise. Call bfd_link_add_symbols rather than generic_link_add_object_symbols. * libbfd-in.h (_bfd_generic_link_add_symbols_collect): Delete. * libbfd.h: Regenerate.
2016-12-23hppa-linux-gnu-ranlib: libcpp.a: File format not recognizedAlan Modra4-20/+12
This stops an --enable-targets selection affecting the main target in regards to forcing 64-bit archives. It also means mips64 and s390x will revert to binutils-2.25 and binutils-2.26 behaviour of not forcing 64-bit archives at least in the common case when plugins were enabled. PR binutils/20464 PR binutils/14625 * configure.ac: Revert 2016-05-25 configure change setting want_64_bit_archive for mips64 and s390x. Revise USE_64_BIT_ARCHIVE description. * configure: Regenerate. * config.in: Regenerate.
2016-12-23Bump version to 2.28.51Tristan Gingold3-11/+16
bfd/ 2016-12-23 Tristan Gingold <gingold@adacore.com> * version.m4: Bump version to 2.28.51 * configure: Regenerate. binutils/ 2016-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2016-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gprof/ 2016-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2016-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2016-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
2016-12-23Regenerate pot files.Tristan Gingold2-703/+779
2016-12-22Automatic date update in version.inGDB Administrator1-1/+1
2016-12-22Don't make_bfd_vms_lib archive functions NULLAlan Modra3-16/+31
Contrary to the comment, they can in fact be called. * libbfd-in.h (_bfd_vms_lib_slurp_armap): Use _bfd_noarchive function. (_bfd_vms_lib_slurp_extended_name_table: Likewise. (_bfd_vms_lib_construct_extended_name_table: Likewise. (_bfd_vms_lib_truncate_arname: Likewise. (_bfd_vms_lib_write_armap: Likewise. (_bfd_vms_lib_read_ar_hdr: Likewise. (_bfd_vms_lib_write_ar_hdr: Likewise. * libbfd.h: Regenerate.
2016-12-21bfd: aarch64: fix word and arrdess size declaration in ilp32 modeYury Norov2-4/+11
ILP32 has 32-bit word and address, but currently they declared as 64-bit in bfd_aarch64_arch_ilp32, which breaks further logic of bfd. This patch fixes it. Glibc testsuite build with patched binutils shows that next tests stop to fail: iconvdata/mtrace-tst-loading iconvdata/tst-loading iconvdata/tst-tables localedata/mtrace-tst-leaks localedata/tst-leaks posix/tst-getaddrinfo4 posix/tst-getaddrinfo5 posix/tst-regex2
2016-12-21Automatic date update in version.inGDB Administrator1-1/+1
2016-12-20Re-work RISC-V gas flags: now we just support -mabi and -marchAndrew Waterman2-2/+7
We've decided to standardize on two flags for RISC-V: "-march" sets the target architecture (which determines which instructions can be generated), and "-mabi" sets the target ABI. We needed to rework this because the old flag set didn't support soft-float or single-float ABIs, and didn't support an x32-style ABI on RISC-V. Additionally, we've changed the behavior of the -march flag: it's now a lot stricter and only parses things we can actually understand. Additionally, it's now lowercase-only: the rationale is that while the RISC-V ISA manual specifies that ISA strings are case-insensitive, in Linux-land things are usually case-sensitive. Since this flag can be used to determine library paths, we didn't want to bake some case-insensitivity in there that would case trouble later. This patch implements these two new flags and removes the old flags that could conflict with these. There wasn't a RISC-V release before, so we want to just support a clean flag set. include/ * elf/riscv.h (EF_RISCV_SOFT_FLOAT): Don't define. (EF_RISCV_FLOAT_ABI, EF_RISCV_FLOAT_ABI_SOFT): Define. (EF_RISCV_FLOAT_ABI_SINGLE, EF_RISCV_FLOAT_ABI_DOUBLE): Define. (EF_RISCV_FLOAT_ABI_QUAD): Define. bfd/ * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Use EF_RISCV_FLOAT_ABI_SOFT instead of EF_RISCV_SOFT_FLOAT. binutils/ * readelf.c (get_machine_flags): Use EF_RISCV_FLOAT_ABI_{SOFT,SINGLE,DOBULE,QUAD) instead of EF_RISCV_{SOFT,HARD}_FLOAT. gas/ * config/tc-riscv.h (xlen): Delete. * config/tc-riscv.c (xlen): Make static. (abi_xlen): New variable. (options): Replace OPTION_{M32,M64,MSOFT_FLOAT,MHARD_FLOAT,MRVC} with OPTION_MABI. (md_longopts): Likewise. (md_parse_option): Likewise. (riscv_elf_final_processing): Likewise. * doc/as.texinfo (Target RISC-V options): Likewise. * doc/c-riscv.texi (OPTIONS): Likewise. * config/tc-riscv.c (float_mode): Removed. (float_abi): New type, specifies the floating-point ABI. (riscv_set_abi): New function. (riscv_add_subset): Only allow lower-case ISA names and require them to start with "rv". (riscv_after_parse_args): Likewise. opcodes/ * riscv-dis.c (riscv_disassemble_insn): Default to the ELF's XLEN when none is provided.
2016-12-20Fix an integer overflow in RISC-V relocation handlingAndrew Waterman2-2/+7
* elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma instead of unsigned int.
2016-12-20Rework RISC-V relocationsAndrew Waterman6-17/+274
Before this commit we didn't cleanly support CFI directives because the internal offsets used to get relaxed which broke them. This patch significantly reworks how we handle linker relaxations: * DWARF is now properly supported * There is a ".option norelax" to disable relaxations, for when users write assembly that can't be relaxed (if it's to be later patched up, for example). * There is an additional _RELAX relocation that specifies when previous relocations can be relaxed. We're in the process of documenting the RISC-V ELF ABI, which will include documentation of our relocations https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md but we expect that this relocation set will remain ABI compatible in the future (ie, it's safe to release). Thanks to Kuan-Lin Chen for figuring out how to correctly relax the debug info! include/ * elf/riscv.h: Add R_RISCV_TPREL_I through R_RISCV_SET32. bfd/ * reloc.c (BFD_RELOC_RISCV_TPREL_I): New relocation. (BFD_RELOC_RISCV_TPREL_S): Likewise. (BFD_RELOC_RISCV_RELAX): Likewise. (BFD_RELOC_RISCV_CFA): Likewise. (BFD_RELOC_RISCV_SUB6): Likewise. (BFD_RELOC_RISCV_SET8): Likewise. (BFD_RELOC_RISCV_SET8): Likewise. (BFD_RELOC_RISCV_SET16): Likewise. (BFD_RELOC_RISCV_SET32): Likewise. * elfnn-riscv.c (perform_relocation): Handle the new relocations. (_bfd_riscv_relax_tls_le): Likewise. (_bfd_riscv_relax_align): Likewise. (_bfd_riscv_relax_section): Likewise. (howto_table): Likewise. (riscv_reloc_map): Likewise. (relax_func_t): New type. (_bfd_riscv_relax_call): Add reserve_size argument, which controls the maximal offset pessimism. Correct type of max_alignment. (_bfd_riscv_relax_lui): Likewise. (_bfd_riscv_relax_tls_le): Likewise. (_bfd_riscv_relax_align): Likewise. (_bfd_riscv_relax_section): Compute the required reserve size when relocating and use it to when calling relax_func. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. gas/ * config/tc-riscv.c (riscv_set_options): Add relax. (riscv_opts): Likewise. (s_riscv_option): Add relax and norelax. (riscv_apply_const_reloc): New function. (append_insn): Move constant relocation handling to riscv_apply_const_reloc. (md_pcrel_from): Likewise. (parse_relocation): Skip BFD_RELOC_UNUSED. (md_pcrel_from): Handle BFD_RELOC_RISCV_SUB6, BFD_RELOC_RISCV_RELAX, BFD_RELOC_RISCV_CFA. (md_apply_fix): Likewise. (riscv_pre_output_hook): New function. * config/tc-riscv.h (md_pre_output_hook): Define. (riscv_pre_output_hook): Declare. (DWARF_CIE_DATA_ALIGNMENT): Always -4.
2016-12-20Formatting changes for RISC-VAndrew Waterman3-24/+26
This is a mixed bag of format changes: * Replacing constants with macros (0xffffffff with MINUS_ONE, for example). There's one technically functional change in here (some MINUS_ONEs are changed to 0), but it only changes the behavior of an otherwise-unused field. * Using 0 instead of 0x0 in the relocation table. * There were some missing spaces before parens, the spaces have been added. * A handful of comments are now more descriptive. * A bunch of whitespace-only changes, mostly alignment and brace newlines. bfd/ * elfnn-riscv.c: Formatting and comment fixes throughout. * elfxx-riscv.c: Likewise. (howto_table): Change the src_mask field from MINUS_ONE to 0 for R_RISCV_TLS_DTPMOD32, R_RISCV_TLS_DTPMOD64, R_RISCV_TLS_DTPREL32, R_RISCV_TLS_DTPREL64, R_RISCV_TLS_TPREL32, R_RISCV_TLS_TPREL64. opcodes/ * riscv-opc.c: Formatting fixes. gas/ * config/tc-riscv.c: Formatting and comment fixes throughout.
2016-12-20Improve RISC-V LD error messagePalmer Dabbelt2-2/+8
I recently ran into this error message and found it's not helpful: it just tells me some temporary file can't be linked. This slightly improved one at least tells me it's because of an elf32/elf64 conflict. * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Improve error message when linking elf32 and elf64.
2016-12-20Automatic date update in version.inGDB Administrator1-1/+1
2016-12-19bfd/elf32-arm.c: Rename 'popcount' to 'elf32_arm_popcount'Christian Groessler2-7/+13
bfd/elf32_arm.c contains a function 'popcount' which conflicts with a function of the same name in NetBSD's libc. This change also changes popcount's 'sum' variable to signed since the function returns a signed integer. bfd/ * elf32-arm.c (elf32_arm_popcount): Rename from 'popcount'. Make 'sum' local variable signed.
2016-12-19Automatic date update in version.inGDB Administrator1-1/+1
2016-12-18Automatic date update in version.inGDB Administrator1-1/+1
2016-12-17Automatic date update in version.inGDB Administrator1-1/+1
2016-12-16Implement and document --gc-keep-exportedfincs2-1/+8
include/ * bfdlink.h (struct bfd_link_info): Add gc_keep_exported. bfd/ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Add handling for info->gc_keep_exported. (bfd_elf_gc_sections): Likewise. ld/ * ld.texinfo: Document --gc-keep-exported. * ldlex.h (enum option_values): Add OPTION_GC_KEEP_EXPORTED. * lexsup.c (parse_args): Add handling for --gc-keep-exported.
2016-12-16Automatic date update in version.inGDB Administrator1-1/+1
2016-12-15Linking non-ELF file broken by PR20908 fixAlan Modra2-28/+30
PR ld/20968 PR ld/20908 * elflink.c (bfd_elf_final_link): Revert 2016-12-02 change. Move reloc counting code later after ELF flavour test.
2016-12-15Automatic date update in version.inGDB Administrator1-1/+1
2016-12-14MIPS/opcodes: Also set disassembler's ASE flags from ELF structuresMaciej W. Rozycki4-0/+25
Respect any ASE flags recorded in ELF file structures for the purpose of selecting instructions to be disassembled, preventing code from being hex-dumped even though having been clearly indicated as valid at the assembly time. Use date from the MIPS ABI flags structure if present, and otherwise there may be an MDMX ASE flag set in the ELF file header. For backwards compatibility only set extra flags and do not clear any, preserving all previously set by the architecture selected to be disassembled for. include/ * elf/mips.h (Elf_Internal_ABIFlags_v0): Also declare struct typedef as `elf_internal_abiflags_v0'. bfd/ * bfd-in.h (elf_internal_abiflags_v0): New struct declaration. (bfd_mips_elf_get_abiflags): New prototype. * elfxx-mips.c (bfd_mips_elf_get_abiflags): New function. * bfd-in2.h: Regenerate. opcodes/ * mips-dis.c (mips_convert_abiflags_ases): New function. (set_default_mips_dis_options): Also infer ASE flags from ELF file structures. binutils/ * testsuite/binutils-all/mips/mips-ase-1.d: New test. * testsuite/binutils-all/mips/mips-ase-2.d: New test. * testsuite/binutils-all/mips/mips-ase-3.d: New test. * testsuite/binutils-all/mips/mips-ase-1.s: New test source. * testsuite/binutils-all/mips/mips-ase-2.s: New test source. * testsuite/binutils-all/mips/mips.exp: Run the new tests.
2016-12-14ld: aarch64: fix TLS relaxation where TCB_SIZE is usedYury Norov2-5/+20
TCB_SIZE is 2*sizeof(void *), which is 0x10 for lp64, and 0x8 for ilp32. During relaxation, ld goes to do a replace: bl __tls_get_addr => add R0, R0, TCB_SIZE But actual implementation is: bfd_putl32 (0x91004000, contents + rel->r_offset + 4); Which is equivalent of add x0, x0, 0x10. This is wrong for ilp32. The possible fix for it is: bfd_putl32 (0x91000000 | (TCB_SIZE<<10), contents + rel->r_offset + 4); But ilp32 also needs w-registers, so it's simpler to put proper instruction in #if/#else condition. There are 2 such relaxations in elfNN_aarch64_tls_relax(), and so 2 new tests added for ilp32 mode to test it. Yury * bfd/elfnn-aarch64.c: fix TLS relaxations for ilp32 where TCB_SIZE is used. * ld/testsuite/ld-aarch64/aarch64-elf.exp: Add tests for the case. * ld/testsuite/ld-aarch64/tls-relax-ld-le-small-ilp32.d: New file. * ld/testsuite/ld-aarch64/tls-relax-ld-le-tiny-ilp32.d: New file. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
2016-12-14Revert "bfd: aarch64: fix word and arrdess size declaration in ilp32 mode"Yury Norov1-4/+4
This reverts commit a02c3512655cc2c8ad68e4b656959b7d284acc7d.
2016-12-14Revert "ld: aarch64: fix TLS relaxation where TCB_SIZE is used"Yury Norov1-15/+3
This reverts commit 6650f7bd18f8161b9f666d3e65a6346e23a9d85f.
2016-12-14bfd: aarch64: fix word and arrdess size declaration in ilp32 modeYury Norov1-4/+4
2016-12-14ld: aarch64: fix TLS relaxation where TCB_SIZE is usedYury Norov1-3/+15
TCB_SIZE is 2*sizeof(void *), which is 0x10 for lp64, and 0x8 for ilp32. During relaxation, ld goes to do a replace: bl __tls_get_addr => add R0, R0, TCB_SIZE But actual implementation is: bfd_putl32 (0x91004000, contents + rel->r_offset + 4); Which is equivalent of add x0, x0, 0x10. This is wrong for ilp32. The possible fix for it is: bfd_putl32 (0x91000000 | (TCB_SIZE<<10), contents + rel->r_offset + 4); But ilp32 also needs w-registers, so it's simpler to put proper instruction in #if/#else condition. THere are 2 such relaxations in elfNN_aarch64_tls_relax(), and so 2 new tests added for ilp32 mode to test it. Yury
2016-12-14Automatic date update in version.inGDB Administrator1-1/+1
2016-12-13Automatic date update in version.inGDB Administrator1-1/+1
2016-12-13Don't add PHDR for objcopy/strip or ld script specifying PHDRSAlan Modra2-23/+19
HPPA64 needs to add a DT_PHDR header for shared libs. That's fine when linking but shouldn't happen for strip/objcopy. Also PHDR must come first so there's no need to look at all program headers. bfd/ * elf64-hppa.c (elf64_hppa_modify_segment_map): Don't add PHDR for objcopy/strip or when a ld script specifies PHDRS. ld/ * testsuite/ld-elf/nobits-1.d: Remove xfail for hppa64. * testsuite/ld-elf/note-1.d: Likewise. * testsuite/ld-elf/note-2.d: Likewise.
2016-12-13Don't fudge p_vaddr when PHDR in segmentAlan Modra2-1/+20
RX does horrible fudges to PT_LOAD p_vaddr, that affect the testsuite and mean the target won't support dynamic objects. The latter probably doesn't matter too much since RX is an embedded target, but it's easy to stop some of the fudges in order to reduce special cases for RX in the testsuite. The changes make sense in isolation too. bfd/ * elf32-rx.c (elf32_rx_modify_program_headers): Don't adjust segments that include the ELF file header or program headers. ld/ * testsuite/ld-elf/flags1.d: Run for RX. * testsuite/ld-scripts/phdrs.exp: Likewise. * testsuite/ld-scripts/pr14962.d: Likewise. * testsuite/ld-scripts/pr14962-2.d: Likewise.
2016-12-12Automatic date update in version.inGDB Administrator1-1/+1