Commit Graph

104629 Commits

Author SHA1 Message Date
GDB Administrator
9f9f839842 Automatic date update in version.in 2021-02-01 00:00:41 +00:00
GDB Administrator
5b814b6e4c Automatic date update in version.in 2021-01-31 00:00:52 +00:00
GDB Administrator
5eae73d750 Automatic date update in version.in 2021-01-30 00:00:30 +00:00
Alan Modra
fe0e833171 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:07:15 +10:30
Alan Modra
00e280d52a PR27271, c6x-uclinux-ld segfaults linking ld-uClibc-1.0.37.so
bfd/
	PR 27271
	* elflink.c (bfd_elf_link_record_dynamic_symbol): Don't segfault
	on symbols defined in absolute or other special sections.
ld/
	* testsuite/ld-tic6x/tic6x.exp: Add pr27271 test.

(cherry picked from commit c4566785ac)
2021-01-29 11:51:01 +10:30
GDB Administrator
6ff2462fbf Automatic date update in version.in 2021-01-29 00:00:30 +00:00
H.J. Lu
69caaa81ae 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:30:02 -08:00
GDB Administrator
5e7a8f40bd Automatic date update in version.in 2021-01-28 00:00:36 +00:00
Nick Alcock
e9013bbd33 ld: depend on libctf
Since ld may depend on libctf (if present), and libctf may be relinked
by the installation process, libctf must be installed before ld is,
or the relink may fail if it calls on symbols or symbol versions that do
not exist in any libctf already present on the system.  (If none is
present, the copy in the build tree will be automatically used, but
if one *is* present, it may take precedence and break things.)

(This is a maybe- dependency, so it will work even if libctf is
disabled.)

ChangeLog
2021-01-26  Nick Alcock  <nick.alcock@oracle.com>

	* Makefile.def: Add install-libctf dependency to install-ld.
	* Makefile.in: Regenerated.
2021-01-27 11:05:32 +00:00
Nick Clifton
185390e3ca Update the DWARF sections recognuised by ELF linker scripts.
PR ld/27230
        * scripttempl/DWARF.sc: Add DWARF-5 .debug_* sections.
2021-01-27 09:02:05 +00:00
GDB Administrator
0dd1ac834b Automatic date update in version.in 2021-01-27 00:00:35 +00:00
Alan Modra
510753f848 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:44:12 +10:30
Alan Modra
8a04178688 pr27228 testcase
This failed on ft32, hppa, and mips-irix targets.  In the case of ft32
the problem was iterating over an array in reverse and not using the
proper condition, so BFD_RELOC_NONE was not recognised.

bfd/
	* elf32-ft32.c (ft32_reloc_type_lookup): Don't miss ft32_reloc_map[0].
gas/
	PR 27282
	* testsuite/gas/all/none.d: Replace skip with xfail, don't xfail ft32.
	* testsuite/gas/elf/pr27228.d: xfail hppa and allow OBJECT match.

(cherry picked from commit 4287950e54)
2021-01-27 08:41:44 +10:30
Frederic Cambus
3fb37e4554 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:40:29 +10:30
H.J. Lu
0db21b8a2b nios2: Don't disable relaxation with --gdwarf-N
GCC 11 passes --gdwarf-5 to assembler to enable DWARF5 debug info.  Don't
disable relaxation when --gdwarf-N is specified.  The assembler generated
debug information will treat the sequence of the relaxed instructions as
a single instruction.

	PR gas/27243
	* config/tc-nios2.c (md_begin): Don't disable relaxation with
	--gdwarf-N.
	* testsuite/gas/nios2/relax.d: New file.
	* testsuite/gas/nios2/relax.s: Likewise.

(cherry picked from commit 1f583bc2fc)
2021-01-26 08:47:02 -08:00
GDB Administrator
fa15c4160a Automatic date update in version.in 2021-01-26 00:00:35 +00:00
GDB Administrator
d1cdec5b03 Automatic date update in version.in 2021-01-25 00:00:37 +00:00
H.J. Lu
5876ea37df 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:04:49 -08:00
H.J. Lu
8b236dfbac gas: Add a testcase for PR gas/27228
PR gas/27228
	* testsuite/gas/elf/elf.exp: Run pr27228.
	* testsuite/gas/elf/pr27228.d: New file.
	* testsuite/gas/elf/pr27228.s: Likewise.

(cherry picked from commit eea133e655)
2021-01-24 04:20:11 -08:00
Nick Clifton
acda002755 Enable development. Set version to 2.36.0 2021-01-24 11:50:31 +00:00
Nick Clifton
9288e0fae6 2.36 release 2021-01-24 10:49:36 +00:00
Alan Modra
1aaad1d55d PR27228, .reloc wrong symbol emitted for undefined local symbol
Local symbols are of course supposed to be defined by their object
file, but in other cases a local symbol is promoted to global by gas
if undefined and referenced.  This patch stops gas wrongly replacing a
local undefined symbol with the undefined section symbol, resulting in
a .reloc undefined local symbol being emitted as global.

	PR 27228
	* write.c (resolve_reloc_expr_symbols): Don't assume local symbol
	is defined.

(cherry picked from commit 68fcee4fa7)
2021-01-24 16:19:53 +10:30
H.J. Lu
74c1e3df55 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:19:31 -08:00
GDB Administrator
b98520957b Automatic date update in version.in 2021-01-24 00:00:31 +00:00
GDB Administrator
33e5330bec Automatic date update in version.in 2021-01-23 00:00:35 +00:00
GDB Administrator
68e4a5a7df Automatic date update in version.in 2021-01-22 00:00:40 +00:00
Alan Modra
e6d79648ad PR27221, 058430b4a1 warnings while assembling the Linux kernel
PR 27221
	* dwarf2dbg.c (dwarf2_gen_line_info_1): Don't warn about ignored
	line number info when gas is generating it.
	* testsuite/gas/elf/dwarf2-20.d: Adjust to not expect warnings.
	* testsuite/gas/m68hc11/indexed12.d: Likewise.
	* testsuite/gas/elf/elf.exp: Don't run warn-2.
	* gas/testsuite/gas/elf/warn-2.s: Delete.

(cherry picked from commit be07043ea8)
2021-01-21 19:15:09 +10:30
Alan Modra
1586c504e0 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-21 19:14:21 +10:30
Alan Modra
37f3ab9c7c mips XPASS pr26936
git commit 994b251328 "Ignore section symbols when matching linkonce
with comdat" cured the reason why this test used to fail on mips.

	* testsuite/ld-elf/pr26936.d: No longer xfail mips.

(cherry picked from commit c78eec4424)
2021-01-21 19:13:50 +10:30
GDB Administrator
760c937dc1 Automatic date update in version.in 2021-01-21 00:00:53 +00:00
Alan Modra
088572dad9 PowerPC64 synthetic symbols
If an assembler trims off unused section symbols there may be no
section symbols.  This means that testing for the .opd section symbol
needs to test both the section name and symbol flags.

	* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't assume
	section symbols are present.

(cherry picked from commit 8bd10d6b16)
2021-01-20 22:47:48 +10:30
GDB Administrator
b6f526fb86 Automatic date update in version.in 2021-01-20 00:01:01 +00:00
Nick Alcock
296ffb5ad6 libctf, create: fix ctf_type_add of structs with unnamed members
Our recent commit to support unnamed structure members better ditched
the old ctf_member_iter iterator body in favour of ctf_member_next.
However, these functions treat unnamed structure members differently:
ctf_member_iter just returned whatever the internal representation
contained, while ctf_member_next took care to always return "" rather
than sometimes returning "" and sometimes NULL depending on whether the
dict was dynamic (a product of ctf_create) or not (a product of
ctf_open).  After this commit, ctf_member_iter did the same.

It was always a bug for external callers not to treat a "" return from
these functions as if it were NULL, so only buggy callers could be
affected -- but one of those buggy callers was ctf_add_type, which
assumed that it could just take whatever name was returned from
ctf_member_iter and slam it directly into the internal representation of
a dynamic dict -- which expects NULL for unnamed members, not "".  The
net effect of all of this is that taking a struct containing unnamed
members and ctf_add_type'ing it into a dynamic dict produced a dict
whose unnamed members were inaccessible to ctf_member_info (though if
you wrote that dict out and then ctf_open'ed it, they would magically
reappear again).

Compensate for this by suitably transforming a "" name into NULL in the
internal representation, as should have been done all along.

libctf/ChangeLog
2021-01-19  Nick Alcock  <nick.alcock@oracle.com>

	* ctf-create.c (membadd): Transform ""-named members into
	NULL-named ones.
	* testsuite/libctf-regression/type-add-unnamed-struct*: New test.

(cherry picked from commit 26503e2f5e)
2021-01-19 15:23:25 +00:00
Nick Alcock
b7540e2b88 libctf: lookup_by_name: do not return success for nonexistent pointer types
The recent work allowing lookups of pointers in child dicts when the
pointed-to type is in the parent dict broke the case where a pointer
type that does not exist at all is looked up: we mistakenly return the
pointed-to type, which is likely not a pointer at all.  This causes
considerable confusion.

Fixed, with a new testcase.

libctf/ChangeLog
2021-01-19  Nick Alcock  <nick.alcock@oracle.com>

	* ctf-lookup.c (ctf_lookup_by_name_internal): Do not return the
	base type if looking up a nonexistent pointer type.
	* testsuite/libctf-regression/pptrtab*: Test it.

(cherry picked from commit e05a3e5a49)
2021-01-19 15:23:16 +00:00
Alan Modra
d235291c81 [GOLD] powerpc assertion failure
A testcase with only ifuncs can result in no plt section (ifunc plt
entries might instead be in iplt), which means we can get to this code
without a static link.

	PR 27203
	* powerpc.cc (do_plt_fde_location): Remove doing_static_link
	assertion.

(cherry picked from commit a75a6a4164)
2021-01-19 13:30:22 +10:30
Nelson Chu
4c899d5386 ld: Just xfail riscv little endian targets for compressed1d.d test.
The sizes of compressed and uncompressed .debug_aranges are the same
for the riscv big endian targets, but different for the little endian
targets.  The compress rule is fine and isn't broken by riscv, just the
original compressed1d.d fails by accident.  Ideally, we should fill the
R_RISCV_ADD/SUB relocations when disabling relaxations in the assembler.
But before that, Jim already had written an alternative test compressed1d-alt
to relpace compressed1d.d for riscv, so we can only xfail the riscv little
endian targets in the short-term.

ld/
    * testsuite/ld-elf/elf.exp (riscv_little_endian): Added.  Return true
    if target is riscv little endian.  Otherwise, return false.
    * testsuite/ld-elf/compressed1d.d: Only xfail the riscv little endian
    targets by [riscv_little_endian].
2021-01-19 09:57:10 +08:00
GDB Administrator
216767c47e Automatic date update in version.in 2021-01-19 00:01:06 +00:00
H.J. Lu
4e02d082a3 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-18 06:40:44 -08:00
H.J. Lu
31c8a013bc gold: Remove the circular IFUNC dependency in ifuncmain6pie
On Fedora 33 x86-64 with glibc 2.32-3, ifuncmain6pie failed with:

./ifuncmain6pie: IFUNC symbol 'foo' referenced in './ifuncmod6.so' is defined in the executable and creates an unsatisfiable circular dependency.
FAIL ifuncmain6pie (exit status: 127)

Remove non-JUMP_SLOT relocations against foo in ifuncmod6.so, which
trigger the circular IFUNC dependency.

	* testsuite/ifuncmain6pie.c: Remove non-JUMP_SLOT relocations
	against foo in ifuncmod6.so.
	* testsuite/ifuncmod6.c: Likewise.

(cherry picked from commit 25294ff049)
2021-01-18 04:56:07 -08:00
H.J. Lu
31768fcb32 ld/elf: Ignore section symbols when matching linkonce with comdat
When deciding if a single member comdat group section in file FOO should
be discarded by a linkonce section in file BAR, we check if 2 sections
define the same set of local and global symbols.  When only one of the
files doesn't contain the unused section symbols in the symbol table,
such as object files generated by clang or GNU assembler with

commit d1bcae833b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jan 7 06:42:00 2021 -0800

    ELF: Don't generate unused section symbols

the check will fail since one file has the extra unused section symbols.
We should ignore both undefined and section symbols in the symbol table
when making such a decision.

bfd/

	PR ld/27193
	* elflink.c (elf_create_symbuf): Also ignore section symbols.

ld/

	PR ld/27193
	* testsuite/ld-i386/i386.exp: Run PR ld/27193 test.
	* testsuite/ld-i386/pr27193.dd: New file.
	* testsuite/ld-i386/pr27193a.o.bz2: Likewise.
	* testsuite/ld-i386/pr27193b.s: Likewise.

(cherry picked from commit 994b251328)
2021-01-18 04:52:55 -08:00
H.J. Lu
e9815c344e ld/elf/x86: Don't compare IFUNC address in the shared object
On x86, glibc 2.33 starts to issue a fatal error message when calling
IFUNC function defined in the unrelocated executable from a shared
library.

1. Update x86 ELF linker to always convert IFUNC function defined in
position-dependent executable (PDE) to the normal function.  GOT in PDE
will be updated by R_*_IRELATIVE at run-time.
2. Update PR ld/23169 tests not to compare function address of external
IFUNC function in the shared object to avoid calling the IFUNC function
defined in the unrelocated executable.
3. Remove pr23169e tests which call the IFUNC function defined in the
unrelocated position-independent executable from a shared library.

bfd/

	PR ld/23169
	* elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): Don't
	check pointer_equality_needed.

ld/

	PR ld/23169
	* testsuite/ld-ifunc/ifunc.exp: Replace pr23169c.rd with
	pr23169a.rd for pr23169c and pr23169f.  Remove pr23169e tests.
	* testsuite/ld-ifunc/pr23169a.c (foo): Don't compare function
	address.

(cherry picked from commit 75a933f399)
2021-01-18 04:48:04 -08:00
GDB Administrator
4c595b36a7 Automatic date update in version.in 2021-01-18 00:00:42 +00:00
GDB Administrator
59044bc0fa Automatic date update in version.in 2021-01-17 00:00:46 +00:00
GDB Administrator
df5ec93dda Automatic date update in version.in 2021-01-16 00:00:41 +00:00
GDB Administrator
33d9daf0a6 Automatic date update in version.in 2021-01-15 00:00:43 +00:00
H.J. Lu
2bbb84d5e1 bfin: Skip non SEC_ALLOC section for R_BFIN_FUNCDESC
Linker should never generate dynamic relocations for relocations in
non-SEC_ALLOC section which has no impact on run-time behavior.  Such
relocations should be resolved to 0.

	PR ld/26688
	* elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
	section for R_BFIN_FUNCDESC.

(cherry picked from commit 8ca9c7eb67)
2021-01-14 06:11:08 -08:00
Nick Clifton
13de3b4b63 Updated translations for some subdirectories 2021-01-14 12:55:06 +00:00
Nick Clifton
5dda6736c2 Fix an illegal memory access parsing a win32pstatus note with a type of 0.
* elf.c (elfcore_grok_win32pstatus): Check for a note type of 0.
2021-01-14 09:16:58 +00:00
GDB Administrator
c28c047c41 Automatic date update in version.in 2021-01-14 00:00:46 +00:00
GDB Administrator
5e7caf03b3 Automatic date update in version.in 2021-01-13 00:00:37 +00:00