aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
18 hoursAutomatic date update in version.inGDB Administrator1-1/+1
42 hoursAutomatic date update in version.inGDB Administrator1-1/+1
3 daysAutomatic date update in version.inGDB Administrator1-1/+1
4 daysAutomatic date update in version.inGDB Administrator1-1/+1
4 daysbfd: Add WARN_CFLAGS_FOR_BUILD to doc/chew.c build, fix warningsMark Wielaard3-25/+25
doc/chew.c was compiled without any warning flags set. Adding the common warnings for build showed various issues with non-static functions missing prototypes and globals with common names (ptr and idx) that shadowed local arguments or variables. * doc/local.mk (doc/chew.stamp): Add WARN_CFLAGS_FOR_BUILD. * Makefile.in: Regenerate. * doc/chew.c (idx): Rename to pos_idx. (ptr): Rename to buf_ptr. (xmalloc): Make static. (xrealloc): Likewise. (xstrdup): Likewise. (nextword): Likewise. (newentry): Likewise. (add_to_definition): Likewise. (add_intrinsic): Likewise. (compile): Likewise. (icopy_past_newline): Rename idx to pos_idx, ptr to buf_ptr. (get_stuff_in_command): Likewise. (skip_past_newline): Likewise. (perform): Likewise. (main): Likewise.
4 daysRemove redundant section merge hash table fieldAlan Modra1-61/+64
sec_merge_hash.size duplicates sec_merge_hash.table.count, albeit using bfd_size_type rather than unsigned int. The only reason to have the duplicate field is to catch unsigned int overflows, and that can be done easily enough when and if required. Overflow isn't possible at the moment. See the needs_resize comment. * merge.c (sec_merge_hash): Remove "size" field. (NEEDS_RESIZE): Delete macro, replacing with.. (needs_resize): ..this inline function. (sec_merge_resize): Rename from sec_merge_maybe_resize, removing redundant check. (sec_merge_hash_insert, sec_merge_hash_lookup): Adjust to suit. (sec_merge_init, merge_strings): Likewise.
4 daysRe: tekhex object file output fixesAlan Modra1-18/+20
Commit 8b5a212495 supported *ABS* symbols by allowing "section" to be bfd_abs_section, but bfd_abs_section needs to be treated specially. In particular, bfd_get_next_section_by_name (.., bfd_abs_section_ptr) is invalid. PR 32347 * tekhex.c (first_phase): Guard against modification of _bfd_std_section[] entries.
5 daysAutomatic date update in version.inGDB Administrator1-1/+1
6 daysld, LoongArch: print error about linking without -fPIC or -fPIE flag in more ↵Xin Wang1-10/+26
detail
6 daysAutomatic date update in version.inGDB Administrator1-1/+1
7 daysAutomatic date update in version.inGDB Administrator1-1/+1
8 daysAutomatic date update in version.inGDB Administrator1-1/+1
8 daysbfd: Remove unused static find function from doc/chew.cMark Wielaard1-16/+0
After commit 2e60790cf7c27d79f90f2dcb81e1930dc980bc1c "Remove the paramstuff word" there is no caller left of the static find function in doc/chew.c, so it should be removed. * doc/chew.c (find): Remove.
9 daysAutomatic date update in version.inGDB Administrator1-1/+1
10 daysAutomatic date update in version.inGDB Administrator1-1/+1
11 daysAutomatic date update in version.inGDB Administrator1-1/+1
12 daysAutomatic date update in version.inGDB Administrator1-1/+1
13 daysAutomatic date update in version.inGDB Administrator1-1/+1
14 daysAutomatic date update in version.inGDB Administrator1-1/+1
2024-11-02Automatic date update in version.inGDB Administrator1-1/+1
2024-11-01ld: generate SFrame stack trace info for .plt.gotIndu Bhagat3-9/+125
PR/32298 sframe: no SFrame stack trace info generated for .plt.got Add support to generate SFrame stack trace info for .plt.got section. Enhance the current definition of struct elf_x86_sframe_plt to include initialized SFrame FDE/FREs applicable for .plt.got section. There are two variants of .plt.got entries: 16 byte and 8 byte. 8 byte: ff 25 00 00 00 00 jmpq *name@GOTPCREL(%rip) 66 90 xchg %ax,%ax 16 byte: f3 0f 1e fa endbr64 ff 25 66 2f 00 00 jmpq *name@GOTPCREL(%rip) 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) For the testcase, define some application symbols such that their PLT entry is placed in .plt.got and ensure SFrame information is generated with and without -z ibtplt. ChangeLog: PR/32298 * bfd/elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): PLT GOT entry size is different for IBT vs non IBT PLTs. * bfd/elfxx-x86.c (enum dynobj_sframe_plt_type): New enum for SFRAME_PLT_GOT. (_bfd_x86_elf_create_sframe_plt): Handle SFRAME_PLT_GOT. (_bfd_x86_elf_write_sframe_plt): Likewise. (_bfd_x86_elf_late_size_sections): Likewise. (_bfd_x86_elf_finish_dynamic_sections): Likewise. * bfd/elfxx-x86.h (struct elf_x86_sframe_plt): Add new members to keep information about PLT GOT entries. (struct elf_x86_link_hash_table): Add support for creating SFrame section for .plt.got. * ld/testsuite/ld-x86-64/x86-64.exp: Add new tests. * ld/testsuite/ld-x86-64/sframe-pltgot-1.d: New test. * ld/testsuite/ld-x86-64/sframe-pltgot-1.s: New test. * ld/testsuite/ld-x86-64/sframe-pltgot-2.d: New test.
2024-11-01ld: fix wrong SFrame info for lazy IBT PLTJosh Poimboeuf2-18/+45
Fix PR/32296 sframe: wrong SFrame info for pltN and .plt.sec for -z ibtplt The x86 psABI defines a 2-PLT scheme for IBT which uses .plt and .plt.sec entries. It was observed that SFrame information for .plt.sec section was incorrect. The erroneous assumption was that SFrame stack trace information for .plt.sec with lazy binding is the same as SFrame stack trace information for .plt with lazy binding. This is corrected now by initializing a new SFrame PLT helper object elf_x86_64_sframe_ibt_plt for lazy PLT with IBT. Add a testcase where linking with -z ibtplt generates .plt.sec entries and ensure correct SFrame information for it. Committed by Indu Bhagat. ChangeLog: PR/32296 * bfd/elf64-x86-64.c (elf_x86_64_sframe_ibt_pltn_fre2): New definition elf_x86_64_sframe_ibt_plt. Use it in elf_x86_64_sframe_plt. (elf_x86_64_link_setup_gnu_properties): Lazy IBT PLT entries are different from lazy PLT. * bfd/elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Adjust for SFrame for IBT PLT. * ld/testsuite/ld-x86-64/x86-64.exp: Add new test. * ld/testsuite/ld-x86-64/sframe-ibt-plt-1.d: New test.
2024-11-01ld: fix PR/32297Josh Poimboeuf1-2/+2
When _creating_ SFrame information for the linker created .plt.sec, the code correctly checks for presence of .plt.sec. When _writing_ the SFrame section for the corresponding .plt.sec, however, the conditionals were wrongly checking for splt. This was causing an assertion at link time. This issue has been known to affect glibc build with SFrame enabled. No testcase is added just yet. A later commit ensures correct SFrame stack trace information is created for .plt.got. A test case (where only .plt and .plt.got are created) is added then. PR/32297 sframe: bfd assertion with empty main on IBT enabled system Committed by Indu Bhagat. ChangeLog: PR/32297 * bfd/elfxx-x86.c (_bfd_x86_elf_late_size_sections): Check for plt_second member not for splt.
2024-11-01Automatic date update in version.inGDB Administrator1-1/+1
2024-10-31Automatic date update in version.inGDB Administrator1-1/+1
2024-10-30Automatic date update in version.inGDB Administrator1-1/+1
2024-10-29LoongArch: Corrected to GNU style codeLulu Cai1-15/+15
2024-10-29Automatic date update in version.inGDB Administrator1-1/+1
2024-10-28Automatic date update in version.inGDB Administrator1-1/+1
2024-10-27Automatic date update in version.inGDB Administrator1-1/+1
2024-10-26tekhex.c tidy writesymAlan Modra1-13/+5
Simplifies the code a little. No functional changes.
2024-10-25Automatic date update in version.inGDB Administrator1-1/+1
2024-10-24tekhex object file output fixesAlan Modra1-18/+7
writevalue didn't handle 64-bit values, dropping the high 32 bits, and also wrote any value in the range [0,15] as 0. * tekhex.c (first_phase): Handle *ABS* symbols. (writevalue): Rewrite.
2024-10-24Automatic date update in version.inGDB Administrator1-1/+1
2024-10-23Automatic date update in version.inGDB Administrator1-1/+1
2024-10-22stringmerge: don't presize hash tableMichael Matz1-39/+31
originally the reason for pre-sizing was that that's easier for a multi-threaded use of the hash table. That hasn't materialized yet, so there's not much sense in using the very very conservative estimates for pre-sizing. Doing the resize on-demand, whenever we actually need to add a new entry doesn't change performance. bfd/ merge.c (sec_merge_hash_insert): Resize as needed from here ... (record_section): ... not from here. Don't calculate estimates, return bool instead of three-state, regard all errors as soft errors. (_bfd_merge_sections): Adjust.
2024-10-22LoongArch: Force relocation for every reference to the global offset tableLulu Cai1-8/+8
Local absolute symbols are resolved at assembly stage and the symbol value is placed in the relocation addend. But non-zero addend will cause an assertion failure during linking. Forces emission of relocations to defer resolution of local abs symbols until link time. bfd/ * elfnn-loongarch.c (loongarch_elf_relax_section): Determine absolute symbols in advance to avoid ld crash. gas/ * config/tc-loongarch.c (loongarch_force_relocation): New function to force relocation. * config/tc-loongarch.h (TC_FORCE_RELOCATION): New macros to force relocation. (loongarch_force_relocation): Function declaration. * testsuite/gas/loongarch/localpic.d: New test. * testsuite/gas/loongarch/localpic.s: New test.
2024-10-22Automatic date update in version.inGDB Administrator1-1/+1
2024-10-21Automatic date update in version.inGDB Administrator1-1/+1
2024-10-20Report bfd_merge_sections errorAlan Modra2-9/+10
PR 32260 bfd/ * elfxx-target.h (bfd_elfNN_bfd_merge_sections): Default to bfd_generic_merge_sections when using the generic linker. * elflink.c (_bfd_elf_merge_sections): Return error from _bfd_merge_sections. Abort on wrong hash table. ld/ * ldlang.c (lang_process): Report bfd_merge_sections error.
2024-10-20Automatic date update in version.inGDB Administrator1-1/+1
2024-10-19Automatic date update in version.inGDB Administrator1-1/+1
2024-10-18Automatic date update in version.inGDB Administrator1-1/+1
2024-10-17Fix for -Wstringop-overflow false positiveMichael Matz1-2/+2
the way the overflow check was written wasn't understood by some GCC versions and produced false positives for the memset call being called potentially with object sizes that are larger than half address-space.
2024-10-17PR32260: Improve error handling on string mergingMichael Matz1-13/+25
if the input sections are near the max supported size (4G) we might fail to enlarge the hash table. The error handling for this case didn't quite work. When this happens we can gracefully fall back to just not deduplicate this section (and continue with further mergable sections). We were mixing that with the case of not being able to even allocate a small structure (in which case we can as well error out completely), this disentables both cases. bfd/ PR ld/32260 * merge.c (sec_merge_maybe_resize): Check overflow in ultimate target type. (record_section): Return three-state, use new state when unable to enlarge hash table. (_bfd_merge_sections): Remove current section from merging consideration when hashtable can't be enlarged.
2024-10-17LoongArch: Check PC-relative relocations for shared librariesLulu Cai1-0/+21
Building shared libraries should not be allowed for PC-relative relocations against external symbols. Currently LoongArch has no corresponding checks and silently generates wrong shared libraries. However, In the first version of the medium cmodel, pcalau12i+jirl was used for function calls, in which case PC-relative relocations were allowed.
2024-10-17Automatic date update in version.inGDB Administrator1-1/+1
2024-10-16Assertion fail at peicode.h:607Alan Modra1-2/+2
This is the assertion that vars->string_ptr < vars->end_string_ptr, ie. when it fails we've overflowed the string buffer area. Caused by allocating space for import_name but writing symbol_name, and they can be different. * peicode.h (SIZEOF_ILF_STRINGS): Revert 042f14505e change.
2024-10-16PR32266, segv when linking libclang_rt.asan-powerpc64.soAlan Modra5-96/+90
Change the mmap support added with commit 9ba56acee518 to always mmap memory with PROT_READ | PROT_WRITE. Prior to that commit most file contents were read into a buffer allocated with bfd_alloc or bfd_malloc and thus the memory was read/write. Even after that commit any section contents with relocations must be read/write to apply the relocs. Making them all read/write is not a major change, and it should not introduce any measurable linker slowdown for contents that are not modified. More importantly, it removes a BFD behaviour difference that only triggers when large files are involved. PR 32266 PR 32109 * libbfd.c (bfd_mmap_local): Remove prot param. Always mmap with PROT_READ | PROT_WRITE. Adjust all calls. (_bfd_mmap_temporary): Rename from _bfd_mmap_readonly_temporary. (_bfd_munmap_temporary): Rename from _bfd_munmap_readonly_temporary. _bfd_mmap_persistent): Rename from _bfd_mmap_readonly_persistent. (_bfd_generic_get_section_contents): Use PROT_READ | PROT_WRITE regardless of relocs. * libbfd-in.h: Update decls to suit. Make non-USE_MMAP variants static inline functions. * elflink.c: Update all uses of _bfd_mmap functions. * elf.c: Likewise. (bfd_elf_get_str_section): Revert commit 656f8fbaae. * libbfd.h: Regenerate.
2024-10-16Automatic date update in version.inGDB Administrator1-1/+1