Commit Graph

102677 Commits

Author SHA1 Message Date
Nick Alcock
acc7a74a2c
libctf: fix ref leak of names of newly-inserted non-root-visible types
A bug in ctf_dtd_delete led to refs in the string table to the
names of non-root-visible types not being removed when the DTD
was.  This seems harmless, but actually it would lead to a write
down a pointer into freed memory if such a type was ctf_rollback()ed
over and then the dict was serialized (updating all the refs as the
strtab was serialized in turn).

Bug introduced in commit fe4c2d5563
("libctf: create: non-root-visible types should not appear in name tables")
which is included in binutils 2.35.

libctf/
	* ctf-create.c (ctf_dtd_delete): Remove refs for all types
	with names, not just root-visible ones.
2024-08-02 13:54:40 +01:00
Alan Modra
3437a8bad8 PR27755, powerpc-ld infinite loop
PR 27755
	* elf32-ppc.c (ppc_elf_inline_plt): Do increment rel in loop.

(cherry picked from commit 337d0bf887)
2021-05-03 15:46:00 +09:30
H.J. Lu
d8768ca6a7 DWARF: Check version >= 3 for DW_FORM_ref_addr
Check version >= 3, instead of version == 3 || version == 4, for
DW_FORM_ref_addr.

bfd/

	PR ld/27587
	* dwarf2.c (read_attribute_value): Check version >= 3 for
	DW_FORM_ref_addr.

(cherry picked from commit 51f6e7a9f4)
2021-03-22 10:06:07 -07:00
Nick Clifton
959ab8e63a Reset development to true 2021-01-30 12:58:34 +00:00
Nick Clifton
3bcf28ab4a GNU Binutils 2.35.2 Release 2021-01-30 12:35:52 +00:00
Alan Modra
7ed5ed075b PR27259, SHF_LINK_ORDER self-link
This stops ld from endless looping on SHF_LINK_ORDER sh_link loops.

bfd/
	PR 27259
	* elflink.c (_bfd_elf_gc_mark_extra_sections): Use linker_mark to
	prevent endless looping of linked-to sections.
ld/
	PR 27259
	* ldelf.c (ldelf_before_place_orphans): Use linker_mark to
	prevent endless looping of linked-to sections.

(cherry picked from commit def97fb945)
2021-01-30 09:15:18 +10:30
Alan Modra
9107f37953 Don't assert at ldwrite.c:212
When excluding SHF_LINK_ORDER sections that happen to have SEC_KEEP
set, we need to set SEC_EXCLUDE here to avoid a problem later.

	* ldelf.c (ldelf_before_place_orphans): Set SEC_EXCLUDE for
	discarded sections.

(cherry picked from commit 5987401fcb)
2021-01-30 09:14:00 +10:30
H.J. Lu
756beae668 gold: Skip address size and segment selector for DWARF5
The .debug_line secton in DWARF5 has a byte for address size and a byte
for segment selector after DWARF version.  Skip them for DWARF5.

	PR gold/27246
	* dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog):
	Skip address size and segment selector for DWARF5.

(cherry picked from commit 0318cca493)
2021-01-28 04:38:03 -08:00
Peter Bergner
02f225e4de POWER10: Add Return-Oriented Programming instructions
POWER10 adds some return-oriented programming (ROP) instructions and
this patch adds support for them.  You will notice that they are enabled
for POWER8 and later, not just POWER10 and later.  This is on purpose.
This allows the instructions to be added to POWER8 binaries that can be
run on POWER8, POWER9 and POWER10 cpus.  On POWER8 and POWER9, these
instructions just act as nop's.

opcodes/
	* ppc-opc.c (insert_dw, (extract_dw): New functions.
	(DW, (XRC_MASK): Define.
	(powerpc_opcodes) <hashchk, hashchkp, hashst, haststp>: New mnemonics.
gas/
	* testsuite/gas/ppc/rop-checks.d,
	* testsuite/gas/ppc/rop-checks.l,
	* testsuite/gas/ppc/rop-checks.s,
	* testsuite/gas/ppc/rop.d,
	* testsuite/gas/ppc/rop.s: New tests.
	* testsuite/gas/ppc/ppc.exp: Run them.

(cherry picked from commit aae7fcb8d7)
2021-01-28 11:53:35 +10:30
Alan Modra
662f9a9109 R_PPC64_GOT_LO_DS and R_PPC64_GOT_HA sanity check
The previous sanity check allowed a ld on the HA reloc and addis
on the LO_DS.

	* elf64-ppc.c (ppc64_elf_relocate_section): Tighten sanity check
	on R_PPC64_GOT_LO_DS and R_PPC64_GOT_HA instructions.

(cherry picked from commit fba8689ad3)
2021-01-28 11:52:39 +10:30
Alan Modra
7601b250d5 power10 on ppc32
We don't support power10 on ppc32, mainly because some instructions
have 34-bit fields for which we don't have relocations on ppc32.
If you try to assemble typical code, you'll see errors saying
"reloc ... not supported by object file format".  Also, on 32-bit
hosts with binutils configured without a 64-bit bfd, you'll see errors
saying "bignum invalid" when using large offsets.  But let's not kill
output of prefix insns entirely on 32-bit hosts.

	* config/tc-ppc.c (md_assemble): Emit prefix insn by parts when
	valueT is smaller than 64 bits.

(cherry picked from commit 15a32af52f)
2021-01-28 11:51:57 +10:30
Alan Modra
e658f42c0f PR26489, ASAN: ppc64_elf_size_stubs elf64-ppc.c:13389
Stub sections are inserted after sec_info is sized, so have higher ids.
Test flags that will exclude stub sections before looking at the
sec_info array.

	PR 26489
	* elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc
	and code_sec->makes_toc_func_call before sec_info[code_sec->id].

(cherry picked from commit 918dc783de)
2021-01-28 11:51:12 +10:30
Alan Modra
0004f3b30c PR26492, ASAN: ppc64_elf_before_check_relocs elf64-ppc.c:4337
PR 26492
	* elf64-ppc.c (ppc_hash_table): Test is_elf_hash_table before
	accessing elf_hash_table_id.

(cherry picked from commit 573eb292ee)
2021-01-28 11:50:36 +10:30
Alan Modra
9010a66f2d PR26483, ASAN: ppc_elf_link_params elf32-ppc.c:2314
PR 26483
	* elf32-ppc.c (ppc_elf_hash_table): Test is_elf_hash_table before
	accessing elf_hash_table_id.

(cherry picked from commit a8d549c006)
2021-01-28 11:49:44 +10:30
Alan Modra
6dcfc42f68 Segmentation fault i386-gen
A case of inst->next being uninitialised.

	* i386-gen.c (parse_template): Ensure entire template_instance
	is initialised.

(cherry picked from commit c3ffb8f340)
2021-01-27 08:57:01 +10:30
Frederic Cambus
b1e65c1026 Fix thinko in objcopy's memory freeing code.
* objcopy.c (copy_main): Fix a double free happening when both
	--localize-symbols and --globalize-symbols options are invoked
	together.

(cherry picked from commit e37709f090)
2021-01-27 08:55:17 +10:30
Alan Modra
a2aa107b13 PR27218, memory access violation in dwarf2dbg.c
PR 27218
	* dwarf2dbg.c (dwarf2_gen_line_info): Correct setting of dwarf_level.
	(dwarf2_directive_filename, dwarf2_directive_loc): Likewise, and
	error for negative file numbers.

(cherry picked from commit 498ff0328f)
2021-01-26 06:24:00 -08:00
H.J. Lu
74c2eff559 as: Automatically enable DWARF5 support
Currently

$ as -o x.o x.s

fails when x.s contains DWARF5 ".file 0" or ".loc 0" directives.  Update
assembler to automatically enable DWARF5 support so that

$ gcc -S -g -c x.c
$ gcc -c x.s

works.

	PR gas/27195
	* dwarf2dbg.c (dwarf2_gen_line_info): Set dwarf_level to 5 if
	needed.
	(dwarf2_directive_filename): Likewise.
	(dwarf2_directive_loc): Likewise.
	* testsuite/gas/elf/dwarf-5-file0.d: Pass --gdwarf-3.
	* testsuite/gas/lns/lns-diag-1.l: Remove the
	"Error: file number less than one" errors.

(cherry picked from commit 705989f19a)
2021-01-26 06:22:42 -08:00
H.J. Lu
1ae65e19b2 DWARF-5: Ignore empty range in DWARF-5 line number tables
The DWARF5 spec does indeed explicitly say: "A bounded range entry whose
beginning and ending address offsets are equal (including zero) indicates
an empty range and may be ignored."

Since arange_add already ignores empty ranges, remove the whole check
which is equivalent to the check plus explicit continue.

	PR binutils/27231
	* dwarf2.c (read_rnglists): Ignore empty range when parsing line
	number tables.

(cherry picked from commit 940d0202fd)
2021-01-24 07:07:26 -08:00
H.J. Lu
0da7136ac1 DWARF-5: Fix parsing DWARF-5 line number tables
Advance rngs_ptr when parsing DW_RLE_offset_pair, which was missing in

commit c3757b583d
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Aug 25 15:33:00 2020 +0100

    Fix the linker's handling of DWARF-5 line number tables.

	PR binutils/27231
	* dwarf2.c (read_rnglists): Advance rngs_ptr after
	_bfd_safe_read_leb128 when parsing DW_RLE_offset_pair.

(cherry picked from commit 18454c151f)
2021-01-23 18:23:08 -08:00
GDB Administrator
4100e69996 Automatic date update in version.in 2021-01-10 00:00:33 +00:00
GDB Administrator
395053b92f Automatic date update in version.in 2021-01-09 00:00:31 +00:00
GDB Administrator
e9b6933e07 Automatic date update in version.in 2021-01-08 00:00:40 +00:00
GDB Administrator
830d57df46 Automatic date update in version.in 2021-01-07 00:00:56 +00:00
GDB Administrator
f0b8ea109f Automatic date update in version.in 2021-01-06 00:00:53 +00:00
GDB Administrator
7ba11e9273 Automatic date update in version.in 2021-01-05 00:00:35 +00:00
GDB Administrator
9cab1e1931 Automatic date update in version.in 2021-01-04 00:00:44 +00:00
Alan Modra
f8db4612c5 PR27140, ppc32 segmentation fault in make_stub
This fixes a thinko in commit fa40fbe484.  st_other global entry bits
are relevant only for 64-bit ELFv2.  PowerPC gold leaves local sym
vector of st_other bits as NULL for 32-bit, hence the segfault.

	PR 27140
	* powerpc.cc (Target_powerpc::Branch_info::make_stub): Only access
	object->st_other() when 64-bit.
	(Stub_table::add_long_branch_entry): Ignore "other" when 32-bit.

(cherry picked from commit e3b53295d5)
2021-01-03 12:52:14 +10:30
GDB Administrator
59d00251f6 Automatic date update in version.in 2021-01-03 00:00:31 +00:00
GDB Administrator
aebc8c4daf Automatic date update in version.in 2021-01-02 00:00:30 +00:00
GDB Administrator
55cb086c67 Automatic date update in version.in 2021-01-01 00:00:29 +00:00
Alan Modra
5ca7ac981b PR27128, nm -P portable output format regression
binutils/
	PR 27128
	* nm.c (print_symname): Append version string to symbol name
	before printing the lot under control of "form".  Append version
	to demangled names too.
ld/
	PR 27128
	* testsuite/ld-elf/pr27128.s: New file.
	* testsuite/ld-elf/pr27128.t: Likewise.
	* testsuite/ld-elf/pr27128a.d: Likewise.
	* testsuite/ld-elf/pr27128b.d: Likewise.
	* testsuite/ld-elf/pr27128c.d: Likewise.
	* testsuite/ld-elf/pr27128d.d: Likewise.
	* testsuite/ld-elf/pr27128e.d: Likewise.

(cherry picked from commit cab3f4da68)
2021-01-01 10:19:44 +10:30
Alan Modra
9640c06f80 sparc testsuite fallout
(cherry picked from commit f1a9fbd995)
2021-01-01 10:18:39 +10:30
H.J. Lu
0a690cf659 elf: Keep only one '@' for undefined versioned symbols
The symbol string table in the .symtab section is optional and cosmetic.
Keep only one '@' for undefined versioned symbols, which are defined in
shared objects, in the symbol string table.  Update "nm -D" to display
only one '@' for undefined versioned symbols.

bfd/

	PR ld/26382
	* elflink.c (elf_link_output_symstrtab): Keep only one '@' for
	versioned symbols, which are defined in shared objects, in
	symbol string table.

binutils/

	PR ld/26382
	* nm.c (print_symname): Display only one '@' for undefined
	versioned symbols.
	* doc/binutils.texi: Update nm version information.

ld/

	PR ld/26382
	* testsuite/ld-elf/pr26302.nd: Updated.
	* testsuite/ld-elf/pr26302.rd: New file.
	* testsuite/ld-elf/shared.exp: Add a test for readelf -sW.

(cherry picked from commit 3f2e969923)
2021-01-01 10:17:29 +10:30
H.J. Lu
794e008bac nm: Remove --with-symbol-versions
Since

commit 7e6e972f74
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 24 04:23:11 2020 -0700

    bfd: Display symbol version for nm -D

always displays symbol version for nm, remove --with-symbol-versions and
silently accept it for backward compatibility.

binutils/

	PR binutils/26302
	* nm.c (with_symbol_versions): Removed.
	(long_option_values): Add OPTION_WITH_SYMBOL_VERSIONS.
	(long_options): Update --with-symbol-versions entry.
	(print_symbol): Remove the with_symbol_versions check.
	(main): Add OPTION_WITH_SYMBOL_VERSIONS for backward
	compatibility.
	* doc/binutils.texi: Remove --with-symbol-versions.

ld/

	PR binutils/26302
	* testsuite/ld-elf/pr26302.nd: New file.
	* testsuite/ld-elf/pr26302.ver: Likewise.
	* testsuite/ld-elf/pr26302a.c: Likewise.
	* testsuite/ld-elf/pr26302b.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run binutils/26302 tests.

(cherry picked from commit 9b0ac51b22)
2021-01-01 10:15:49 +10:30
GDB Administrator
20a201933c Automatic date update in version.in 2020-12-31 00:00:42 +00:00
GDB Administrator
17c2dc6691 Automatic date update in version.in 2020-12-30 00:00:33 +00:00
GDB Administrator
1ffc60ec40 Automatic date update in version.in 2020-12-29 00:00:48 +00:00
GDB Administrator
3e4abbda9c Automatic date update in version.in 2020-12-28 00:00:39 +00:00
GDB Administrator
9003b4a1c3 Automatic date update in version.in 2020-12-27 00:00:50 +00:00
GDB Administrator
0a835fbea0 Automatic date update in version.in 2020-12-26 00:00:27 +00:00
GDB Administrator
7c3813fdc4 Automatic date update in version.in 2020-12-25 00:00:32 +00:00
GDB Administrator
abd0dcd37f Automatic date update in version.in 2020-12-24 00:00:44 +00:00
GDB Administrator
8f9eec44b3 Automatic date update in version.in 2020-12-23 00:00:35 +00:00
GDB Administrator
10a9da658e Automatic date update in version.in 2020-12-22 00:00:46 +00:00
GDB Administrator
85d6c75350 Automatic date update in version.in 2020-12-21 00:00:28 +00:00
GDB Administrator
23f34add74 Automatic date update in version.in 2020-12-20 00:00:29 +00:00
GDB Administrator
e7f46bfe0b Automatic date update in version.in 2020-12-19 00:00:27 +00:00
GDB Administrator
4611585313 Automatic date update in version.in 2020-12-18 00:00:56 +00:00
GDB Administrator
6828c0c676 Automatic date update in version.in 2020-12-17 00:00:45 +00:00