aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2018-07-24PR23430, Indices misspelledAlan Modra3-3/+9
PR 23430 include/ * elf/common.h (SHT_SYMTAB_SHNDX): Fix comment typo. bfd/ * dwarf2.c (dwarf_debug_section_enum): Fix comment typo. * elf.c (bfd_section_from_shdr, elf_sort_sections): Likewise. binutils/ * elfcomm.h (struct archive_info): Rename uses_64bit_indicies to uses_64bit_indices. * elfcomm.c (setup_archive): Update uses of above. * readelf.c (process_archive): Likewise. (get_section_type_name): Rename indicies to indices. (get_32bit_elf_symbols, get_64bit_elf_symbols): Likewise. (process_section_groups): Likewise. cpu/ * or1kcommon.cpu (spr-reg-indices): Fix description typo. opcodes/ * or1k-desc.h: Regenerate.
2018-07-24Automatic date update in version.inGDB Administrator1-1/+1
2018-07-23xtensa: move dynamic relocations sections consistency checkMax Filippov2-11/+18
The function elf_xtensa_finish_dynamic_sections checks that sizes of sections .rela.dyn and .rela.plt match number of corresponding relocation records, but the check is only done when .rela.plt is non-empty, so, e.g. it is never run for the static PIE. Rearrange the test so that .rela.dyn and .rela.plt are checked always. bfd/ 2018-07-23 Max Filippov <jcmvbkbc@gmail.com> * elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move relocation sections consistency check to always check both .rela.dyn and .rela.plt when they exist. Rearrange variable definition and assignment places.
2018-07-23xtensa: fix relaxation of undefined weak references in shared objectsMax Filippov2-1/+8
The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak undefined symbol") didn't properly handle shrinking of relocation sections due to coalescing of references to a dynamic undefined weak symbol in a shared object, which resulted in the following assertion failure in ld when linking uClibc-ng libthread_db for xtensa: BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269 in elf_xtensa_finish_dynamic_sections Shrink dynamic relocations section for dynamic undefined weak symbols when linking a shared object. bfd/ 2018-07-23 Max Filippov <jcmvbkbc@gmail.com> * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic relocations section for dynamic undefined weak symbols when linking a shared object.
2018-07-23Avoid ubsan complaint in BFDTom Tromey2-2/+7
I built gdb with ubsan and ran the test suite. One complaint was due to bfd_get_elf_phdrs passing NULL to memcpy. This patch avoids the complaint. bfd/ChangeLog 2018-07-23 Tom Tromey <tom@tromey.com> * elf.c (bfd_get_elf_phdrs): Don't call memcpy with size 0.
2018-07-23S/390: Suppress string diagnostics for pre-release GCCAndreas Krebbel2-4/+4
Building for S/390 currently fails when using a GCC 8.1 pre-release version like 8.0.1 (as it is used by F28). Fixed with the attached patch. bfd/ChangeLog: 2018-07-23 Andreas Krebbel <krebbel@linux.ibm.com> * elf32-s390.c (elf_s390_write_core_note): Make GCC version 8.0 to be covered by the check as well. * elf64-s390.c (elf_s390_write_core_note): Likewise.
2018-07-23Automatic date update in version.inGDB Administrator1-1/+1
2018-07-22Automatic date update in version.inGDB Administrator1-1/+1
2018-07-21Initialize GOT slot for local symbol in non-PIC link.Eric Botcazou2-28/+45
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.
2018-07-21Automatic date update in version.inGDB Administrator1-1/+1
2018-07-20x86: Add a GNU_PROPERTY_X86_ISA_1_USED note if neededH.J. Lu2-15/+53
When -z separate-code, which is enabled by default for Linux/x86, is used to create executable, ld won't place any data in the code-only PT_LOAD segment. If there are no data sections placed before the code-only PT_LOAD segment, the program headers won't be mapped into any PT_LOAD segment. When the executable tries to access it (based on the program header address passed in AT_PHDR), it will lead to segfault. This patch inserts a GNU_PROPERTY_X86_ISA_1_USED note if there may be no data sections before the text section so that the first PT_LOAD segment won't be code-only and will contain the program header. Testcases are adjusted to either pass "-z noseparate-code" to ld or discard the .note.gnu.property section. A Linux/x86 run-time test is added. bfd/ PR ld/23428 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): If the separate code program header is needed, make sure that the first read-only PT_LOAD segment has no code by adding a GNU_PROPERTY_X86_ISA_1_USED note. ld/ PR ld/23428 * testsuite/ld-elf/linux-x86.S: New file. * testsuite/ld-elf/linux-x86.exp: Likewise. * testsuite/ld-elf/pr23428.c: Likewise. * testsuite/ld-elf/sec64k.exp: Pass "-z noseparate-code" to ld for Linux/x86 targets. * testsuite/ld-i386/abs-iamcu.d: Likewise. * testsuite/ld-i386/abs.d: Likewise. * testsuite/ld-i386/pr12718.d: Likewise. * testsuite/ld-i386/pr12921.d: Likewise. * testsuite/ld-x86-64/abs-k1om.d: Likewise. * testsuite/ld-x86-64/abs-l1om.d: Likewise. * testsuite/ld-x86-64/abs.d: Likewise. * testsuite/ld-x86-64/pr12718.d: Likewise. * testsuite/ld-x86-64/pr12921.d: Likewise. * testsuite/ld-linkonce/zeroeh.ld: Discard .note.gnu.property section. * testsuite/ld-scripts/print-memory-usage.t: Likewise. * testsuite/ld-scripts/size-2.t: Likewise. * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use ld to create executable if language is "asm".
2018-07-20MIPS/GAS: Split Loongson MMI Instructions from loongson2f/3aChenghua Xu2-0/+7
The MMI instruction set has been implemented in many Loongson processors. There is a lot of software optimized for MMI. This patch splits MMI from loongson2f/3a, and adds GAS and disassembler options for MMI instructions. 2018-07-20 Chenghua Xu <paul.hua.gm@gmail.com> Maciej W. Rozycki <macro@mips.com> bfd/ * elfxx-mips.c (print_mips_ases): Add MMI extension. binutils/ * readelf.c (print_mips_ases): Add MMI extension. gas/ * NEWS: Mention MultiMedia extensions Instructions (MMI) support. * config/tc-mips.c (options): Add OPTION_LOONGSON_MMI and OPTION_NO_LOONGSON_MMI. (md_longopts): Likewise. (mips_ases): Define availability for MMI. (mips_convert_ase_flags): Map ASE_LOONGSON_MMI to AFL_ASE_LOONGSON_MMI. (mips_cpu_info_table): Add ASE_LOONGSON_MMI for loongson2f/3a. (md_show_usage): Add help for -mloongson-mmi and -mno-loongson-mmi. * doc/as.texi: Document -mloongson-mmi, -mno-loongson-mmi. * doc/c-mips.texi: Document -mloongson-mmi, -mno-loongson-mmi, .set loongson-mmi and .set noloongson-mmi. * testsuite/gas/mips/loongson-2f.d: Move mmi test to ... * testsuite/gas/mips/loongson-2f-mmi.d: Here. Add ISA/ASE flag verification. * testsuite/gas/mips/loongson-2f.s: Move mmi test to ... * testsuite/gas/mips/loongson-2f-mmi.s: Here. * testsuite/gas/mips/loongson-3a.d: Move mmi test to ... * testsuite/gas/mips/loongson-3a-mmi.d: Here. Add ISA/ASE flag verification. * testsuite/gas/mips/loongson-3a.s: Move mmi test to ... * testsuite/gas/mips/loongson-3a-mmi.s: Here. * testsuite/gas/mips/mips.exp: Run loongson-2f-mmi and loongson-3a-mmi tests. include/ * elf/mips.h (AFL_ASE_MMI): New macro. (AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_MMI. * opcode/mips.h (ASE_LOONGSON_MMI): New macro. opcodes/ * mips-dis.c (mips_arch_choices): Add MMI to loongson2f and loongson3a descriptors. (parse_mips_ase_option): Handle -M loongson-mmi option. (print_mips_disassembler_options): Document -M loongson-mmi. * mips-opc.c (LMMI): New macro. (mips_opcodes): Replace IL2F|IL3A marking with LMMI for MMI instructions.
2018-07-20MIPS/LD: Fix crashing with a discarded dynamic relocation sectionMaciej W. Rozycki2-1/+11
Fix a crash that occurs in `_bfd_mips_elf_finish_dynamic_sections' if a dynamic relocation section has been created, but marked to be discarded by an assignment to the /DISCARD/ output section in a linker script. In that case the output section is the absolute section, which has no ELF section data attached, so trying to set its `sh_size' parameter causes a null pointer dereference. This is only done as the value for the DT_RELSZ dynamic entry is being set, so fix the problem by not creating DT_REL, DT_RELSZ or DT_RELENT dynamic entries in the first place if the dynamic relocation section will not be output, as with no dynamic relocation data present these would not serve their purpose anyway. Add a generic ELF test case to verify that no dynamic relocation data is reported in the dynamic segment. bfd/ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Do not create DT_REL, DT_RELSZ or DT_RELENT dynamic entries if the dynamic relocation section will be discarded from output. (_bfd_mips_elf_finish_dynamic_sections) <DT_RELSZ>: Assert that the dynamic relocation section will be retained in output. ld/ * testsuite/ld-elf/reloc-discard.d: New test. * testsuite/ld-elf/reloc-discard.ld: New test linker script. * testsuite/ld-elf/reloc-discard.s: New test source.
2018-07-20Automatic date update in version.inGDB Administrator1-1/+1
2018-07-19Automatic date update in version.inGDB Administrator1-1/+1
2018-07-18BFD/XCOFF: Fix storage class setting for weak defined symbolsMaciej W. Rozycki2-2/+7
Fix an issue with commit 8602d4fea60d ("Add AIX weak support"), <https://sourceware.org/ml/binutils/2009-03/msg00189.html>, and use the correct condition to set the storage class for weak defined symbols. The context here is as follows: else if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && h->smclas == XMC_XO) { BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section)); isym.n_value = h->root.u.def.value; isym.n_scnum = N_UNDEF; if (h->root.type == bfd_link_hash_undefweak && C_WEAKEXT == C_AIX_WEAKEXT) isym.n_sclass = C_WEAKEXT; else isym.n_sclass = C_EXT; aux.x_csect.x_smtyp = XTY_ER; } so clearly the inner condition can never be true. Correct the condition then to check for the `bfd_link_hash_defweak' symbol type instead here, and in a similar place a little further down in the same function. bfd/ * xcofflink.c (xcoff_write_global_symbol): Fix symbol type checks for defined weak symbols.
2018-07-18S/390: Improve partial relro support for 64 bitAndreas Krebbel2-59/+165
Currently on S/390 the .got.plt always comes first which prevents the GNU_RELRO segment from being extended across the non-plt GOT entries. Just swapping both unfortunately is not that simple since our ABI requires the _GLOBAL_OFFSET_TABLE_ symbol to point to the very beginning of the entire GOT. Of the 3 magic GOT entries the first is accessed via got pointer while second and third are being accessed via DT_PLTGOT. In order to keep them together we make DT_PLTGOT to point to the .got instead of .got.plt. However, this violates an assumption in the dynamic linker prelink undo code about the GOTPLT entries starting at DT_PLTGOT + 3. We got rid of this requirement with a Glibc patch already in version 2.24: https://sourceware.org/ml/libc-alpha/2016-06/msg01302.html So the S/390 relro GOT layout will look like this with this patch: +----------------------------------+ |got[0]: DYNAMIC | <--- _GLOBAL_OFFSET_TABLE_ == DT_PLTGOT .got |got[1]: link_map parm | |got[2]: &_dl_runtime_resolve | +----------------------------------+ | | non-plt GOT entries | | | | +----------------------------------+ | | <--- .gotplt, PLT GOT entries | | | | | | +----------------------------------+ The patch detects the current layout in size_dynamic_section in order to deal also with linker scripts not generated by this ld version. With partial relro enabled we pick a linker script where .got and .got.plt are swapped which then triggers the rest of the logic. ld/ChangeLog: 2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com> * emulparams/elf64_s390.sh: Define GENERATE_RELRO_SCRIPT and SEPARATE_GOTPLT. * testsuite/ld-s390/gotreloc_64-relro-1.dd: New test. * testsuite/ld-s390/gotreloc_64-norelro-1.dd: Renamed from ... * testsuite/ld-s390/gotreloc_64-1.dd: ... this. * testsuite/ld-s390/s390.exp: Split the GOT testcase into two. bfd/ChangeLog: 2018-07-18 Andreas Krebbel <krebbel@linux.ibm.com> * elf-s390-common.c (s390_gotplt_after_got_p): New function. (s390_got_pointer): New function. (s390_got_offset): New function. (s390_gotplt_offset): New function. * elf64-s390.c (allocate_dynrelocs): Adjust comment. (elf_s390_size_dynamic_sections): Move space for magic GOT entries from .got.plt to .got if necessary and pick the right location for _GLOBAL_OFFSET_TABLE_. (elf_s390_relocate_section): Use the wrapper functions from elf-s390-common.c to deal with both possible layouts (either .got or .got.plt first). (elf_s390_finish_dynamic_sections): Likewise. (elf_s390_finish_dynamic_symbol): Make the location of the GOT magic entries conditional.
2018-07-18Automatic date update in version.inGDB Administrator1-1/+1
2018-07-17BFD: Use `bfd_is_abs_symbol' to determine whether a symbol is absoluteMaciej W. Rozycki4-12/+19
Use `bfd_is_abs_symbol' to determine whether a symbol is absolute, avoiding a problem with ordinary symbols defined in a linker script outside an output section definition. Such symbols have its owning section set to the absolute section up to the final link phase. A flag has been added to the link hash to identify such symbols. Rather than checking the flag by hand, use the macro that does it uniformly for all users. bfd/ * elf32-nds32.c (nds32_elf_relax_loadstore): Use `bfd_is_abs_symbol' rather than `bfd_is_abs_section' in checking whether the symbol is absolute. (nds32_elf_relax_lo12): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_check_relocs): Likewise. * xcofflink.c (xcoff_need_ldrel_p): Likewise. (bfd_xcoff_import_symbol): Likewise. (xcoff_write_global_symbol): Likewise.
2018-07-17LD: Export relative-from-absolute symbol marking to BFDMaciej W. Rozycki3-1/+30
It is usually possible to tell absolute and ordinary symbols apart in BFD throughout the link, by checking whether the section that owns the symbol is absolute or not. That however does not work for ordinary symbols defined in a linker script outside an output section statement. Initially such symbols are entered into to the link hash as absolute symbols, owned by the absolute section. A flag is set in the internal linker expression defining such symbols to tell the linker to convert them to section-relative ones in the final phase of the link. That flag is however not accessible to BFD linker code, including BFD target code in particular. Add a flag to the link hash then to copy the information held in the linker expression. Define a macro, `bfd_is_abs_symbol', for BFD code to use where determining whether a symbol is absolute or ordinary is required before the final link phase. This macro will correctly identify the special `__ehdr_start' symbol as ordinary throughout link, for example, even though early on it will be assigned to the absolute section. Of course this does not let BFD code identify what the symbol's ultimate section will be before the final link phase has converted this symbol (in `update_definedness'). include/ * bfdlink.h (bfd_link_hash_entry): Add `rel_from_abs' member. bfd/ * linker.c (bfd_is_abs_symbol): New macro. * bfd-in2.h: Regenerate. ld/ * ldexp.c (exp_fold_tree_1) <etree_assign, etree_provide> <etree_provided>: Copy expression's `rel_from_abs' flag to the link hash.
2018-07-17Automatic date update in version.inGDB Administrator1-1/+1
2018-07-16Add grok/write functions for new ppc core note sectionsEdjunior Barbosa Machado3-0/+421
This patch adds functions for grokking and writing more register core note sections (NT_PPC_TAR, NT_PPC_PPR, NT_PPC_DSCR, NT_PPC_EBB, NT_PPC_PMU, NT_PPC_TM_CGPR, NT_PPC_TM_CFPR, NT_PPC_TM_CVMX, NT_PPC_TM_CVSX, NT_PPC_TM_SPR, NT_PPC_TM_CTAR, NT_PPC_TM_CPPR, NT_PPC_TM_CDSCR). 2018-07-16 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> bfd/ * elf-bfd.h (elfcore_write_ppc_tar): Add prototype. (elfcore_write_ppc_ppr): Likewise. (elfcore_write_ppc_dscr): Likewise. (elfcore_write_ppc_ebb): Likewise. (elfcore_write_ppc_pmu): Likewise. (elfcore_write_ppc_tm_cgpr): Likewise. (elfcore_write_ppc_tm_cfpr): Likewise. (elfcore_write_ppc_tm_cvmx): Likewise. (elfcore_write_ppc_tm_cvsx): Likewise. (elfcore_write_ppc_tm_spr): Likewise. (elfcore_write_ppc_tm_ctar): Likewise. (elfcore_write_ppc_tm_cppr): Likewise. (elfcore_write_ppc_tm_cdscr): Likewise. * elf.c (elfcore_write_ppc_tar): New function. (elfcore_write_ppc_ppr): Likewise. (elfcore_write_ppc_dscr): Likewise. (elfcore_write_ppc_ebb): Likewise. (elfcore_write_ppc_pmu): Likewise. (elfcore_write_ppc_tm_cgpr): Likewise. (elfcore_write_ppc_tm_cfpr): Likewise. (elfcore_write_ppc_tm_cvmx): Likewise. (elfcore_write_ppc_tm_cvsx): Likewise. (elfcore_write_ppc_tm_spr): Likewise. (elfcore_write_ppc_tm_ctar): Likewise. (elfcore_write_ppc_tm_cppr): Likewise. (elfcore_write_ppc_tm_cdscr): Likewise. (elfcore_write_register_note): Call them. (elfcore_grok_ppc_tar): New function. (elfcore_grok_ppc_ppr): Likewise. (elfcore_grok_ppc_dscr): Likewise. (elfcore_grok_ppc_ebb): Likewise. (elfcore_grok_ppc_pmu): Likewise. (elfcore_grok_ppc_tm_cgpr): Likewise. (elfcore_grok_ppc_tm_cfpr): Likewise. (elfcore_grok_ppc_tm_cvmx): Likewise. (elfcore_grok_ppc_tm_cvsx): Likewise. (elfcore_grok_ppc_tm_spr): Likewise. (elfcore_grok_ppc_tm_ctar): Likewise. (elfcore_grok_ppc_tm_cppr): Likewise. (elfcore_grok_ppc_tm_cdscr): Likewise. (elfcore_grok_note): Call them.
2018-07-16Automatic date update in version.inGDB Administrator1-1/+1
2018-07-15Automatic date update in version.inGDB Administrator1-1/+1
2018-07-14Automatic date update in version.inGDB Administrator1-1/+1
2018-07-13Automatic date update in version.inGDB Administrator1-1/+1
2018-07-12Automatic date update in version.inGDB Administrator1-1/+1
2018-07-11MIPS/BFD: Fix TLS relocation resolution for regular executablesMaciej W. Rozycki2-12/+18
Correct an issue with commit 0f20cc3522e7 ("TLS support for MIPS"), <https://sourceware.org/ml/binutils/2005-02/msg00607.html>, where a condition used to determine whether to use a dynamic symbol for GD, LD and IE TLS dynamic relocations against a symbol that has been defined locally has been incorrectly reversed. It's executables rather than dynamic shared objects where no symbol is required, because such symbols cannot be preempted and therefore their values (thread pointer offsets) are fixed at the static link time as is the associated module ID of the main executable, so the original condition should have been `shared' instead of `!shared'. This wrong condition was then later converted from `!shared' to `!bfd_link_pic', with commit 0e1862bb401f ("Add output_type to bfd_link_info"). Use the correct `bfd_link_dll' condition then, and adjust code for the dynamic symbol index possibly being -1 as with symbols that have been forced local, removing unnecessary dynamic relocations from dynamic regular executables. PIE executables are unaffected as the existing condition excluded them by chance due to the conversion mentioned above. Adjust test cases accordingly. bfd/ * elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather than `!bfd_link_pic' in determining the dynamic symbol index. Avoid the index of -1. (mips_elf_initialize_tls_slots): Likewise. Flatten code by moving `dyn' to the beginning of the function block. ld/ * testsuite/ld-mips-elf/tlsdyn-o32.d: Update test for dynamic relocation removal. * testsuite/ld-mips-elf/tlsdyn-o32.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-1.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
2018-07-11PR ld/22570: MIPS/BFD: Fix TLS relocation resolution for PIE executablesMaciej W. Rozycki2-4/+13
Correct a commit 0e1862bb401f ("Add output_type to bfd_link_info") issue and use `bfd_link_dll' rather than `bfd_link_pic' in determining whether to fully resolve GD, LD and IE TLS relocations referring to symbols locally defined rather than deferring them to the load time by means of dynamic relocations. Such symbols cannot be preempted in PIE executables, which are necessarily PIC, and therefore their values (thread pointer offsets) are fixed at the static link time as is the associated module ID of the main executable. Given the `tlsbin-o32.s' and `tlsdyn-o32.s' sources from our test suite this removes the absolute TLS relocations from the static: DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE *ABS* 1000002c R_MIPS_TLS_TPREL32 *ABS* 10000030 R_MIPS_TLS_DTPMOD32 *ABS* 10000038 R_MIPS_TLS_DTPMOD32 *ABS* and the dynamic: DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE *ABS* 1000002c R_MIPS_TLS_TPREL32 *ABS* 10000038 R_MIPS_TLS_DTPMOD32 *ABS* 10000044 R_MIPS_TLS_DTPMOD32 *ABS* 10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd 10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd 10000040 R_MIPS_TLS_TPREL32 tlsvar_ie PIE executable respectively, as reported by `objdump -R', and fills the corresponding GOT slots with the values expected, as recorded with the test cases added. The new output from `objdump -R' is: DYNAMIC RELOCATION RECORDS (none) and: DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE *ABS* 10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd 10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd 10000040 R_MIPS_TLS_TPREL32 tlsvar_ie for the static and the dynamic executable respectively. 2018-07-11 Maciej W. Rozycki <macro@mips.com> Rich Felker <bugdal@aerifal.cx> bfd/ PR ld/22570 * elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather than `bfd_link_pic' to determine whether dynamic relocations are to be produced. (mips_elf_initialize_tls_slots): Likewise. ld/ PR ld/22570 * testsuite/ld-mips-elf/tlsbin-pie-o32.d: New test. * testsuite/ld-mips-elf/tlsbin-pie-o32.got: New test. * testsuite/ld-mips-elf/tlsdyn-pie-o32.d: New test. * testsuite/ld-mips-elf/tlsdyn-pie-o32.got: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2018-07-11Automatic date update in version.inGDB Administrator1-1/+1
2018-07-11BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCCMaciej W. Rozycki2-4/+9
Remove `-Wshadow' compilation errors: cc1: warnings being treated as errors .../bfd/elflink.c: In function 'bfd_elf_final_link': .../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration /usr/include/stdio.h:154: error: shadowed declaration is here which for versions of GCC before 4.8 prevent support for ELF targets from being built. See also GCC PR c/53066. bfd/ * elflink.c (bfd_elf_final_link): Rename `remove' local variable to `remove_section'.
2018-07-10xgate cleanupAlan Modra4-357/+41
elf32-xgate.c contains many functions that are only stubs and elf32-xgate.h contains unused declarations. While this might be reasonable for the initial commit of a port with subsequent work fleshing out the stubs, xgate has only had two minor target specific patches since the initial commit over six years ago. The rest of the changes have been general maintenance work applied to all ELF targets, and some of this work could have been avoided if the stubs hadn't been there. So this patch removes all the stubs. I've kept the functionality of the old elf32_xgate_add_symbol_hook, implemented in elf32_xgate_backend_symbol_processing. Presumably, that's to set the symbol st_target_internal flag for use in elf32-m68hc1x.c:elf32_m68hc11_relocate_section. The empty elf32_xgate_relocate_section meant that xgate had no linker. Or at least, no linker relocation processing. Deleting the elf_backend_relocate_section define means the target will now use the generic linker reloc processing. How good that is will depend on the accuracy of the reloc howtos.. I haven't updated the ld testsuite to xfail tests expected to fail for generic elf targets. bfd/ * elf32-xgate.h: Delete. * elf32-xgate.c: Delete unnecessary forward declarations, add two that are now needed. (xgate_elf_bfd_link_hash_table_create) (xgate_elf_bfd_link_hash_table_free) (xgate_elf_set_mach_from_flags, struct xgate_scan_param) (stub_hash_newfunc, elf32_xgate_add_symbol_hook) (elf32_xgate_setup_section_lists, elf32_xgate_size_stubs) (elf32_xgate_build_stubs, elf32_xgate_check_relocs) (elf32_xgate_relocate_section, _bfd_xgate_elf_set_private_flags) (elf32_xgate_post_process_headers): Delete. (elf32_xgate_backend_symbol_processing): New function. (xgate_elf_ignore_reloc, xgate_elf_special_reloc) (_bfd_xgate_elf_print_private_bfd_data): Make static. (ELF_TARGET_ID, elf_info_to_howto, elf_backend_check_relocs) (elf_backend_relocate_section, elf_backend_object_p) (elf_backend_final_write_processing, elf_backend_can_gc_sections) (elf_backend_post_process_headers, elf_backend_add_symbol_hook) (bfd_elf32_bfd_link_hash_table_create) (bfd_elf32_bfd_set_private_flags) (xgate_stub_hash_lookup): Don't define. (elf_backend_symbol_processing): Define. * elf-bfd.h (elf_target_id): Delete XGATE_ELF_DATA. ld/ * emulparams/xgateelf.sh (TEMPLATE_NAME) Set to generic. (EXTRA_EM_FILE): Set to genelf.
2018-07-10Automatic date update in version.inGDB Administrator1-1/+1
2018-07-09MIPS/BFD: Do not redirect to discarded lazy binding stubsMaciej W. Rozycki2-1/+8
Correct a MIPS/BFD linker issue with dynamic symbol and corresponding GOT entry values being redirected to lazy binding stubs where the stubs section has been discarded by assigning to the `/DISCARD/' output section in the linker script used. The issue manifests itself by the values entered being relative to the absolute section, which is what any discarded sections are internally assigned in the linker. For the `stub-dynsym-2.s' piece of code included as a test case with this change this issue results in the dynamic symbol table and the GOT looking like: Symbol table '.dynsym' contains 3 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000010 0 FUNC GLOBAL DEFAULT UND bar 2: 00000000 0 FUNC GLOBAL DEFAULT UND foo Primary GOT: Canonical gp value: 00097ff0 Reserved entries: Address Access Initial Purpose 00090000 -32752(gp) 00000000 Lazy resolver 00090004 -32748(gp) 80000000 Module pointer (GNU extension) Global entries: Address Access Initial Sym.Val. Type Ndx Name 00090008 -32744(gp) 00000010 00000010 FUNC UND bar 0009000c -32740(gp) 00000000 00000000 FUNC UND foo if assembled to regular MIPS code, or: Symbol table '.dynsym' contains 3 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000d 0 FUNC GLOBAL DEFAULT UND bar 2: 00000001 0 FUNC GLOBAL DEFAULT UND foo Primary GOT: Canonical gp value: 00097ff0 Reserved entries: Address Access Initial Purpose 00090000 -32752(gp) 00000000 Lazy resolver 00090004 -32748(gp) 80000000 Module pointer (GNU extension) Global entries: Address Access Initial Sym.Val. Type Ndx Name 00090008 -32744(gp) 0000000d 0000000d FUNC UND bar 0009000c -32740(gp) 00000001 00000001 FUNC UND foo if assembled to microMIPS code. Symbol values and GOT entries record the offset into the inexistent stubs section and the ISA bit rather than zero, which would be the case if a lazy binding stub was not used for other reasons, such as the value of the symbol being taken for a purpose other than making a function call (e.g. an R_MIPS_GOT16 relocation). Correct the issue by refraining from redirecting symbols to lazy binding stubs if the stubs section is going to be discarded. bfd/ * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Don't set `->needs_lazy_stub' if the stubs output section is the absolute section. ld/ * testsuite/ld-mips-elf/stub-dynsym-2.dd: New test. * testsuite/ld-mips-elf/stub-dynsym-2.gd: New test. * testsuite/ld-mips-elf/stub-dynsym-2.sd: New test. * testsuite/ld-mips-elf/stub-dynsym-discard-2.gd: New test. * testsuite/ld-mips-elf/stub-dynsym-discard-2.sd: New test. * testsuite/ld-mips-elf/stub-dynsym-micromips-2.dd: New test. * testsuite/ld-mips-elf/stub-dynsym-micromips-2.gd: New test. * testsuite/ld-mips-elf/stub-dynsym-micromips-2.sd: New test. * testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.dd: New test. * testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.gd: New test. * testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.sd: New test. * testsuite/ld-mips-elf/stub-dynsym-2.ld: New test linker script. * testsuite/ld-mips-elf/stub-dynsym-discard-2.ld: New test linker script. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2018-07-09bfd: Use changequote for "i[3-7]86-*-linux-*"H.J. Lu3-1/+9
Use changequote to match "i[3-7]86-*-linux-*", instead of "i3-786-*-linux-*". PR ld/23388 * configure.ac: Use changequote for "i[3-7]86-*-linux-*". * configure: Regenerated.
2018-07-09m68hc1* fixesAlan Modra2-0/+7
With config.sub now properly returning m68hc12-unknown-elf rather than m68hc12-unknown-none, more ELF tests run. This patch enables STB_GNU_UNIQUE processing fixing some testsuite failures that probably no m68hc12 user cares about, and removes some XPASSes. bfd/ * elf32-m68hc1x.c (elf32_m68hc11_post_process_headers): Call _bfd_elf_post_process_headers. ld/ * testsuite/ld-discard/extern.d: Remove m68hc12 xfail. * testsuite/ld-discard/start.d: Likewise. * testsuite/ld-discard/static.d: Likewise.
2018-07-09Automatic date update in version.inGDB Administrator1-1/+1
2018-07-08Automatic date update in version.inGDB Administrator1-1/+1
2018-07-07Automatic date update in version.inGDB Administrator1-1/+1
2018-07-06xtensa: don't emit dynamic relocation for weak undefined symbolMax Filippov2-2/+20
Resolved reference to a weak undefined symbol in PIE must not have a dynamic relative relocation against itself, otherwise the value of a reference will be changed from 0 to the base of executable, breaking code like the following: void weak_function (void); if (weak_function) weak_function (); This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc testsuite. bfd/ 2018-07-06 Max Filippov <jcmvbkbc@gmail.com> * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate space for dynamic relocation for undefined weak symbol. (elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE relocation for undefined weak symbols. (shrink_dynamic_reloc_sections): Don't shrink dynamic relocation section for relocations against undefined weak symbols.
2018-07-06Add checks for the NT_ARM_SVE section in a core file.Alan Hayward3-0/+37
The NT_ARM_SVE section is documented here: https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt * A NT_ARM_SVE note will be added to each coredump for each thread of the dumped process. The contents will be equivalent to the data that would have been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread when the coredump was generated. * elf.c (elfcore_grok_aarch_sve): New function. (elfcore_grok_note): Check for Aarch64 SVE. (elfcore_write_aarch_sve): New function. (elfcore_write_register_note): Check for Aarch64 SVE. * elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
2018-07-06Fix diagnostic errorsAlan Modra7-6/+28
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.
2018-07-05RISC-V: Add riscv-*-* configure support, and minor cleanup.Jim Wilson2-2/+8
bfd/ * config.bfd (riscv32*-*-*): Renamed from riscv32-*-*. (riscv64*-*-*): Likewise. (riscv-*-*): Add as an alias for riscv32*-*-*. ld/ * configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.
2018-07-06Automatic date update in version.inGDB Administrator1-1/+1
2018-07-05x86: Remove x86 ISA properties with empty bitsH.J. Lu2-4/+31
There is no need to generate x86 ISA properties with empty bits in linker output. bfd/ PR ld/23372 * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86 ISA properties with empty bits. ld/ PR ld/23372 * testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b. * testsuite/ld-i386/pr23372a.d: New file. * testsuite/ld-i386/pr23372a.s: Likewise. * testsuite/ld-i386/pr23372b.d: Likewise. * testsuite/ld-i386/pr23372b.s: Likewise. * testsuite/ld-i386/pr23372c.s: Likewise. * testsuite/ld-x86-64/pr23372a-x32.d: Likewise. * testsuite/ld-x86-64/pr23372a.d: Likewise. * testsuite/ld-x86-64/pr23372a.s: Likewise. * testsuite/ld-x86-64/pr23372b-x32.d: Likewise. * testsuite/ld-x86-64/pr23372b.d: Likewise. * testsuite/ld-x86-64/pr23372b.s: Likewise. * testsuite/ld-x86-64/pr23372c.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32, pr23372b and pr23372b-x32.
2018-07-05Updated Russian, Bulgarian, and Brazilian Portuguese translations for ↵Nick Clifton2-3985/+4071
various components of the binutuls. ld * po/bg.po: Updated Bulgarian translation. * po/pt_BR.po: Updated Brazilian Portuguese translation. binutils* po/bg.po: Updated Bulgarian translation. bfd,gas * po/ru.po: Updated Russian translation.
2018-07-05Error for mismatched powerpc ABI tagsAlan Modra4-36/+77
And report the two input files that are incompatible rather than reporting that an input file is incompatible with the output. bfd/ * elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype. * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error on mismatch. Remove "warning: " from messages. Track last bfd used to set tags. (ppc_elf_merge_obj_attributes): Likewise. Handle status from _bfd_elf_ppc_merge_fp_attributes. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status from _bfd_elf_ppc_merge_fp_attributes. ld/ * testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output. * testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise. * testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise. * testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.
2018-07-05Automatic date update in version.inGDB Administrator1-1/+1
2018-07-04Also install diagnostics.hH.J. Lu3-3/+11
Since bfd.h is an installed header, also install diagnostics.h. * Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h. * Makefile.in: Regenerated.
2018-07-04Automatic date update in version.inGDB Administrator1-1/+1