aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2022-05-10bfd: remove use of PTRAlan Modra6-11/+11
* coffcode.h (coff_write_object_contents): Don't cast to PTR. * elf32-csky.c (csky_elf_link_hash_traverse): Remove use of PTR and PARAMS. (csky_allocate_dynrelocs): Don't use PTR cast. * elf32-nios2.c (adjust_dynrelocs, allocate_dynrelocs): Replace PTR with void *. * elf32-visium.c (visium_elf_howto_parity_reloc): Likewise. * elfxx-ia64.c (ia64_elf_reloc): Likewise. * plugin.c (bfd_plugin_bfd_print_private_bfd_data): Likewise.
2022-05-10Automatic date update in version.inGDB Administrator1-1/+1
2022-05-09Automatic date update in version.inGDB Administrator1-1/+1
2022-05-08Automatic date update in version.inGDB Administrator1-1/+1
2022-05-07Re: Fix new linker testsuite failures due to rwx segment test problemsAlan Modra1-3/+0
Fix it some more. bfd/ * elfnn-loongarch.c: Remove commented out elf_backend_* defines. ld/ * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Match arm*. Delete loongarch.
2022-05-07Automatic date update in version.inGDB Administrator1-1/+1
2022-05-06bfd targmatch.h makefile ruleAlan Modra2-2/+2
I hit this just now with a make -j build after touching config.bfd. mv: cannot stat 'targmatch.new': No such file or directory make[2]: *** [Makefile:2336: targmatch.h] Error 1 make[2]: *** Waiting for unfinished jobs.... Fix that by not removing the target of the rule, a practice that seems likely to cause parallel running of the rule recipe. The bug goes back to 1997, the initial c0734708814c commit. * Makefile.am (targmatch.h): rm the temp file, not targmatch.h. * Makefile.in: Regenerate.
2022-05-06Automatic date update in version.inGDB Administrator1-1/+1
2022-05-05loongarch: Don't check ABI flags if no code sectionXi Ruoyao1-0/+21
Various packages (glib and gtk4 for example) produces data-only objects using `ld -r -b binary` or `objcopy`, with no elf header flags set. But these files also have no code sections, so they should be compatible with all ABIs. bfd/ * elfnn-loongarch.c (elfNN_loongarch_merge_private_bfd_data): Skip ABI checks if the input has no code sections. Reported-by: Wu Xiaotian <yetist@gmail.com> Suggested-by: Wang Xuerui <i@xen0n.name> Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
2022-05-04bfd: Check NULL pointer before setting ref_realH.J. Lu1-1/+2
PR ld/29086 * linker.c (bfd_wrapped_link_hash_lookup): Check NULL pointer before setting ref_real.
2022-05-05Automatic date update in version.inGDB Administrator1-1/+1
2022-05-04LTO: Handle __real_SYM reference in IRH.J. Lu1-0/+1
When an IR symbol SYM is referenced in IR via __real_SYM, its resolution should be LDPR_PREVAILING_DEF, not PREVAILING_DEF_IRONLY, since LTO doesn't know that __real_SYM should be resolved by SYM. bfd/ PR ld/29086 * linker.c (bfd_wrapped_link_hash_lookup): Mark SYM is referenced via __real_SYM. include/ PR ld/29086 * bfdlink.h (bfd_link_hash_entry): Add ref_real. ld/ PR ld/29086 * plugin.c (get_symbols): Resolve SYM definition to LDPR_PREVAILING_DEF for __real_SYM reference. * testsuite/ld-plugin/lto.exp: Run PR ld/29086 test. * testsuite/ld-plugin/pr29086.c: New file.
2022-05-05cris bfd configAlan Modra1-2/+0
cris support will be built into a 32-bit bfd if using --enable-targets=all on a 32-bit host, so we may as well make targmatch.h include cris. * config.bfd (cris): Remove #idef BFD64.
2022-05-05PowerPC64 check_relocsAlan Modra1-29/+10
Tidy the dynamic reloc handling code in check_relocs, removing leftover comments and code from when check_relocs was called as each object file was read in. * elf64-ppc.c (ppc64_elf_check_relocs): Tidy dynamic reloc handling code. (dec_dynrel_count): Do the same here.
2022-05-04PowerPC32 treatment of absolute symbolsAlan Modra1-62/+67
As already done for PowerPC64, fix dynamic relocs for absolute symbols. The patch also tidies the dynamic reloc handling code in check_relocs, removing leftover comments and code from when check_relocs was called as each object file was read in. bfd/ * elf32-ppc.c (ppc_elf_check_relocs): Set isym and ifunc earlier. Rearrange tests for dynamic relocs, handling absolute symbols. (allocate_dynrelocs): Don't allocate dynamic relocs for locally defined absolute symbols. (ppc_elf_size_dynamic_sections): Similarly. (ppc_elf_relocate_section): Similarly. ld/ * testsuite/ld-powerpc/abs32-pie.d, * testsuite/ld-powerpc/abs32-pie.r, * testsuite/ld-powerpc/abs32-reloc.s, * testsuite/ld-powerpc/abs32-shared.d, * testsuite/ld-powerpc/abs32-shared.r, * testsuite/ld-powerpc/abs32-static.d, * testsuite/ld-powerpc/abs32-static.r: New tests. * testsuite/ld-powerpc/powerpc.exp: Run them.
2022-05-04Automatic date update in version.inGDB Administrator1-1/+1
2022-05-03Add a linker warning when creating potentially dangerous executable ↵Nick Clifton2-1/+24
segments. Add tests, options to disabke and configure switches to choose defaults.
2022-05-03Automatic date update in version.inGDB Administrator1-1/+1
2022-05-02Automatic date update in version.inGDB Administrator1-1/+1
2022-05-01Automatic date update in version.inGDB Administrator1-1/+1
2022-04-30Automatic date update in version.inGDB Administrator1-1/+1
2022-04-29Automatic date update in version.inGDB Administrator1-1/+1
2022-04-28x86: Properly handle function pointer referenceH.J. Lu2-38/+43
Update commit ebb191adac4ab45498dec0bfaac62f0a33537ba4 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Feb 9 15:51:22 2022 -0800 x86: Disallow invalid relocation against protected symbol to allow function pointer reference and make sure that PLT entry isn't used for function reference due to function pointer reference. bfd/ PR ld/29087 * elf32-i386.c (elf_i386_scan_relocs): Don't set pointer_equality_needed nor check non-canonical reference for function pointer reference. * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise. ld/ PR ld/29087 * testsuite/ld-x86-64/x86-64.exp: Run PR ld/29087 tests. * testsuite/ld-x86-64/protected-func-3.c: New file.
2022-04-28s390: Add DT_JMPREL pointing to .rela.[i]plt with static-pieStefan Liebler1-1/+14
In static-pie case, there are IRELATIVE-relocs in .rela.iplt (htab->irelplt), which will later be grouped to .rela.plt. On s390, the IRELATIVE relocations are always located in .rela.iplt - even for non-static case. Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added to the dynamic section even if htab->srelplt->size == 0. See _bfd_elf_add_dynamic_tags in bfd/elflink.c. bfd/ elf64-s390.c (elf_s390_size_dynamic_sections): Enforce DT_JMPREL via htab->elf.dt_jmprel_required.
2022-04-28s390: Avoid dynamic TLS relocs in PIEStefan Liebler1-13/+13
No dynamic relocs are needed for TLS defined in an executable, the TP relative offset is known at link time. Fixes FAIL: Build pr22263-1 bfd/ PR ld/22263 * elf64-s390.c (elf_s390_tls_transition): Use bfd_link_dll instead of bfd_link_pic for TLS. (elf_s390_check_relocs): Likewise. (allocate_dynrelocs): Likewise. (elf_s390_relocate_section): Likewise.
2022-04-28Automatic date update in version.inGDB Administrator1-1/+1
2022-04-27Create pseudo sections for NT_ARM_TLS notes on FreeBSD.John Baldwin2-0/+7
bfd/ChangeLog: * elf.c (elfcore_grok_freebsd_note): Handle NT_ARM_TLS notes.
2022-04-27Automatic date update in version.inGDB Administrator1-1/+1
2022-04-26Automatic date update in version.inGDB Administrator1-1/+1
2022-04-25Emit a note warning the user that creating an executable stack because of a ↵Nick Clifton2-2/+14
missing .note.GNU-stack section is deprecated. PR 29072 bfd * elflink.c (bfd_elf_size_dynamic_sections): Display a note to the user that the current ehaviour of creating an executable stack because of a missing .note.GNU-stack section is deprecated and will be changed in a future release. binutils* testsuite/lib/binutils-common.exp (prune_warnings_extra): Filter out notes about the executable stacjk behaviour beign deprecated. ld * testsuite/ld-elf/pr29072.b.warn: Update to include the note about the linker's behaviour being depreccated.
2022-04-25Automatic date update in version.inGDB Administrator1-1/+1
2022-04-24Automatic date update in version.inGDB Administrator1-1/+1
2022-04-23Automatic date update in version.inGDB Administrator1-1/+1
2022-04-22Automatic date update in version.inGDB Administrator1-1/+1
2022-04-21Automatic date update in version.inGDB Administrator1-1/+1
2022-04-20Re: xcoff: implement linker relaxationAlan Modra1-18/+19
* xcofflink.c (xcoff_stub_csect_name): Increase buffer size. (xcoff_stub_get_csect_in_range, xcoff_build_one_stub): Whitespace. (bfd_xcoff_size_stubs): Cast PRIx64 arg to required type. Don't use freed stub_name.
2022-04-20xcoff: implement linker relaxationCl?ment Chigot6-29/+1216
bfd/ChangeLog: * coff-rs6000.c (xcoff_reloc_type_noop): Add info argument. (xcoff_reloc_type_fail): Likewise. (xcoff_reloc_type_pos): Likewise. (xcoff_reloc_type_neg): Likewise. (xcoff_reloc_type_rel): Likewise. (xcoff_reloc_type_toc): Likewise. (xcoff_reloc_type_ba): Likewise. (xcoff_reloc_type_crel): Likewise. (xcoff_reloc_type_tls): Likewise. (xcoff_reloc_type_br): Add stub handler. (xcoff_ppc_relocate_section): Add info to xcoff_calculate_relocation. (xcoff_stub_indirect_call_code): New constant. (xcoff_stub_shared_call_code): Likewise. (bfd_xcoff_backend_data): Add stub code fields. (bfd_pmac_xcoff_backend_data): Likewise. * coff64-rs6000.c (xcoff64_reloc_type_br): Add stub handler. (xcoff64_ppc_relocate_section): Add info to xcoff64_calculate_relocation. (xcoff64_stub_indirect_call_code): New constant. (xcoff64_stub_shared_call_code): Likewise. (bfd_xcoff_backend_data): Add stub code fields. (bfd_xcoff_aix5_backend_data): Likewise. * libxcoff.h (struct xcoff_backend_data_rec): Add stub fields. (bfd_xcoff_stub_indirect_call_code): New define. (bfd_xcoff_stub_indirect_call_size): New define. (bfd_xcoff_stub_shared_call_code): New define. (bfd_xcoff_stub_shared_call_size): New define. (xcoff_reloc_function): Add info argument. (enum xcoff_stub_type): New enum. (struct xcoff_stub_hash_entry): New structure. * xcofflink.c (struct xcoff_link_hash_table): Add stub hash table and params fields. (xcoff_stub_hash_entry): New define. (xcoff_stub_hash_lookup): New define. (stub_hash_newfunc): New function. (_bfd_xcoff_bfd_link_hash_table_free): Free the new stub hash table. (_bfd_xcoff_bfd_link_hash_table_create): Create the new stub hash table. (xcoff_link_add_symbols): Save rawsize for XTY_SD. (bfd_xcoff_link_init): New function. (xcoff_stub_csect_name): New function. (xcoff_stub_get_csect_in_range): New function. (xcoff_stub_name): New function. (bfd_xcoff_get_stub_entry): New function. (bfd_xcoff_type_of_stub): New function. (xcoff_add_stub): New function. (xcoff_build_one_stub): New function. (bfd_xcoff_size_stubs): New function. (bfd_xcoff_build_stubs): New function. (xcoff_stub_create_relocations): New function. (xcoff_link_input_bfd): Adapt relocations to stub. (xcoff_write_global_symbol): Adapt to new TOC entries generated for stubs. (_bfd_xcoff_bfd_final_link): Handle stub file. * xcofflink.h (struct bfd_xcoff_link_params): New structure. ld/ChangeLog: * emultempl/aix.em (params): New variable. (stub_file): New variable. (xcoff_add_stub_section): New function. (xcoff_layout_sections_again): New function (hook_in_stub): New function. (_after_allocation): Add stub creation. (_create_output_section_statements): Allocate stub file and pass params to backend.
2022-04-20Stubs (added in a later patch) will generate new .loader symbols, once the ↵Cl?ment Chigot5-104/+193
allocations have been done. Thus, the .loader section cannot be layout before that. bfd/ChangeLog: * coff-rs6000.c (_bfd_xcoff_put_ldsymbol_name): Write len in ldinfo->strings instead of directly in the output_bfd. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * xcofflink.c (struct xcoff_link_hash_table): Remove ldrel_count field. Add ldinfo field. (xcoff_mark_symbol): Adjust to new ldinfo field. (xcoff_mark): Likewise. (bfd_xcoff_link_count_reloc): Likewise. (xcoff_build_loader_section): Split into two functions: one that build the loader section (this function) and one that only size it... (xcoff_size_loader_section): ... (this function). (bfd_xcoff_size_dynamic_sections): Adapt to new ldinfo field. Move the part where the dynamic sections are build to ... (bfd_xcoff_build_dynamic_sections): ... this function. * xcofflink.h: Add bfd_xcoff_build_dynamic_sections prototype. include/ChangeLog: * coff/xcoff.h (struct xcoff_loader_info): Add ldrel_count and libpath fields. ld/ChangeLog: * emultempl/aix.em (_after_allocation): New function.
2022-04-20Add linker warning for when it creates an executable stack.Nick Clifton1-5/+45
PR 29072
2022-04-20Automatic date update in version.inGDB Administrator1-1/+1
2022-04-19Automatic date update in version.inGDB Administrator1-1/+1
2022-04-18Automatic date update in version.inGDB Administrator1-1/+1
2022-04-17Automatic date update in version.inGDB Administrator1-1/+1
2022-04-16Automatic date update in version.inGDB Administrator1-1/+1
2022-04-15Automatic date update in version.inGDB Administrator1-1/+1
2022-04-14ld:LoongArch: Fix glibc fail: tst-audit25a/b.caiyinyu1-0/+16
bfd/ * elfnn-loongarch.c: Add new func elf_loongarch64_hash_symbol.
2022-04-14Automatic date update in version.inGDB Administrator1-1/+1
2022-04-13binutils: enable PE on 32bit haiku buildAlexander von Gluck IV2-0/+5
* config.bfd (x86-haiku): Add i386_pei_vec as a selectable format.
2022-04-13Automatic date update in version.inGDB Administrator1-1/+1
2022-04-12Automatic date update in version.inGDB Administrator1-1/+1