aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2024-10-16aarch64: Add support for GCS to AArch64 linkerusers/ARM/gcsSrinath Parvathaneni3-27/+139
This patch adds support for Guarded Control Stack in AArch64 linker. This patch implements the following: 1) Defines GNU_PROPERTY_AARCH64_FEATURE_1_GCS bit for GCS in GNU_PROPERTY_AARCH64_FEATURE_1_AND macro. 2) Adds readelf support to read and print the GNU properties in AArch64. Displaying notes found in: .note.gnu.property [ ]+Owner[ ]+Data size[ ]+Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: AArch64 feature: GCS 3) Adds support for the "-z gcs" linker option and document all the values allowed with this option (-z gcs[=always|never|implicit]) where "-z gcs" is equivalent to "-z gcs=always" and when this option is not passed in the command line, it defaults to "implicit". 4) Adds support for the "-z gcs-report" linker option and document all the values allowed with this option (-z gcs-report[=none|warning|error]) where "-z gcs-report" is equivalent to "-z gcs-report=none" and when this option is not passed in the command line, it defaults to "none". The ABI changes adding GNU_PROPERTY_AARCH64_FEATURE_1_GCS to the GNU property GNU_PROPERTY_AARCH64_FEATURE_1_AND is merged into main and can be found in [1]. [1] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst Co-authored-by: Matthieu Longo <matthieu.longo@arm.com> Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
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
2024-10-04is_target_special_symbol fixes for commit 68bbe1183379Alan Modra3-3/+13
* elf.c (_bfd_elf_is_local_label_name): Don't segv on NULL name. * elf32-v850.c (v850_elf_is_local_label_name): Likewise. * elfnn-riscv.c (riscv_elf_is_target_special_symbol): Likewise.
2024-10-04get_synthetic_symtab fixes for commit 68bbe1183379Alan Modra6-132/+158
Given that relocation symbol name can now be NULL for ELF, adjust various get_synthetic_symtab routines so they don't segfault. * elf.c (_bfd_elf_get_synthetic_symtab): Cope with sym->name possibly being NULL. * elf32-arm.c (elf32_arm_get_synthetic_symtab): Likewise. * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Likewise. * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise. * elfxx-mips.c (_bfd_mips_elf_get_synthetic_symtab): Likewise. * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Likewise.
2024-10-04bfd_elf_sym_name_rawAlan Modra4-10/+21
Many uses of bfd_elf_sym_name report errors. They ought to not return a NULL, as was the case prior to commit 68bbe1183379. Introduce a new function for cases where we'd like to know there is a problem with a symbol st_name. * elf-bfd.h (bfd_elf_sym_name_raw): Declare. * elf.c (bfd_elf_sym_name_raw): New function. (bfd_elf_sym_name): Revert to behaviour prior to 68bbe1183379, but returning "<null>" rather than "(null)" for st_name errors. (group_signature): Use bfd_elf_sym_name_raw. * elfcode.h (elf_slurp_symbol_table): Likewise. * elf32-i386.c (elf_i386_scan_relocs): Whitespace.
2024-10-04Automatic date update in version.inGDB Administrator1-1/+1
2024-10-03bfd: fix unnecessary bfd.info regenAlexey Izbyshev2-2/+2
When building from an unmodified release tarball, a REGEN_TEXI invocation is supposed to create a symlink to the .texi file in the source directory and discard the newly generated .tmp file. However, after commit bd32be01c997 ("bfd: merge doc subdir up a level") it creates the symlink at the wrong level, and then a .texi with a fresh timestamp, which in turn forces bfd.info regeneration. This breaks builds in environments without makeinfo program. Fix this by creating the symlink at the level of the target stamp. Fixes: bd32be01c997 ("bfd: merge doc subdir up a level") Signed-off-by: Alexey Izbyshev <izbyshev@ispras.ru>
2024-10-03peicode.h formattingAlan Modra1-69/+76
Fix some overlong line, comment block style, whitespace issues.
2024-10-03Don't return "(null)" from bfd_elf_sym_nameAlan Modra5-21/+24
A NULL return from bfd_elf_string_from_elf_section indicates an error. That shouldn't be masked by bfd_elf_sym_name but rather passed up to callers such as group_signature. If we want to print "(null)" then that should be done at a higher level. That's what this patch does, except that I chose to print "<null>" instead, like readelf. If we see "(null)" we're probably passing a NULL to printf. I haven't changed aoutx.h or pdp11.c print_symbol functions because they already handle NULL names by omitting the name. I also haven't changed mach-o.c, mmo.c, som.c, srec.c, tekhex.c, vms-alpha.c and wasm-module.c print_symbol function because it looks like they will never have NULL symbol names. bfd/ * elf.c (bfd_elf_sym_name): Don't turn a NULL name into a pointer to "(null)". (bfd_elf_print_symbol): Print "<null>" for NULL symbol names. * coffgen.c (coff_print_symbol): Likewise. * ecoff.c (_bfd_ecoff_print_symbol): Likewise. * pef.c (bfd_pef_print_symbol): Likewise. * syms.c (bfd_symbol_info): Return "<null>" in symbol_info.name if symbol name is NULL. ld/ * ldlang.c (ld_is_local_symbol): Don't check for "(null)" symbol name.
2024-10-03Automatic date update in version.inGDB Administrator1-1/+1
2024-10-02Add support for IMPORT_NAME_EXPORTAS in ILF (MSVC style) import librariesMartin Storsjö1-7/+36
This import name type is formally yet undocumented, but MSVC produces/supports it, primarily for ARM64EC import libraries. LLVM/LLD also supports this import name type. Since recently, llvm-dlltool also uses this type for certain kinds of renamed imports (that are easy to do in the long style import libraries produced by GNU dlltool, but require this name type in short import libraries). This name type contains a third string, in addition to the symbol name and the DLL name, indicating the actual imported name to reference in the import tables - which now can be distinct different from the symbol name on the object file level. https://github.com/llvm/llvm-project/commit/8f23464a5d957242c89ca6f33d4379c42519cd81 and https://github.com/llvm/llvm-project/commit/7b275aa2438c22604505d618dd37ee60052f2800 show how this import name type was added in LLVM. Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-02Automatic date update in version.inGDB Administrator1-1/+1
2024-10-01Automatic date update in version.inGDB Administrator1-1/+1
2024-10-01segv in bfd_elf_get_str_sectionAlan Modra2-2/+3
Attempting to write a termination NUL to PROT_READ mmap'd memory was a silly idea. PR 32109 * elf.c (bfd_elf_get_str_section): Don't write terminating NUL if missing. * libbfd.c (_bfd_munmap_readonly_temporary): Correct comment.
2024-09-30Automatic date update in version.inGDB Administrator1-1/+1
2024-09-29Automatic date update in version.inGDB Administrator1-1/+1
2024-09-28Automatic date update in version.inGDB Administrator1-1/+1
2024-09-27Automatic date update in version.inGDB Administrator1-1/+1
2024-09-26Fix -Wstringop-overflow warning in ecoff_link_hash_newfuncAndreas Schwab1-1/+1
* ecoff.c (ecoff_link_hash_newfunc): Don't call memset if ret is NULL.
2024-09-26Automatic date update in version.inGDB Administrator1-1/+1
2024-09-25RISC-V: Add Smrnmi extension csrs.Jiawei1-0/+1
This patch support Smrnmi extension[1], The csrs address can be find in[2]. [1] https://github.com/riscv/riscv-isa-manual/commit/35eb3948bf0b87c83fab5a7238bd68b6211faf62 [2] https://github.com/riscv/riscv-isa-manual/blob/smrnmi-1.0/src/priv-csrs.adoc bfd/ChangeLog: * elfxx-riscv.c: New extension. gas/ChangeLog: * NEWS: Add Smrnmi extension support. * config/tc-riscv.c (enum riscv_csr_class): New extension class. (riscv_csr_address): Ditto. * testsuite/gas/riscv/csr-version-1p10.d: New csrs. * testsuite/gas/riscv/csr-version-1p10.l: Ditto. * testsuite/gas/riscv/csr-version-1p11.d: Ditto. * testsuite/gas/riscv/csr-version-1p11.l: Ditto. * testsuite/gas/riscv/csr-version-1p12.d: Ditto. * testsuite/gas/riscv/csr-version-1p12.l: Ditto. * testsuite/gas/riscv/csr.s: Ditto. * testsuite/gas/riscv/march-help.l: New extension. include/ChangeLog: * opcode/riscv-opc.h (CSR_MNSCRATCH): New csr. (CSR_MNEPC): Ditto. (CSR_MNCAUSE): Ditto. (CSR_MNSTATUS): Ditto. (DECLARE_CSR): New csr declarations.
2024-09-25Automatic date update in version.inGDB Administrator1-1/+1
2024-09-24Automatic date update in version.inGDB Administrator1-1/+1
2024-09-23Automatic date update in version.inGDB Administrator1-1/+1
2024-09-22Automatic date update in version.inGDB Administrator1-1/+1
2024-09-21Automatic date update in version.inGDB Administrator1-1/+1
2024-09-20Automatic date update in version.inGDB Administrator1-1/+1
2024-09-19Automatic date update in version.inGDB Administrator1-1/+1
2024-09-18LoongArch: Add elfNN_loongarch_mkobject to initialize LoongArch tdataXin Wang1-0/+10
LoongArch: Add elfNN_loongarch_mkobject to initialize LoongArch tdata.
2024-09-18Automatic date update in version.inGDB Administrator1-1/+1
2024-09-17Automatic date update in version.inGDB Administrator1-1/+1
2024-09-16Automatic date update in version.inGDB Administrator1-1/+1
2024-09-15Automatic date update in version.inGDB Administrator1-1/+1
2024-09-14Automatic date update in version.inGDB Administrator1-1/+1