16934 Commits

Author SHA1 Message Date
Nick Clifton
6e0dfbf420 Updated translations (mainly Ukranian and French) triggered by creation of 2.37 branch. 2021-07-05 15:54:35 +01:00
Alan Modra
b4c4b8aaad PR28055, segfault in bpf special reloc function
The testcase in this PR tickled two bugs fixed here.  output_bfd is
NULL when a reloc special_function is called for final linking and
when called from bfd_generic_get_relocated_section_contents.  Clearly
using output_bfd is wrong as it results in segfaults.  Not only that,
the endianness of the reloc field really should be that of the input.
The second bug was not checking that the entire reloc field was
contained in the section contents.

	PR 28055
	* elf64-bpf.c (bpf_elf_generic_reloc): Use correct bfd for bfd_put
	and bfd_put_32 calls.  Correct section limit checks.
2021-07-05 21:39:33 +09:30
GDB Administrator
74ace05485 Automatic date update in version.in 2021-07-05 00:00:10 +00:00
GDB Administrator
bdec4c4f1e Automatic date update in version.in 2021-07-04 00:00:09 +00:00
Nick Clifton
346d80ef33 Update version number and regenerate files 2021-07-03 15:16:48 +01:00
Nick Clifton
514192487e Add markers for 2.37 branch 2021-07-03 14:50:57 +01:00
GDB Administrator
0d03c52682 Automatic date update in version.in 2021-07-03 00:00:10 +00:00
Nick Clifton
49910fd88d Fix an illegal memory access triggered by an attempt to parse a corrupt input file.
PR 28046
	* dwarf2.c (read_ranges): Check that range_ptr does not exceed
	range_end.
2021-07-02 14:56:36 +01:00
GDB Administrator
72ab7b79dc Automatic date update in version.in 2021-07-02 00:00:12 +00:00
GDB Administrator
9cb74cfd81 Automatic date update in version.in 2021-07-01 00:00:11 +00:00
YunQiang Su
9a39f7389d Mark .gnu.debuglto_.debug_* as SHT_MIPS_DWARF
PR mips/28009
	* bfd/elfxx-mips.c (_bfd_mips_elf_section_from_shdr,
	_bfd_mips_elf_fake_sections): Mark LTO debug info as
	SHT_MIPS_DWARF.
2021-06-30 17:16:22 +01:00
GDB Administrator
aa2e84dee6 Automatic date update in version.in 2021-06-30 00:00:09 +00:00
Nick Clifton
c2ce831330 Add the netbsdpe configuration to the list of obsolete targets.
* config.bfd (obsolete configurations): Add netbsdpe.
2021-06-29 16:46:05 +01:00
GDB Administrator
327f11dee1 Automatic date update in version.in 2021-06-29 00:00:12 +00:00
GDB Administrator
9df51d7c47 Automatic date update in version.in 2021-06-28 00:00:11 +00:00
GDB Administrator
f1fa7a3d88 Automatic date update in version.in 2021-06-27 00:00:13 +00:00
GDB Administrator
ac2d77c6a1 Automatic date update in version.in 2021-06-26 00:00:10 +00:00
GDB Administrator
22c6cfe9c8 Automatic date update in version.in 2021-06-25 00:00:11 +00:00
GDB Administrator
02ddf7223d Automatic date update in version.in 2021-06-24 00:00:09 +00:00
GDB Administrator
0b98ef1642 Automatic date update in version.in 2021-06-23 00:00:11 +00:00
Nelson Chu
50331d64f1 RISC-V: Clarify the addends of pc-relative access.
The original discussion was here,
https://github.com/riscv/riscv-elf-psabi-doc/issues/184

After discussing with Kito Cheng, I think the addends of %pcrel_hi
and %pcrel_lo are both allowed in GNU toolchain.  However, both of
the them mean the offset of symbols, rather than the pc address.
But the addends of %got_pcrel_hi and it's %pcrel_lo do not look
reasonable.  I believe gcc won't generate the got patterns with
addends, so linker should report dangerous relocation errors,
in case the assembly code use them.

Another issue was here,
https://sourceware.org/pipermail/binutils/2021-June/116983.html

At the beginnig, I suppose %pcrel_hi and %pcrel_lo are valid only
when they are in the same input section.  But Jim Wilson points out
that gcc may generate %hi and %lo in the different input sections,
when -freorder-blocks-and-partition option is used.  So that a memory
references for a loop may have the %hi outside the loop, but the %lo
remain in the loop.  However, it is hard to create the testcases,
to see if %pcrel_hi and %pcrel_lo have the same behavior.

Unfortunately, I notice that the current pcrel resolver cannot
work for the above case.  For now we build a hash table for pcrel
at the start of riscv_elf_relocate_section, and then free the hash
at the end.  But riscv_elf_relocate_section only handles an input
section at a time, so that means we can only resolve the %pcrel_hi
and %pcrel_lo which are in the same input section.  Otherwise, like
the above case, we will report "%pcrel_lo missing matching %pcrel_hi"
for them.  I have no plan to improve this in the short-term, so maybe
we can wait until someone meets the problem before we deal with it.

bfd/
    * elfnn-riscv.c (riscv_pcrel_hi_reloc): Added field to store
    the original relocation type, in case the type is converted to
    R_RISCV_HI20.
    (riscv_pcrel_lo_reloc): Removed unused name field.
    (riscv_pcrel_relocs): Added comments.
    (riscv_zero_pcrel_hi_reloc): Removed unused input_bfd.
    (riscv_record_pcrel_hi_reloc): Updated.
    (riscv_record_pcrel_lo_reloc): Likewise.
    (riscv_resolve_pcrel_lo_relocs): Likewise.  Check the original
    type of auipc, to make sure the %pcrel_lo without any addends.
    Otherwise, report dangerous relocation error.
    (riscv_elf_relocate_section): Updated above functions are changed.
    For R_RISCV_GOT_HI20, report dangerous relocation error when addend
    isn't zero.
ld/
    * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3a.d: New testcase.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3a.s: Likewise.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3b.d: New testcase.
    Should report error since the %pcrel_lo with addend refers to
    %got_pcrel_hi.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3b.s: Likewise.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3c.d: New testcase.
    Should report error since the %got_pcrel_hi with addend.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3c.s: Likewise.
    * testsuite/ld-riscv-elf/pcrel-lo-addend-3.ld: Likewise.
2021-06-22 17:14:55 +08:00
GDB Administrator
b4ee29a445 Automatic date update in version.in 2021-06-22 00:00:08 +00:00
GDB Administrator
e27c0d7ae3 Automatic date update in version.in 2021-06-21 00:00:08 +00:00
H.J. Lu
406b4ada55 x86: Count PLT for GOTOFF relocation against IFUNC symbol
Since GOTOFF relocations against IFUNC symbols must go through PLT,
set PLT reference count to 1 for GOTOFF relocation.

bfd/

	PR ld/27998
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Count PLT for GOTOFF
	relocation against IFUNC symbols.
	(_bfd_x86_elf_adjust_dynamic_symbol): Likewise.

ld/

	PR ld/27998
	* testsuite/ld-i386/i386.exp: Run PR ld/27998 tests.
	* testsuite/ld-i386/pr27998a.d: New file.
	* testsuite/ld-i386/pr27998a.s: Likewise.
	* testsuite/ld-i386/pr27998b.d: Likewise.
	* testsuite/ld-i386/pr27998b.s: Likewise.
2021-06-19 20:21:04 -07:00
GDB Administrator
89ee1c2f6e Automatic date update in version.in 2021-06-20 00:00:08 +00:00
H.J. Lu
83b1d8f4a6 elf: Correct DT_TEXTREL warning in PDE
Change

ld: warning: creating DT_TEXTREL in a PIE

to

ld: warning: creating DT_TEXTREL in a PDE

on PDE.

bfd/

	* elflink.c (bfd_elf_final_link): Correct DT_TEXTREL warning in
	PDE.

ld/

	* testsuite/ld-x86-64/textrel-1.err: New file.
	* testsuite/ld-x86-64/textrel-1a.s: Likewise.
	* testsuite/ld-x86-64/textrel-1b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run textrel-1 tests.
2021-06-19 16:33:35 -07:00
GDB Administrator
8ee63c6156 Automatic date update in version.in 2021-06-19 00:00:07 +00:00
H.J. Lu
5a767724d7 elf: Add GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX
Implement GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX:

https://sourceware.org/pipermail/gnu-gabi/2021q1/000467.html

1. GNU_PROPERTY_UINT32_AND_LO..GNU_PROPERTY_UINT32_AND_HI

 #define GNU_PROPERTY_UINT32_AND_LO 0xb0000000
 #define GNU_PROPERTY_UINT32_AND_HI 0xb0007fff

A bit in the output pr_data field is set only if it is set in all
relocatable input pr_data fields.  If all bits in the the output
pr_data field are zero, this property should be removed from output.

If the bit is 1, all input relocatables have the feature.  If the
bit is 0 or the property is missing, the info is unknown.

2. GNU_PROPERTY_UINT32_OR_LO..GNU_PROPERTY_UINT32_OR_HI

 #define GNU_PROPERTY_UINT32_OR_LO 0xb0008000
 #define GNU_PROPERTY_UINT32_OR_HI 0xb000ffff

A bit in the output pr_data field is set if it is set in any
relocatable input pr_data fields. If all bits in the the output
pr_data field are zero, this property should be removed from output.

If the bit is 1, some input relocatables have the feature.  If the
bit is 0 or the property is missing, the info is unknown.

bfd/

	* elf-properties.c (_bfd_elf_parse_gnu_properties): Handle
	GNU_PROPERTY_UINT32_AND_LO, GNU_PROPERTY_UINT32_AND_HI,
	GNU_PROPERTY_UINT32_OR_LO and GNU_PROPERTY_UINT32_OR_HI.
	(elf_merge_gnu_properties): Likewise.

binutils/

	* readelf.c (print_gnu_property_note): Handle
	GNU_PROPERTY_UINT32_AND_LO, GNU_PROPERTY_UINT32_AND_HI,
	GNU_PROPERTY_UINT32_OR_LO and GNU_PROPERTY_UINT32_OR_HI.

include/

	* elf/common.h (GNU_PROPERTY_UINT32_AND_LO): New.
	(GNU_PROPERTY_UINT32_AND_HI): Likewise.
	(GNU_PROPERTY_UINT32_OR_LO): Likewise.
	(GNU_PROPERTY_UINT32_OR_HI): Likewise.

ld/

	* testsuite/ld-elf/property-and-1.d: New file.
	* testsuite/ld-elf/property-and-1.s: Likewise.
	* testsuite/ld-elf/property-and-2.d: Likewise.
	* testsuite/ld-elf/property-and-2.s: Likewise.
	* testsuite/ld-elf/property-and-3.d: Likewise.
	* testsuite/ld-elf/property-and-3.s: Likewise.
	* testsuite/ld-elf/property-and-4.d: Likewise.
	* testsuite/ld-elf/property-and-empty.s: Likewise.
	* testsuite/ld-elf/property-or-1.d: Likewise.
	* testsuite/ld-elf/property-or-1.s: Likewise.
	* testsuite/ld-elf/property-or-2.d: Likewise.
	* testsuite/ld-elf/property-or-2.s: Likewise.
	* testsuite/ld-elf/property-or-3.d: Likewise.
	* testsuite/ld-elf/property-or-3.s: Likewise.
	* testsuite/ld-elf/property-or-4.d: Likewise.
	* testsuite/ld-elf/property-or-empty.s: Likewise.
2021-06-18 07:19:01 -07:00
GDB Administrator
4470708442 Automatic date update in version.in 2021-06-18 00:00:08 +00:00
GDB Administrator
62cfa544a4 Automatic date update in version.in 2021-06-17 00:00:08 +00:00
GDB Administrator
bc10b67271 Automatic date update in version.in 2021-06-16 00:00:06 +00:00
GDB Administrator
1ff18ee652 Automatic date update in version.in 2021-06-15 00:00:07 +00:00
GDB Administrator
f4d7566aef Automatic date update in version.in 2021-06-14 00:00:07 +00:00
GDB Administrator
4b530cfa37 Automatic date update in version.in 2021-06-13 00:00:07 +00:00
GDB Administrator
6fe7f5c416 Automatic date update in version.in 2021-06-12 00:00:08 +00:00
Alan Modra
f64b9b13ce PR27952, Disallow ET_DYN DF_1_PIE linker input
This patch adds a new elf_tdata flag, is_pie, set during the linker's
open_input_bfds processing.  The flag is then used to reject attempts
to link a PIE as if it were a shared library.

bfd/
	PR 27952
	* elf-bfd.h (struct elf_obj_tdata): Add is_pie.
	* elflink.c (elf_link_add_object_symbols): Set is_pie.
ld/
	PR 27952
	* ldelf.c (ldelf_after_open): Error on input PIEs too.
2021-06-11 14:06:47 +09:30
GDB Administrator
860cc54cd4 Automatic date update in version.in 2021-06-11 00:00:26 +00:00
GDB Administrator
c572c4580e Automatic date update in version.in 2021-06-10 00:00:09 +00:00
Nick Clifton
f75bcf7e57 Fix the creation of archives for Sparc Solaris2 targets by eliminating the support for generic SPARC ELF files.
PR 27666
bfd	* config.bfd: Do not add the sparc_elf32_vec or sparc_elf64_vec
	vectors to Sparc Solaris2 targets.

ld	* testsuite/ld-sparc/sparc.exp: Do not run the sparctests or
	sparc64tests for Solaris2 targets.
2021-06-09 11:10:16 +01:00
GDB Administrator
1bc5b62129 Automatic date update in version.in 2021-06-09 00:00:07 +00:00
Michael Matz
5804373d03 bfd/elf: Don't read non-existing secondary relocs
I forgot the ChangeLog commit :-/
2021-06-08 17:40:17 +02:00
Michael Matz
956ea65cd7 bfd/elf: Don't read non-existing secondary relocs
Without this we unconditionally try to slurp in secondary
relocs for each input section, leading to quadratic behaviour
even for strip(1).  On write-out we already used a flag to avoid
this.

So track existence of secondary relocs on read-in as well and
only slurp in when needed.  This still doesn't implement a proper
list of secondary reloc sections, and still would exhibit quadratic
behaviour if most input sections have a secondary reloc section.
But at least on normal input this avoids any slowdown from trying
to handle secondary relocation sections.

bfd/
	* elf.c (bfd_section_from_shdr): Set has_secondary_relocs flag.
	(_bfd_elf_slurp_secondary_reloc_section): Use it for early-out.
2021-06-08 16:30:07 +02:00
GDB Administrator
e266dea992 Automatic date update in version.in 2021-06-08 00:00:41 +00:00
Jan Beulich
6bee34a1dc fix Dwarf2 build with certain gcc versions
Older gcc reports:

.../bfd/dwarf2.c: In function 'read_ranges':
.../bfd/dwarf2.c:3107: error: comparison between signed and unsigned
.../bfd/dwarf2.c: In function 'read_rnglists':
.../bfd/dwarf2.c:3189: error: comparison between signed and unsigned

Similarly for binutils/dwarf.c. Arrange for the left sides of the > to
also be unsigned quantities.
2021-06-07 08:48:26 +02:00
GDB Administrator
53f18dfd3e Automatic date update in version.in 2021-06-07 00:00:46 +00:00
GDB Administrator
9482e6e450 Automatic date update in version.in 2021-06-06 00:00:44 +00:00
GDB Administrator
30569fbb57 Automatic date update in version.in 2021-06-05 00:00:55 +00:00
GDB Administrator
25e821a6c2 Automatic date update in version.in 2021-06-04 00:00:51 +00:00
GDB Administrator
9ef5bfdad9 Automatic date update in version.in 2021-06-03 00:00:44 +00:00
Alan Modra
45342c7c91 asan: heap buffer overflow in _bfd_elf_parse_attributes
* elf-attrs.c (_bfd_elf_parse_attributes): Break out of loop if
	subsection length is too small to cover tag and length field.
2021-06-02 14:47:17 +09:30