Commit graph

16293 commits

Author SHA1 Message Date
Alan Modra
67411cbf63 PR25022 testcase segfault for generic ELF linker targets
Even a testcase that is expected to fail shouldn't segfault.

	* elf.c (assign_section_numbers): Comment.  Don't segfault on
	discarded sections when setting linked-to section for generic
	ELF linker.
	* elflink.c (bfd_elf_match_symbols_in_sections): Allow NULL info.
2020-07-28 16:56:14 +09:30
GDB Administrator
cf0ae6e41f Automatic date update in version.in 2020-07-28 00:00:05 +00:00
Alan Modra
93fd13c704 Accept --just-symbols symbols as absolute for xcoff
This patch is aimed at curing
    just-symbols-1.o: loader reloc in unrecognized section `*ABS*'
for xcoff by treating symbols defined by --just-symbols objects as
absolute.

	* xcofflink.c (xcoff_need_ldrel_p): Accept --just-symbols symbols and
	similar as absolute.
	(bfd_xcoff_import_symbol): Don't fuss over absolute symbol
	redefinitions here.
2020-07-27 22:31:37 +09:30
GDB Administrator
9e3d7d43cf Automatic date update in version.in 2020-07-27 00:00:07 +00:00
GDB Administrator
a237ab1af0 Automatic date update in version.in 2020-07-26 00:00:06 +00:00
GDB Administrator
719251fee1 Automatic date update in version.in 2020-07-25 00:00:06 +00:00
Nick Clifton
04f096fb9e Move the xc16x target to the obsolete list 2020-07-24 12:01:48 +01:00
GDB Administrator
4b495c31c1 Automatic date update in version.in 2020-07-24 00:00:07 +00:00
GDB Administrator
25322a133a Automatic date update in version.in 2020-07-23 00:00:08 +00:00
Kevin Buettner
5efb677960 Update binary_get_section_contents to seek using section's file position
I have a patch for GDB which opens and reads from BFDs using the
"binary" target.  However, for it to work, we need to be able to get a
section's contents based from the file position of that section.

At the moment, reading a section's contents will always read from the
start of the file regardless of where that section is located.  While
this was fine for the original use of the "binary" target, it won't
work for my use case.  This change shouldn't impact any existing
callers due to the fact that the single .data section is initialized
with a filepos of 0.

bfd/ChangeLog:

	* binary.c (binary_get_section_contents): Seek using offset
	from section's file position.
2020-07-22 12:42:31 -07:00
Kevin Buettner
ea57e509a2 Remove hack for GDB which sets the section size to 0
This commit removes a hack for GDB which was introduced in 2007.
See:

    https://sourceware.org/ml/binutils/2007-08/msg00044.html

That hack mostly allowed GDB's handling of core files to continue to
work without any changes to GDB.

The problem with setting the section size to zero is that GDB won't
know how big that section is/was.  Often, this doesn't matter because
the data in question are found in the exec file.  But it can happen
that the section describes memory that had been allocated, but never
written to.  In this instance, the contents of that memory region are
not written to the core file.  Also, since the region in question was
dynamically allocated, it won't appear in the exec file.  We don't
want these regions to appear as inaccessible to GDB (since they *were*
accessible when the process was live), so it's important that GDB know
the size of the region.

I've made changes to GDB which correctly handles this case.  When
attempting to access memory, GDB will first consider core file data
for which both SEC_ALLOC and SEC_HAS_CONTENTS is set.  Next, if that
fails, GDB will attempt to find the data in the exec file.  Finally,
if that also fails, GDB will attempt to access memory in the sections
which are flagged as SEC_ALLOC, but not SEC_HAS_CONTENTS.

bfd/ChangeLog:

	* elf.c (_bfd_elf_make_section_from_phdr): Remove hack for GDB.
2020-07-22 12:32:24 -07:00
Max Filippov
1ad2776d3d bfd: xtensa: pr26246: fix removed_literal_compare
2020-07-22  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	PR 26246
	* elf32-xtensa.c (removed_literal_compare): Use correct pointer
	type for the first function argument. Rename pointers to reflect
	that they have distinct types.
2020-07-22 02:58:34 -07:00
GDB Administrator
98f5f7740a Automatic date update in version.in 2020-07-22 00:00:06 +00:00
GDB Administrator
3ce8f1ed68 Automatic date update in version.in 2020-07-21 00:00:06 +00:00
Alan Modra
2f5541f384 PR26265, Spurious 'gc-sections requires ... when --init or --fini
bfd/
	* elflink.c (_bfd_elf_gc_keep): Use bfd_is_const_section.
ld/
	PR 26265
	* ldlang.c (undef_from_cmdline): Delete.
	(ldlang_add_undef): Mark "cmdline" param unused.
	(lang_end): Traverse gc_sym_list to determine whether a symbol root
	has been specified.  Update error message.
	* testsuite/ld-gc/noent.d: Adjust for changed error message.
2020-07-20 22:21:11 +09:30
GDB Administrator
49bcc13929 Automatic date update in version.in 2020-07-20 00:00:05 +00:00
Alan Modra
e10a07b32d Power10 stub selection
This patch better supports mixing of power10 and non-power10 code,
as might be seen in a cpu-optimized library using ifuncs to select
functions optimized for a given cpu.  Using -Wl,--no-power10-stubs
isn't that good in this situation since non-power10 notoc stubs are
slower and larger than the power10 variants, which you'd like to use
on power10 code paths.

With this change, power10 pc-relative code that makes calls marked
@notoc uses power10 stubs if stubs are necessary, and other calls use
non-power10 instructions in stubs.  This will mean that if gcc is
generating code for -mcpu=power10 but with pc-rel disabled then you'll
get the older stubs even on power10 (unless you force with
-Wl,--power10-stubs).  That shouldn't be too big a problem: stubs that
use r2 are reasonable.  It's just the ones that set up addressing
using "mflr 12; bcl 20,31,.+4; mflr 11; mtlr 12" that should be
avoided if possible.

bfd/
	* elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
	(select_alt_stub): New function.
	(ppc_get_stub_entry): Use it here.
	(ppc64_elf_check_relocs): Set had_power10_relocs rather than
	power10_stubs.
	(ppc64_elf_size_stubs): Clear power10_stubs here instead.  Don't
	merge notoc stubs with other varieties when power10_stubs is "auto".
	Instead dup the stub hash table entry.
	(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
	tests of power10_stubs.
ld/
	* emultempl/ppc64elf.em (power10-stubs): Accept optional "auto" arg.
	* ld.texi (power10-stubs): Update.
	* testsuite/ld-powerpc/callstub-1.d: Force --power10-stubs.
	* testsuite/ld-powerpc/callstub-2.d: Relax branch offset comparison.
	* testsuite/ld-powerpc/callstub-4.d: New test.
	* testsuite/ld-powerpc/notoc.d: Force --no-power10-stubs.
	* testsuite/ld-powerpc/notoc3.d,
	* testsuite/ld-powerpc/notoc3.s,
	* testsuite/ld-powerpc/notoc3.wf: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run new tests.  Pass
	--no-power10-stubs for notoc link.
2020-07-19 12:27:47 +09:30
GDB Administrator
6095ca5257 Automatic date update in version.in 2020-07-19 00:00:06 +00:00
GDB Administrator
dea6fdedf9 Automatic date update in version.in 2020-07-18 00:00:06 +00:00
GDB Administrator
a26a62b197 Automatic date update in version.in 2020-07-17 00:00:07 +00:00
GDB Administrator
8ed8e29f05 Automatic date update in version.in 2020-07-16 00:00:06 +00:00
Alan Modra
28b80303a2 PR26239, memory leak in _bfd_dwarf2_slurp_debug_info
PR 26239
	* coffgen.c (_bfd_coff_close_and_cleanup): Free dwarf2 info.
2020-07-15 19:47:57 +09:30
Nick Clifton
4fd8d58564 Fix an illegal memory access in the BFD library which can be triggered by attempting to parse a corrupt PE format file.
PR26240
	* coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
	check for aux entries that overflow the buufer.
2020-07-15 11:09:59 +01:00
Hans-Peter Nilsson
a8a48c756c mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol
Spotted when inspecting gcc testsuite logs, but this already is
covered by the ld-mmix testsuite, it's just that the assert is ignored
since the regexp match is for a substring and not anchored.

With the anchors added but not the bugfix, the ld.log shows that the
asserts cause a non-match as intended:

Executing on host: sh -c {./ld-new   -LX/src/ld/testsuite/ld-mmix  -m elf64mmix -o tmpdir/dump tmpdir/undef-2.o tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'
failed with: <./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'>, expected: <\A[^\n\r]*undefined reference to `undefd'\Z>
FAIL: ld-mmix/undef-2

Gone with the fix of course, leaving just the intended "undefined
reference" like.

I'm not going to add anchors manually for all the "error:" strings in
the test-suite, not even in the mmix parts.  Sorry, but I'll just do
it for *these* specific undefined-reference tests.

Just a thought: maybe the run_dump_test "error:" string should
*automatically* get anchor marks prepended and appended for a single
line match as in the patch, "\A[^\n\r]*" prepended and \Z appended
unless either anchor mark or \r or \n is present in the regexp?

Committed.

bfd:
	* elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
	R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.

ld/testsuite:
	* testsuite/ld-mmix/undef-1.d, testsuite/ld-mmix/undef-1m.d,
	testsuite/ld-mmix/undef-2.d, testsuite/ld-mmix/undef-2m.d: Add
	start- and end-anchors to error-string to match just a
	single-line error-message.
2020-07-15 06:22:28 +02:00
GDB Administrator
360f1cd72d Automatic date update in version.in 2020-07-15 00:00:06 +00:00
Markus Böck
e8a83e931e PR26198 MinGW failure to link regular object file and LTO object file
PR 26198
	* coffgen.c (_bfd_coff_section_already_linked): Allow for plugin
	objects both before and after normal object files.
	* elflink.c (_bfd_elf_section_already_linked): Likewise.
2020-07-15 08:31:30 +09:30
GDB Administrator
0a3a820f6c Automatic date update in version.in 2020-07-14 00:00:12 +00:00
GDB Administrator
07716b63cb Automatic date update in version.in 2020-07-13 00:00:11 +00:00
GDB Administrator
14c4811d65 Automatic date update in version.in 2020-07-12 00:00:12 +00:00
GDB Administrator
ee9cb95ea1 Automatic date update in version.in 2020-07-11 00:00:13 +00:00
Alan Modra
d3b10ee787 PowerPC64 ld --no-power10-stubs
Needed for libraries that use ifuncs or other means to support
cpu-optimized versions of functions, some power10, some not, and those
functions make calls using linkage stubs.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
	* elf64-ppc.c (struct ppc_link_hash_table): Delete
	power10_stubs.
	(ppc64_elf_check_relocs): Adjust setting of power10_stubs.
	(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
	uses of power10_stubs.
ld/
	* emultempl/ppc64elf.em (params): Init new field.
	(enum ppc64_opt): Add OPTION_POWER10_STUBS and OPTION_NO_POWER10_STUBS.
	(PARSE_AND_LIST_LONGOPTS): Support --power10-stubs and
	--no-power10-stubs.
	(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Likewise.
	* testsuite/ld-powerpc/callstub-3.d: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run it.
2020-07-10 11:14:38 +09:30
GDB Administrator
bf7682fdf7 Automatic date update in version.in 2020-07-10 00:00:09 +00:00
Alan Modra
fe49679d51 Remove powerpc PE support
Plus some leftover powerpc lynxos support.

bfd/
	* coff-ppc.c: Delete.
	* pe-ppc.c: Delete.
	* pei-ppc.c: Delete.
	* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Remove PE PPC.
	* coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Remove
	PPCMAGIC code.
	(coff_write_object_contents): Remove PPC_PE code.
	* config.bfd: Move powerpcle-pe to removed targets.
	* configure.ac: Remove powerpc PE entries.
	* libcoff-in.h (ppc_allocate_toc_section): Delete.
	(ppc_process_before_allocation): Delete.
	* peXXigen.c: Remove POWERPC_LE_PE code and comments.
	* targets.c: Remove powerpc PE vectors.
	* po/SRC-POTFILES.in: Regenerate.
	* libcoff.h: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
binutils/
	* dlltool.c: Remove powerpc PE support and comments.
	* configure.ac: Remove powerpc PE dlltool config.
	* configure: Regenerate.
gas/
	* config/obj-coff.h: Remove TE_PE support.
	* config/tc-ppc.c: Likewise.
	* config/tc-ppc.h: Likewise.
	* configure.tgt: Remove powerpc PE and powerpc lynxos.
	* testsuite/gas/cfi/cfi.exp (cfi-common-6): Remove powerpc PE
	condition.
	* testsuite/gas/macros/macros.exp: Don't xfail powerpc PE.
include/
	* coff/powerpc.h: Delete.
ld/
	* emulparams/ppcpe.sh: Delete.
	* scripttempl/ppcpe.sc: Delete.
	* emulparams/ppclynx.sh: Delete.
	* Makefile.am (ALL_EMULATION_SOURCES): Remove ppc PE and lynxos.
	* configure.tgt: Likewise.
	* emultempl/beos.em: Remove powerpc PE support.
	* emultempl/pe.em: Likewise.
	* po/BLD-POTFILES.in: Regenerate.
	* Makefile.in: Regenerate.
2020-07-09 22:58:16 +09:30
Nick Clifton
7646efdf5d Update French translation in the bfd sub-directory 2020-07-09 14:20:58 +01:00
GDB Administrator
a6978338d9 Automatic date update in version.in 2020-07-09 00:00:10 +00:00
GDB Administrator
08534be985 Automatic date update in version.in 2020-07-08 00:00:09 +00:00
Alan Modra
23f5e55ed1 XCOFF ld segfaults when running ld testsuite
The binutils XCOFF support doesn't handle random linker scripts very
well at all.  These tweaks to final_link fix segfaults when some
linker created sections are discarded due to "/DISCARD/ : { *(.*) }"
in scripts.  The xcoff_mark change is necessary to not segfault on
symbols defined in scripts, which may be bfd_link_hash_defined yet
have u.def.section set to bfd_und_section_ptr.  (Which might seem odd,
but occurs during early stages of linking before input sections are
mapped.)

	* xcofflink.c (xcoff_mark): Don't mark const sections.
	(bfd_xcoff_record_link_assignment): Add FIXME.
	(_bfd_xcoff_bfd_final_link): Don't segfault on assorted magic
	sections being discarded by linker script.
2020-07-07 18:26:33 +09:30
Alan Modra
c800188601 XCOFF deterministic archives
Adds support for "ar -D".

	* coff-rs6000.c (xcoff_write_archive_contents_old): Set default
	time, uid, gid and mode for deterministic archive.
	(xcoff_write_archive_contents_big): Likewise.
2020-07-07 18:26:33 +09:30
Alan Modra
8af7926f45 XCOFF C_HIDEXT and C_AIX_WEAKEXT classification
If C_HIDEXT and C_AIX_WEAKEXT symbols aren't handled as globals by
coff_classify_symbol then we run into "warning: .. local symbol `some
garbage name' has no section".  These are of course both global
symbols, but C_HIDEXT is like a local in some respects and returning
COFF_SYMBOL_LOCAL for C_HIDEXT keeps nm output looking the same.
Fixes these fails on rs6000-aix5.1:

-FAIL: weakref tests, relocations
-FAIL: weakref tests, global syms
-FAIL: weakref tests, strong undefined syms
-FAIL: weakref tests, weak undefined syms

	* coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
	C_AIX_WEAKEXT.
2020-07-07 18:26:33 +09:30
GDB Administrator
3be5145ee6 Automatic date update in version.in 2020-07-07 00:00:09 +00:00
Nick Clifton
17550be7dd Updated translations for various binutils sub-directories 2020-07-06 10:43:35 +01:00
GDB Administrator
c56374d118 Automatic date update in version.in 2020-07-06 00:00:07 +00:00
GDB Administrator
983d1fb49c Automatic date update in version.in 2020-07-05 00:00:07 +00:00
Nick Clifton
b4396c5e6e oops - omitted from previous delta 2020-07-04 10:38:03 +01:00
Nick Clifton
b19d852dcf Update version to 2.35.50 and regenerate files 2020-07-04 10:34:23 +01:00
Nick Clifton
b115b9fd3c Add markers for binutils 2.35 branch 2020-07-04 10:16:22 +01:00
GDB Administrator
889d527eb4 Automatic date update in version.in 2020-07-04 00:00:07 +00:00
GDB Administrator
6d2f9adc67 Automatic date update in version.in 2020-07-03 00:00:07 +00:00
GDB Administrator
0ac053609a Automatic date update in version.in 2020-07-02 00:00:07 +00:00
Alan Modra
33d1369f18 PR26188, buff overflow in coff_find_nearest_line_with_names
PR 26188
	* coffgen.c (coff_find_nearest_line_with_names): Sanity check
	raw syment index before dereferencing.
2020-07-01 21:18:11 +09:30