aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
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
2024-10-15LoongArch: Add more relaxation support for call36mengqinggang1-3/+18
Add relaxation support for call36 that jump to PLT entry. Add relaxation support for call36 with IFUNC symbol. Add relaxation support for call36 that jump to undefweak symbol. For undefweak symbol, it can always be relaxed if it have no PLT entry. Because we set the address of undefweak symbol without PLT entry to PC like relocate_section.
2024-10-15LoongArch: Optimize the relaxation processmengqinggang1-142/+139
The symbol value is only calculated when the relocation can be relaxed.
2024-10-15Automatic date update in version.inGDB Administrator1-1/+1
2024-10-14Automatic date update in version.inGDB Administrator1-1/+1
2024-10-13Automatic date update in version.inGDB Administrator1-1/+1
2024-10-12Automatic date update in version.inGDB Administrator1-1/+1
2024-10-11bfd/ELF: drop align_file_position()Jan Beulich1-10/+1
Switch the sole user to BFD_ALIGN() instead. (It's comment was partly wrong [stale?] anyway, talking of some maximum that was nowhere in sight.)
2024-10-11bfd/ELF: restrict file alignment for object filesJan Beulich3-18/+34
While for executables properly aligning sections within the file can be quite relevant, the same is of pretty little importance for relocatable object files. Avoid passing "true" into _bfd_elf_assign_file_position_for_section() when dealing with object files, but compensate minimally by applying log_file_align in such cases as a cap to the alignment put in place.
2024-10-11Automatic date update in version.inGDB Administrator1-1/+1
2024-10-10Automatic date update in version.inGDB Administrator1-1/+1
2024-10-09Automatic date update in version.inGDB Administrator1-1/+1
2024-10-08Revised "Don't return (null) from bfd_elf_sym_name"Alan Modra10-50/+92
Commit 68bbe1183379 results in a lot of follow up work, much of which likely is still to be done. (And yes, since this is all for corrupted or fuzzed object files, a whole lot of work doesn't much benefit anyone. It was a bad idea to put NULL in asymbol->name.) So I'm changing the approach to instead put a unique empty string for symbols with a corrupted st_name. An empty string won't require much work to ensure nm, objcopy, objdump etc. won't crash, since these tools already must work with unnamed local symbols. The unique empty string is called bfd_symbol_error_name. This patch uses that name string for corrupted symbols in the ELF and COFF backends. Such symbols are displayed by nm and objdump as the translated string "<corrupt>", which is what the COFF backend used to put directly into corrupted symbols. ie. it's the way I should have written the original patch, plus a few tides and cleanups I retained from the reverted patches.
2024-10-08Revert "Don't return "(null)" from bfd_elf_sym_name"Alan Modra5-24/+21
This reverts commit 68bbe118337939aa0b52e007a7415c8a157579a1.
2024-10-08Revert "bfd_elf_sym_name_raw"Alan Modra4-21/+10
This reverts commit 265757dc6e4d011a1b33ef1b3bfcd7f100f12f64.
2024-10-08Revert "get_synthetic_symtab fixes for commit 68bbe1183379"Alan Modra6-158/+132
This reverts commit 0c13ac533e59589793ee6c8045cff98663f3ea85.
2024-10-08Revert "is_target_special_symbol fixes for commit 68bbe1183379"Alan Modra3-13/+3
This reverts commit 6e40f9bb31be2f3656df97a1fcba4d6a30081e24.
2024-10-08Revert "elf.c and elflink.c fixes for commit 68bbe1183379"Alan Modra2-26/+16
This reverts commit 389fdfbe0d2aca0af1431ddf34704534dacc48c8.
2024-10-08RISC-V: Fix implicit dependency of Zabha and ZacasXiao Zeng1-2/+2
1 Zabha depends on Zaamo: <https://github.com/riscv/riscv-isa-manual/blob/main/src/zabha.adoc> 2 Zacas depends on Zaamo: <https://github.com/riscv/riscv-isa-manual/blob/main/src/zacas.adoc> bfd/ChangeLog: * elfxx-riscv.c: Zabha and Zacas implicitly depend on Zaamo. gas/ChangeLog: * testsuite/gas/riscv/imply.d: Updated. Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2024-10-08Automatic date update in version.inGDB Administrator1-1/+1
2024-10-07Automatic date update in version.inGDB Administrator1-1/+1
2024-10-06Automatic date update in version.inGDB Administrator1-1/+1
2024-10-05elf.c and elflink.c fixes for commit 68bbe1183379Alan Modra2-16/+26
Plus some tidies to swap_out_syms. * elf.c (swap_out_syms): Handle NULL sym name. Use correct type for return of _bfd_elf_strtab_add. Simplify. * elflink.c (bfd_elf_match_symbols_in_sections): Handle NULL sym name.
2024-10-05Automatic date update in version.inGDB Administrator1-1/+1