Commit Graph

19158 Commits

Author SHA1 Message Date
Indu Bhagat
7922c42688 bfd: sframe: minor code adjustments and fix typos
bfd/
	* elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Use local
	variable.
	(_bfd_x86_elf_size_dynamic_sections): Fix typos.
2024-05-17 11:24:28 -07:00
GDB Administrator
d7218dbb20 Automatic date update in version.in 2024-05-17 00:00:26 +00:00
GDB Administrator
52cad89678 Automatic date update in version.in 2024-05-16 00:00:19 +00:00
GDB Administrator
27f4c4bd19 Automatic date update in version.in 2024-05-15 00:00:19 +00:00
Pali Roh?r
4ac16d6607 Improve objdump -p output of PE Import and Export Tables
PR 31738
2024-05-14 16:50:32 +01:00
Richard Earnshaw
71afdf2e26 arm: remove Maverick support from BFD.
Remove the handling of Maverick from BFD.  Where appropriate we handle
legacy code by mapping ep9312 onto Armv4t.
2024-05-14 10:56:58 +01:00
GDB Administrator
a2db92ea31 Automatic date update in version.in 2024-05-14 00:00:14 +00:00
GDB Administrator
7143ed1205 Automatic date update in version.in 2024-05-13 00:00:15 +00:00
GDB Administrator
52b38954b2 Automatic date update in version.in 2024-05-12 00:00:10 +00:00
GDB Administrator
353f6a9bd1 Automatic date update in version.in 2024-05-11 00:00:07 +00:00
GDB Administrator
65924bda46 Automatic date update in version.in 2024-05-10 00:00:16 +00:00
GDB Administrator
46b6ba96d0 Automatic date update in version.in 2024-05-09 00:00:16 +00:00
Nick Clifton
43bb6c0e08 Fix RELOC_FOR_GLOBAL_SYMBOLS macro so that it can cope with user defined symbols that start with __wrap_.
PR 31710
2024-05-08 13:42:22 +01:00
Nelson Chu
c144f63833 RISC-V: Support B, Zaamo and Zalrsc extensions.
* https://github.com/riscv/riscv-b/tags
Added standard B extension back, which implies Zba, Zbb and Zbs extensions.

* https://github.com/riscv/riscv-zaamo-zalrsc/tags
Splited standard A extension into two new extensions, Zaamo and Zalrsc.
The A extension implies Zaamo and Zalrsc extensions.

Not sure if we need to do the similar check as i and zicsr/zifencei.

Passed riscv[32|64]-[elf/linux] binutils testcases.

bfd/
	* elfxx-riscv.c (riscv_implicit_subsets): Added imply rules
	for A and B extensions.  The A implies Zaamo and Zalrsc, the
	B implies Zba, Zbb and Zbs.
	(riscv_supported_std_ext): Supported B extension with v1.0.
	(riscv_supported_std_z_ext): Supported Zaamo and Zalrsc with v1.0.
	(riscv_multi_subset_supports, riscv_multi_subset_supports_ext): Updated.
include/
	* opcode/riscv.h (riscv_insn_class): Removed INSN_CLASS_A, Added
	INSN_CLASS_ZAAMO and INSN_CLASS_ZALRSC.
opcodes/
	* riscv-opc.c (riscv_opcodes): Splited standard A extension into two
	new extensions, Zaamo and Zalrsc.
gas/
	* testsuite/gas/riscv/march-imply-a.d: New testcase.
	* testsuite/gas/riscv/march-imply-b.d: New testcase.
	* testsuite/gas/riscv/attribute-01.d: Updated.
	* testsuite/gas/riscv/attribute-02.d: Updated.
	* testsuite/gas/riscv/attribute-03.d: Updated.
	* testsuite/gas/riscv/attribute-04.d: Updated.
	* testsuite/gas/riscv/attribute-05.d: Updated.
	* testsuite/gas/riscv/attribute-10.d: Updated.
	* testsuite/gas/riscv/mapping-symbols.d: Updated.
	* testsuite/gas/riscv/march-imply-g.d: Updated.
	* testsuite/gas/riscv/march-imply-unsupported.d: Updated.
	* testsuite/gas/riscv/march-ok-reorder.d: Updated.
ld/
	* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: Updated.
2024-05-08 12:34:58 +08:00
GDB Administrator
f0dbbf5401 Automatic date update in version.in 2024-05-08 00:00:17 +00:00
GDB Administrator
cdf5362f56 Automatic date update in version.in 2024-05-07 00:00:21 +00:00
GDB Administrator
f4c1c984bf Automatic date update in version.in 2024-05-06 00:00:15 +00:00
GDB Administrator
bf79d8caea Automatic date update in version.in 2024-05-05 00:00:13 +00:00
Alan Modra
c7a1fe2286 bus error with fuzzed archive element
* libbfd.c (bfd_mmap_local): Sanity check rsize against actual
	file offset and size, not an archive element offset and size.
2024-05-04 19:20:24 +09:30
GDB Administrator
f4b228ee68 Automatic date update in version.in 2024-05-04 00:00:12 +00:00
GDB Administrator
84a069db67 Automatic date update in version.in 2024-05-03 00:00:18 +00:00
GDB Administrator
75d933919d Automatic date update in version.in 2024-05-02 00:00:10 +00:00
GDB Administrator
7320840f19 Automatic date update in version.in 2024-05-01 00:00:19 +00:00
Nelson Chu
7bd696ef49 RISC-V: PR29823, defined the missing elf_backend_obj_attrs_handle_unknown.
bfd/
	PR 29823
	* elfnn-riscv.c (riscv_elf_obj_attrs_handle_unknown): New function.
	(elf_backend_obj_attrs_handle_unknown): Defined to
	riscv_elf_obj_attrs_handle_unknown.
2024-04-30 13:45:04 +08:00
GDB Administrator
a75d04db22 Automatic date update in version.in 2024-04-30 00:00:23 +00:00
Nick Clifton
d1765f5db3 Fix initiali state of DWARF v5 line number table in BFD library
PR 30783
2024-04-29 10:04:53 +01:00
Nick Clifton
679ad6e126 Fix building Loongarch BFD with a 32-bit compiler 2024-04-29 09:02:43 +01:00
GDB Administrator
e5d6ff3812 Automatic date update in version.in 2024-04-29 00:00:13 +00:00
GDB Administrator
3f3014cb00 Automatic date update in version.in 2024-04-28 00:00:07 +00:00
GDB Administrator
94f7532ed2 Automatic date update in version.in 2024-04-27 00:00:09 +00:00
GDB Administrator
cd0dbe7677 Automatic date update in version.in 2024-04-26 00:00:23 +00:00
Lulu Cai
66156bae7a LoongArch: Add bad static relocation check and output more information to user
Absolute address symbols cannot be used with -shared.
We output more information to the user than just BFD_ASSETR.
2024-04-25 09:21:26 +08:00
Lulu Cai
b221bff7c7 LoongArch: The symbol got type can only be obtained after initialization
When scanning relocations and determining whether TLS type transition is
possible, it will try to obtain the symbol got type. If the symbol got
type record has not yet been allocated space and initialized, it will
cause ld to crash. So when uninitialized, the symbol is set to GOT_UNKNOWN.
2024-04-25 09:21:19 +08:00
GDB Administrator
59462de443 Automatic date update in version.in 2024-04-25 00:00:13 +00:00
GDB Administrator
d65decae83 Automatic date update in version.in 2024-04-24 00:00:07 +00:00
Olivier Hainque
9b441c415c bfd: Remove duplicate word in elf-vxworks.c
PR ld/31652
	* elf-vxworks.c  (elf_vxworks_emit_relocs): Drop duplicate word.
2024-04-23 08:53:42 -07:00
Alan Modra
e79ee36b5a PR31667, objcopy/strip corrupts solaris binaries
Using want_p_paddr_set_to_zero in commit 45d92439ae was wrong.  Even
solaris targets don't have want_p_paddr_set_to_zero, but we should
handle them at least somewhat reasonably.

	PR 31667
	* elf.c (IS_SECTION_IN_INPUT_SEGMENT): Remove bed arg, add
	paddr_valid.  Don't use bed->want_p_paddr_set_to_zero.
	(INCLUDE_SECTION_IN_SEGMENT): Likewise.
	(rewrite_elf_program_header): Adjust to suit.
2024-04-23 22:07:04 +09:30
Alan Modra
ef1c830f00 ignore some symbols in elf.c:swap_out_syms
The reason behind this patch was noticing that generic ELF targets
fail to remove "bar" in the recently committed ld-elf/undefweak-1
test.  (Despite that, those targets pass the test due to it being too
strict when matching symbols.  "bar" gets turned into a local weak
defined absolute symbol.)

swap_out_syms currently drops local section syms that are defined in
discarded sections.  Extend that to also drop other symbols in
discarded sections too, even global symbols.  The linker goes to quite
a lot of effort to ensure globals in discarded section take a
definition from the kept linkonce or comdat group section.  So the
global sym change should only affect cases where something is quite
wrong about the set of linkonce or comdat group sections.  However
that change to elf_map_symbols meant we dropped _DYNAMIC_LINK /
_DYNAMIC_LINKING for mips, a global absolute symbol given STT_SECTION
type for some reason.  That problem is fixed by reverting the pr14493
change which is no longer needed due to a) BSF_SECTION_SYM_USED on
x86, and b) fixing objcopy to use copy_private_symbol_data.

bfd/
	PR 14493
	* elf.c (ignore_sym): Rename from ignore_section_sym.  Return
	true for any symbol without a section or in a discarded section.
	Revert pr14493 change.
	(elf_map_symbols): Tidy.  Use ignore_sym on all symbols.
	(swap_out_syms): Tidy.
ld/
	* testsuite/ld-elf/undefweak-1.rd: Match any "bar".
2024-04-23 22:07:00 +09:30
Alan Modra
6705e14a99 copy_private_symbol_data
bfd_copy_private_symbol_data is a bfd function that appeared in
commit 89665c8562 a long time ago, but seemingly wasn't used
anywhere until Jan added it to gas/symbols.c in commit 6a2b6326c2.

The function is used to modify ELF symbol st_shndx for symbols defined
in odd sections like .symtab, so that they get the corresponding
section st_shndx in an output file.  This patch fixes some bitrot in
the function.  After commit c03551323c which introduced
output_elf_obj_tdata, elf_strtab_sec and elf_shstrtab_sec will
segfault if used on an input bfd.

	PR 14493
	* elf.c (_bfd_elf_copy_private_symbol_data): Don't use
	elf_strtab_sec and elf_shstrtab_sec.
2024-04-23 11:19:35 +09:30
GDB Administrator
5b4c41267f Automatic date update in version.in 2024-04-23 00:00:13 +00:00
GDB Administrator
80fa407f9f Automatic date update in version.in 2024-04-22 00:00:10 +00:00
GDB Administrator
7e9ef24e4a Automatic date update in version.in 2024-04-21 00:00:08 +00:00
GDB Administrator
3716307682 Automatic date update in version.in 2024-04-20 00:00:13 +00:00
Alan Modra
9cf3c87e16 Re: elf: Strip unreferenced weak undefined symbols
PR ld/31652
	* elflink.c (_bfd_elf_link_output_relocs): Don't segfault
	on NULL rel_hash.
2024-04-19 16:48:03 +09:30
H.J. Lu
eebad48efe elf: Strip unreferenced weak undefined symbols
Linker will resolve an undefined symbol only if it is referenced by
relocation.  Unreferenced weak undefined symbols serve no purpose.
Weak undefined symbols appear in the dynamic symbol table only when they
are referenced by dynamic relocation.  Mark symbols with relocation and
strip undefined weak symbols if they don't have relocation and aren't
in the dynamic symbol table.

bfd/

	PR ld/31652
	* elf-bfd.h (elf_link_hash_entry): Add has_reloc.
	* elf-vxworks.c (elf_vxworks_emit_relocs): Set has_reloc.
	* elflink.c (_bfd_elf_link_output_relocs): Likewise.
	(elf_link_output_extsym): Strip undefined weak symbols if they
	don't have relocation and aren't in the dynamic symbol table.

ld/

	PR ld/31652
	* testsuite/ld-elf/elf.exp: Run undefweak tests.
	* testsuite/ld-elf/undefweak-1.rd: New file.
	* testsuite/ld-elf/undefweak-1a.s: Likewise.
	* testsuite/ld-elf/undefweak-1b.s: Likewise.
	* testsuite/ld-x86-64/weakundef-1.nd: Likewise.
	* testsuite/ld-x86-64/weakundef-1a.s: Likewise.
	* testsuite/ld-x86-64/weakundef-1b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run undefweak tests.
2024-04-18 19:17:17 -07:00
Alan Modra
2304772225 memory leak in bfd/dwarf2.c
* dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free
	dwarf_addr_buffer and dwarf_str_offsets_buffer.
2024-04-19 10:00:57 +09:30
GDB Administrator
eae4098321 Automatic date update in version.in 2024-04-19 00:00:11 +00:00
Nick Clifton
31d5afc19d HPPA64 linker: Do not force the generation of DT_FLAGS for Linux targets.
PR 30743
2024-04-18 13:24:42 +01:00
Alan Modra
ebf1867135 Re: Fix address violations when reading corrupt VMS records
Fixes error reports about the length of EEOM records produced by gas.

	PR 21618
	* vms-alpha.c (evax_bfd_print_emh): Don't read subtyp if short
	record.  Consolidate error messages.
	(evax_bfd_print_eeom): Allow length 10 record.
2024-04-18 10:31:59 +09:30
Alan Modra
ee19a4725c alpha_vms_get_section_contents vs. fuzzed files
This patch is in response to an oss-fuzz report regarding
use-of-uninitialized-value in bfd_is_section_compressed_info from
section contents provided by alpha_vms_get_section_contents.  That
hole is covered by using bfd_zalloc rather than bfd_alloc.

The rest of the patch is mostly a tidy.  In a function returning
section contents, I tend to prefer a test on the section properties
over a test on file properties.  That's why I've changed the file
flags test to one on section filepos and flags before calling
_bfd_generic_get_section_contents.  Also, fuzzed objects can easily
have sections with file backing in relocatable objects, or sections
without file backing in images.  Possible confusion is avoided by
testing each section.

Note that we are always going to run into out-of-memory with fuzzed
alpha-vms object files due to sections with contents via ETIR records.
eg. ETIR__C_STO_IMMR stores a number of bytes repeatedly, with a
32-bit repeat count.  So section contents can be very large from a
relatively small file.  I'm inclined to think that an out-of-memory
error is fine for such files.

	* vms-alpha.c (alpha_vms_get_section_contents): Handle sections
	with non-zero filepos or without SEC_HAS_CONTENTS via
	_bfd_generic_get_section_contents.  Zero memory allocated for
	sections filled by ETIR records.
2024-04-18 10:31:59 +09:30