Commit Graph

15090 Commits

Author SHA1 Message Date
Nick Clifton 219d6836e9 Fix a segmentation fault triggered by disassembling an EFi file with source included.
* dwarf2.c (_bfd_dwarf2_find_symbol_bias): Check for a NULL symbol
	table pointer.
	* coffgen.c (coff_find_nearest_line_with_names): Do not call
	_bfd_dwarf2_find_symbol_bias if there is no symbol table available.

https://bugzilla.redhat.com/show_bug.cgi?id=1685727
2019-03-06 09:43:54 +00:00
GDB Administrator 2d0d5fc6f0 Automatic date update in version.in 2019-03-06 00:00:46 +00:00
GDB Administrator 54c56910ee Automatic date update in version.in 2019-03-05 00:00:26 +00:00
GDB Administrator 67490c6bad Automatic date update in version.in 2019-03-04 00:00:30 +00:00
GDB Administrator 60a88cee92 Automatic date update in version.in 2019-03-03 00:00:38 +00:00
GDB Administrator ca5a17b09e Automatic date update in version.in 2019-03-02 00:00:57 +00:00
Andreas Krebbel 24801b1576 Revert "Add support to GNU ld to separate got related plt entries"
bfd/ChangeLog:

2019-03-01  Andreas Krebbel  <krebbel@linux.ibm.com>

	This reverts commit 5a12586d44.
	2019-01-14  Maamoun Tarsha  <maamountk@hotmail.com>

	PR 20113
	* elf32-s390.c (allocate_dynrelocs): Update comment.

ld/ChangeLog:

2019-03-01  Andreas Krebbel  <krebbel@linux.ibm.com>

	This reverts commit 5a12586d44.
	2019-01-14  Maamoun Tarsha  <maamountk@hotmail.com>

	PR 20113
	* emulparams/elf64_s390.sh (SEPARATE_GOTPLT): Define.
	* emulparams/elf_s390.sh (SEPARATE_GOTPLT): Define.
	* testsuite/ld-s390/gotreloc_31-1.dd: Update expected output.
	* testsuite/ld-s390/tlsbin.dd: Likewise.
	* testsuite/ld-s390/tlsbin.rd: Likewise.
	* testsuite/ld-s390/tlsbin.sd: Likewise.
	* testsuite/ld-s390/tlsbin_64.dd: Likewise.
	* testsuite/ld-s390/tlsbin_64.rd: Likewise.
	* testsuite/ld-s390/tlsbin_64.sd: Likewise.
	* testsuite/ld-s390/tlspic.dd: Likewise.
	* testsuite/ld-s390/tlspic.rd: Likewise.
	* testsuite/ld-s390/tlspic.sd: Likewise.
	* testsuite/ld-s390/tlspic_64.dd: Likewise.
	* testsuite/ld-s390/tlspic_64.rd: Likewise.
	* testsuite/ld-s390/tlspic_64.sd: Likewise.
	* testsuite/ld-s390/s390.exp: Skip s390 tests for tpf targets.
2019-03-01 15:35:00 +01:00
Tamar Christina 4ffd290906 Binutils: Always skip only 1 byte for CIE version 1's return address register.
According to the specification for the CIE entries, when the CIE version is 1 then
the return address register field is always 1 byte.  Readelf does this correctly in
read_cie in dwarf.c but ld does this incorrectly and always tries to read a
skip_leb128.  If the value here has the top bit set then ld will incorrectly read
at least another byte, causing either an assert failure or an incorrect address to
be used in eh_frame.

I'm not sure how to generate a generic test for this as I'd need to write assembly,
and it's a bit hard to trigger. Essentially the relocated value needs to start with
something that & 0x70 != 0x10 while trying to write a personality.

bfd/ChangeLog:

	* elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Correct CIE parse.
2019-03-01 11:38:22 +00:00
Alan Modra b24cc4146e PR24272, out-of-bounds read in pex64_xdata_print_uwd_codes
The fix here is to use an unsigned comparison for
    if (a->NumberOfRvaAndSizes > IMAGE_NUMBEROF_DIRECTORY_ENTRIES)

include/
	PR 24272
	* coff/internal.h (struct internal_extra_pe_aouthdr): Change type
	of SizeOfCode, SizeOfInitializedData, and SizeOfUninitializedData
	to bfd_vma.  Change type of SectionAlignment, FileAlignment,
	Reserved1, SizeOfImage, SizeOfHeaders, CheckSum, LoaderFlags,
	and NumberOfRvaAndSizes to uint32_t.
bfd/
	PR 24272
	* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Use unsigned index.
	(_bfd_XX_print_private_bfd_data_common): Adjust for type changes.
2019-03-01 13:30:38 +10:30
GDB Administrator b09e83c1f8 Automatic date update in version.in 2019-03-01 00:00:52 +00:00
Nick Clifton eed5def8d0 Prevent a buffer overrun error when attempting to parse a corrupt ELF file.
PR 24273
	* elf.c (bfd_elf_string_from_elf_section): Check for a string
	section that is not NUL terminated.
2019-02-28 14:30:20 +00:00
GDB Administrator b8ec59a100 Automatic date update in version.in 2019-02-28 00:00:50 +00:00
H.J. Lu 5cfe428cd1 x86-64: Skip protected check on symbol defined by linker
Skip symbol defined by linker when checking copy reloc on protected
symbol.

bfd/

	PR ld/24276
	* elf64-x86-64.c (elf_x86_64_check_relocs): Skip symbol defined
	by linker when checking copy reloc on protected symbol.

ld/

	PR ld/24276
	* testsuite/ld-i386/i386.exp: Run PR ld/24276 test.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr24276.dso: New file.
	* testsuite/ld-i386/pr24276.warn: Likewise.
	* testsuite/ld-x86-64/pr24276.dso: Likewise.
	* testsuite/ld-x86-64/pr24276.warn: Likewise.
2019-02-27 11:53:27 -08:00
GDB Administrator 8e3173c608 Automatic date update in version.in 2019-02-27 00:00:37 +00:00
GDB Administrator c31307f9c5 Automatic date update in version.in 2019-02-26 00:00:25 +00:00
GDB Administrator 60245a92ce Automatic date update in version.in 2019-02-25 00:00:31 +00:00
Alan Modra f616c36b79 PR24144, pdp11-ld overwriting section data with zeros
bfd/
	PR 24144
	* pdp11.c (set_section_contents): Revert 2015-02-24 change.
gas/
	PR 24144
	* config/obj-aout.c (obj_aout_frob_file_before_fix): Write to end
	of section to ensure file contents cover aligned section size.
2019-02-24 18:57:04 +10:30
GDB Administrator 4323c5ad3c Automatic date update in version.in 2019-02-24 00:01:17 +00:00
GDB Administrator 8a7a93c20a Automatic date update in version.in 2019-02-23 00:00:56 +00:00
GDB Administrator 871f0fc66a Automatic date update in version.in 2019-02-22 00:00:37 +00:00
GDB Administrator 56b80d4c4c Automatic date update in version.in 2019-02-21 00:00:40 +00:00
Max Filippov eed62915fd bfd: xtensa: fix callx relaxation
Big section alignment requirements between source and destination of a
long call can result in making call range bigger than what's reachable
by the call opcode. Add biggest section alignment of sections between
the call site and call destination to the call distance when making
long call relaxation decision.

2019-02-20  Eric Tsai  <erictsai@cadence.com>
bfd/
	* elf32-xtensa.c (is_resolvable_asm_expansion): Scan output
	sections between the call site and call destination and adjust
	call distance by the largest alignment.

ld/
	* testsuite/ld-xtensa/call_overflow.d: New test definition.
	* testsuite/ld-xtensa/call_overflow1.s: New test source.
	* testsuite/ld-xtensa/call_overflow2.s: New test source.
	* testsuite/ld-xtensa/call_overflow3.s: New test source.
	* testsuite/ld-xtensa/xtensa.exp: Add call_overflow test.
2019-02-20 02:51:01 -08:00
Alan Hayward e6c3b5bfb4 AArch64: Add pauth core file section
Used for the AArch64 pointer authentication code mask registers in Arm v8.3-a.

NT_ARM_PAC_MASK matches the value in Linux include/uapi/linux/elf.h

include/ChangeLog:

	* elf/common.h (NT_ARM_PAC_MASK): Add define.

bfd/ChangeLog:

	* elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
	* elf.c (elfcore_grok_aarch_pauth): New function.
	(elfcore_grok_note): Check for NT_ARM_PAC_MASK.
	(elfcore_write_aarch_pauth): New function.
	(elfcore_write_register_note): Check for AArch64 pauth section.
2019-02-20 10:39:28 +00:00
Alan Modra 34d75fb5c4 Check asprintf return value
git a31b8bd9a0 introduced a warning (depending on your system
headers).

	PR 24225
	* elf32-nios2.c (nios2_elf32_relocate_section): Check asprintf
	return value.
2019-02-20 18:54:41 +10:30
Michael Roitzsch edd01d077c Use or1k-darwin host SHARED_LIBADD for *-darwin.
* configure.ac (SHARED_LIBADD): Add -liberty -lintl for all
	Darwin hosts, not just or1k.
	* configure: Regenerate.
2019-02-20 14:49:07 +10:30
Alan Modra 8abac8031e PR24236, Heap buffer overflow in _bfd_archive_64_bit_slurp_armap
PR 24236
	* archive64.c (_bfd_archive_64_bit_slurp_armap): Move code adding
	sentinel NUL to string buffer nearer to loop where it is used.
	Don't go past sentinel when scanning strings, and don't write
	NUL again.
	* archive.c (do_slurp_coff_armap): Simplify string handling to
	archive64.c style.
2019-02-20 11:50:07 +10:30
GDB Administrator abaeb15626 Automatic date update in version.in 2019-02-20 00:00:41 +00:00
Alan Modra 179f2db0d9 PR24235, Read memory violation in pei-x86_64.c
PR 24235
	* pei-x86_64.c (pex64_bfd_print_pdata_section): Correct checks
	attempting to prevent read past end of section.
2019-02-19 22:52:55 +10:30
GDB Administrator c72e75a640 Automatic date update in version.in 2019-02-19 00:00:40 +00:00
Alan Modra a31b8bd9a0 PR24225, nios2 buffer overflow
PR 24225
	* elf32-nios2.c (nios2_elf32_relocate_section): Use asprintf and
	PRIx64 to generate warning messages.  Print local sym names too.
2019-02-18 15:12:34 +10:30
GDB Administrator d57e4f2b86 Automatic date update in version.in 2019-02-18 00:00:44 +00:00
GDB Administrator aa9e1dc0c6 Automatic date update in version.in 2019-02-17 00:01:01 +00:00
GDB Administrator 166e5d9d41 Automatic date update in version.in 2019-02-16 00:01:06 +00:00
GDB Administrator 99df80f894 Automatic date update in version.in 2019-02-15 00:01:15 +00:00
GDB Administrator e6e006612f Automatic date update in version.in 2019-02-14 00:00:28 +00:00
GDB Administrator 8918f84c04 Automatic date update in version.in 2019-02-13 00:00:39 +00:00
GDB Administrator 43c4685f14 Automatic date update in version.in 2019-02-12 00:00:12 +00:00
GDB Administrator 7115ab9c4b Automatic date update in version.in 2019-02-11 00:00:19 +00:00
GDB Administrator 10a54ace4a Automatic date update in version.in 2019-02-10 00:01:02 +00:00
Claudiu Zissulescu a0e90a73f0 [ARC] don't force _init/_fini as DT_INIT/DT_FINI.
Recent gcc commit b4371b277f1e ("[ARC] Enable init_array support")
inhibits DT_"INIT,FINI} in favor of DT_{INIT,FINI}ARRAY.

Even prior to that, it seems ARC port is the only one with this
special DT_INIT/FINI handling in linker emulation. Removing it
doesn't seem to change any uClibc/glibc testsuite results,
so this can RIP anyways.

bfd/
    2019-02-01  Vineet Gupta <vgupta@synopsys.com>

           * elf32-arc.c: Delete init_str, fini_str

ld/
    2019-02-01  Vineet Gupta <vgupta@synopsys.com>

           * emultempl/arclinux.em : Delete special INIT/FINI handling.
2019-02-09 11:07:42 +01:00
GDB Administrator d1ea488747 Automatic date update in version.in 2019-02-09 00:00:18 +00:00
Alan Modra 482f3505d1 Make inline plt reloc "unsupported for bss-plt" an error
This was always supposed to be an error.  Code emitted by gcc for
inline PLT calls assumes PLT is an array of addresses.

	* elf32-ppc.c (ppc_elf_relocate_section): Add %X to "unsupported
	for bss-plt" warning to make it an error.
2019-02-08 21:32:40 +10:30
GDB Administrator 2c6c61c3c9 Automatic date update in version.in 2019-02-08 00:00:37 +00:00
Eric Botcazou b2abe1bd81 SPARC: fix PR ld/18841
This fixes the last ld failures on SPARC64/Linux:

FAIL: Run pr18841 with libpr18841b.so
FAIL: Run pr18841 with libpr18841c.so
FAIL: Run pr18841 with libpr18841bn.so (-z now)
FAIL: Run pr18841 with libpr18841cn.so (-z now)

by mimicing what has been done on x86-64 and Aarch64 to fix the PR.

bfd/
	PR ld/18841
        * elf32-sparc.c (elf32_sparc_reloc_type_class): Return
        reloc_class_ifunc for ifunc symbols.
        * elf64-sparc.c (elf64_sparc_reloc_type_class): Likewise.
2019-02-07 17:04:31 +01:00
Eric Botcazou 68a091326f Visium: fix bogus overflow check on 32-bit hosts
bfd/
	* elf32-visium.c (visium_elf_howto_parity_reloc): Minor tweak.
	<R_VISIUM_PC16>: Use explicit range test to detect an overflow.
2019-02-07 17:02:24 +01:00
Nick Clifton 2012bf013b Move potentially obsolete BFD targets into the definitely obsolete section. Add a note to the README-how-to-make-a-release document about doing this.
bfd	* config.bfd: Move the powerpc-lynxos and powerpc-windiss targets
	into the definitely obsolete list.

binutils * README-how-to-make-a-release: Add a note about updating the
	obsolete targets in the bfd/config.bfd file.
2019-02-07 14:30:02 +00:00
GDB Administrator 31528deca5 Automatic date update in version.in 2019-02-07 00:00:52 +00:00
H.J. Lu 83924b3846 x86-64: Restore PIC check for PCREL reloc against protected symbol
commit bd7ab16b45
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 13 07:34:22 2018 -0800

    x86-64: Generate branch with PLT32 relocation

removed check R_X86_64_PC32 relocation against protected symbols in
shared objects.  Since elf_x86_64_check_relocs is called after we
have seen all input files, we can check for PC-relative relocations in
elf_x86_64_check_relocs.  We should not allow PC-relative relocations
against protected symbols since address of protected function and
location of protected data may not be in the shared object.

bfd/

	PR ld/24151
	* elf64-x86-64.c (elf_x86_64_need_pic): Check
	SYMBOL_DEFINED_NON_SHARED_P instead of def_regular.
	(elf_x86_64_relocate_section): Move PIC check for PC-relative
	relocations to ...
	(elf_x86_64_check_relocs): Here.
	(elf_x86_64_finish_dynamic_symbol): Use SYMBOL_DEFINED_NON_SHARED_P
	to check if a symbol is defined in a non-shared object.
	* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): New.

ld/

	PR ld/24151
	* testsuite/ld-x86-64/pr24151a-x32.d: New file.
	* testsuite/ld-x86-64/pr24151a.d: Likewise.
	* testsuite/ld-x86-64/pr24151a.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr24151a and pr24151a-x32.
2019-02-05 18:45:34 -08:00
GDB Administrator 4e9ac437aa Automatic date update in version.in 2019-02-06 00:00:22 +00:00
GDB Administrator 4dcfcfe063 Automatic date update in version.in 2019-02-05 00:00:29 +00:00