14629 Commits

Author SHA1 Message Date
ca1e05baec xtensa: move dynamic relocations sections consistency check
The function elf_xtensa_finish_dynamic_sections checks that sizes of
sections .rela.dyn and .rela.plt match number of corresponding relocation
records, but the check is only done when .rela.plt is non-empty, so, e.g.
it is never run for the static PIE.
Rearrange the test so that .rela.dyn and .rela.plt are checked always.

bfd/
2018-07-23  Max Filippov  <jcmvbkbc@gmail.com>

	* elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move
	relocation sections consistency check to always check both
	.rela.dyn and .rela.plt when they exist. Rearrange variable
	definition and assignment places.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Backported from: f82863d797e461b936dff2b659a3aa65088ee87e
2019-04-08 15:51:42 +07:00
45e308eb82 xtensa: fix relaxation of undefined weak references in shared objects
The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak
undefined symbol") didn't properly handle shrinking of relocation
sections due to coalescing of references to a dynamic undefined weak
symbol in a shared object, which resulted in the following assertion
failure in ld when linking uClibc-ng libthread_db for xtensa:

  BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269
  in elf_xtensa_finish_dynamic_sections

Shrink dynamic relocations section for dynamic undefined weak symbols
when linking a shared object.

bfd/
2018-07-23  Max Filippov  <jcmvbkbc@gmail.com>

	* elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
	relocations section for dynamic undefined weak symbols when
	linking a shared object.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Backported from: 5d3a462f05cba5b0c0c96de899b84fb84155c760
2019-04-08 15:51:08 +07:00
64d526ba68 Fix darwin build
1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4
   doesn't support ended initializer list
2. wcsncasecmp doesn't exist in MacSDK10.6.x

Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e
2019-04-08 15:50:09 +07:00
0860693812 Regenerate files and add changelog entries for 2.31.1 release 2018-07-18 08:54:05 +01:00
c3432d7f31 Automatic date update in version.in 2018-07-18 00:01:46 +00:00
f8b4d71490 Automatic date update in version.in 2018-07-17 00:02:04 +00:00
ebde1daca8 Automatic date update in version.in 2018-07-16 00:01:59 +00:00
9c6b47988b Automatic date update in version.in 2018-07-15 00:02:24 +00:00
e6977d6f7f Reset branch back to development mode 2018-07-14 19:39:32 +01:00
af127c2169 2.31 Release point 2018-07-14 19:05:56 +01:00
0373ccfde3 Automatic date update in version.in 2018-07-14 00:01:33 +00:00
65cc93d2fb Automatic date update in version.in 2018-07-13 00:02:29 +00:00
ae0e76dcfc Hide dynamic symbols in discarded sections
This is a followup to git commit 97196564c7 "Strip global symbol
defined in discarded section".  If a symbol defined in a discarded
section was dynamic, that patch left .dynsym with holes (ie. all zero
entries).  For example, the following from libstdc++.so:

Symbol table '.dynsym' contains 6090 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000000a74e0     0 SECTION LOCAL  DEFAULT   10
     2: 0000000000264180     0 SECTION LOCAL  DEFAULT   17
     3: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_addUserCommitAction
     4: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_memcpyRtWn
     5: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
readelf: Warning: local symbol 5 found at index >= .dynsym's sh_info value of 3
     6: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
readelf: Warning: local symbol 6 found at index >= .dynsym's sh_info value of 3
[snip]

This patch removes the symbols from .dynsym too.

	PR 17550
	* elflink.c (_bfd_elf_fix_symbol_flags): Hide dynamic symbols
	in discarded sections.

(cherry picked from commit af0bfb9c4283ce80fe37ad6360d12cae8ec38696)
2018-07-13 01:16:25 +09:30
e87681ac38 Automatic date update in version.in 2018-07-12 00:01:43 +00:00
82f3215583 xtensa: don't emit dynamic relocation for weak undefined symbol
Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:

  void weak_function (void);
  if (weak_function)
    weak_function ();

This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.

bfd/
2018-07-11  Max Filippov  <jcmvbkbc@gmail.com>

	* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
	space for dynamic relocation for undefined weak symbol.
	(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
	relocation for undefined weak symbols.
	(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
	section for relocations against undefined weak symbols.

(cherry picked from commit c451bb34ae8bd2d0669bd563366883cfbcf0de9b)
2018-07-11 09:41:15 -07:00
557b8e0ea4 Automatic date update in version.in 2018-07-11 00:02:00 +00:00
df402ddcce BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors:

cc1: warnings being treated as errors
.../bfd/elflink.c: In function 'bfd_elf_final_link':
.../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration
/usr/include/stdio.h:154: error: shadowed declaration is here

which for versions of GCC before 4.8 prevent support for ELF targets
from being built.  See also GCC PR c/53066.

	bfd/
	* elflink.c (bfd_elf_final_link): Rename `remove' local variable
	to `remove_section'.

(cherry picked from commit 5270eddc6ed6b5d8e4e2817491bb44b784fa6f81)
2018-07-11 00:45:55 +01:00
10a1ed124e Automatic date update in version.in 2018-07-10 00:02:08 +00:00
fa1b3193c5 bfd: Use changequote for "i[3-7]86-*-linux-*"
Use changequote to match "i[3-7]86-*-linux-*", instead of
"i3-786-*-linux-*".

	PR ld/23388
	* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
	* configure: Regenerated.

(cherry picked from commit 872899f1efeda1e93ed569d322c6b2ee85ce885c)
2018-07-09 09:19:11 -07:00
f6becb01a7 x86: Remove x86 ISA properties with empty bits
There is no need to generate x86 ISA properties with empty bits in
linker output.

bfd/

	PR ld/23372
	* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
	ISA properties with empty bits.

ld/

	PR ld/23372
	* testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b.
	* testsuite/ld-i386/pr23372a.d: New file.
	* testsuite/ld-i386/pr23372a.s: Likewise.
	* testsuite/ld-i386/pr23372b.d: Likewise.
	* testsuite/ld-i386/pr23372b.s: Likewise.
	* testsuite/ld-i386/pr23372c.s: Likewise.
	* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372a.d: Likewise.
	* testsuite/ld-x86-64/pr23372a.s: Likewise.
	* testsuite/ld-x86-64/pr23372b-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372b.d: Likewise.
	* testsuite/ld-x86-64/pr23372b.s: Likewise.
	* testsuite/ld-x86-64/pr23372c.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32,
	pr23372b and pr23372b-x32.

(cherry picked from commit 56ad703d56ffe5dc55d5e719a6ec41fd6cf9bfbe)
2018-07-09 05:50:13 -07:00
e55992d4ac Fix diagnostic errors
Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.

include/
	* diagnostics.h: Comment on macro usage.
bfd/
	* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
	DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
	* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
	* elf32-s390.c (elf_s390_write_core_note): Likewise.
	* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
	* elf64-s390.c (elf_s390_write_core_note): Likewise.
	* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.

(cherry picked from commit fe75810f8e0cc33384f22d0479506711d4014c60)
2018-07-09 17:57:57 +09:30
9822d3329d Automatic date update in version.in 2018-07-09 00:02:17 +00:00
f42e6ba238 Automatic date update in version.in 2018-07-08 00:02:57 +00:00
4d60d5d092 Automatic date update in version.in 2018-07-07 00:01:59 +00:00
5592693077 RISC-V: Add riscv-*-* configure support, and minor cleanup.
bfd/
	* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
	(riscv64*-*-*): Likewise.
	(riscv-*-*): Add as an alias for riscv32*-*-*.

	ld/
	* configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.

(cherry picked from commit bb11866d6a635fadb9285d18e2fb819d2de2c28c)
2018-07-06 13:47:50 -07:00
49d7deccd4 Automatic date update in version.in 2018-07-06 00:02:26 +00:00
2df836265b Error for mismatched powerpc ABI tags
And report the two input files that are incompatible rather than
reporting that an input file is incompatible with the output.

bfd/
	* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
	* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
	on mismatch.  Remove "warning: " from messages.  Track last bfd
	used to set tags.
	(ppc_elf_merge_obj_attributes): Likewise.  Handle status from
	_bfd_elf_ppc_merge_fp_attributes.
	* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
	from _bfd_elf_ppc_merge_fp_attributes.
ld/
	* testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output.
	* testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
	* testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.

(cherry picked from commit 4a91d0ba307eb24eb87ad27f4ea8fcde823c3e61)
2018-07-05 22:18:55 +09:30
e89e89c9f8 Correct removal of .gnu.attributes
Setting SEC_EXCLUDE for empty .gnu.attributes is too late in the link
process for the linker to remove the section.  That must be done in
bfd_elf_final_link, as we do for removed group sections.

	* elflink.c (bfd_elf_final_link): Remove zero size .gnu.attributes
	sections.

(cherry picked from commit b8a6ced79668ec8af3180e50b76f7517ebbab0d9)
2018-07-05 22:18:55 +09:30
bdb5f07bd5 GNU attribute output on errors
.gnu.attributes entries from linker input files are merged to the
output file, the output having the union of compatible input
attributes.  Incompatible attributes generally cause a linker error
and no output.  However in some cases only a warning is emitted, and
one of the incompatible input attributes is passed on to the output.

PowerPC tends to emit warnings rather than errors, and the output
takes the first input attribute.  For example, if we have two input
files with Tag_GNU_Power_ABI_FP, the first with a value signifying
"double-precision hard float, IBM long double", the second with a
value signifying "double-precision hard float, IEEE long double",
we'll get a warning about incompatible long double types and the
output will say "double-precision hard float, IBM long double".
The output attribute of course isn't correct.  It would be correct to
specify "IBM and IEEE long double", but we don't have a way to
represent that currently.  While it would be possible to extend the
encoding, there isn't much gain in doing so.  A shared library
providing support for both long double types should link against
objects using either long double type without warning or error.  That
is what you'd get if such a shared library had no Tag_GNU_Power_ABI_FP
attribute.

So this patch provides a way for the backend to omit .gnu.attributes
tags from the output.

	* elf-bfd.h (ATTR_TYPE_FLAG_ERROR, ATTR_TYPE_HAS_ERROR): Define.
	* elf-attrs.c (is_default_attr): Handle ATTR_TYPE_HAS_ERROR.
	* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Use
	ATTR_TYPE_FLAG_INT_VAL.  Set ATTR_TYPE_HAS_ERROR on finding
	incompatible attribute.
	(ppc_elf_merge_obj_attributes): Likewise.  Return
	_bfd_elf_merge_object_attributes result.
	* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Return
	_bfd_elf_merge_object_attributes result.

(cherry picked from commit 8d2c8c3d17926826864f4b739362f66af547428f)
2018-07-05 22:18:55 +09:30
3839e9401d Update Russian, Bulgarian and Brazilian Portuguese translations for various components of the binutils.
bfd,gas	* po/ru.po: Updated Russian translation.

ld	* po/bg.po: Updated Bulgarian translation.
	* po/pt_BR.po: Updated Brazilian Portuguese translation.

binutils* po/bg.po: Updated Bulgarian translation.
2018-07-05 12:22:14 +01:00
ea2d583ffe Automatic date update in version.in 2018-07-05 00:02:48 +00:00
8d8c8344ce Also install diagnostics.h
Since bfd.h is an installed header, also install diagnostics.h.

	* Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
	* Makefile.in: Regenerated.

(cherry picked from commit db40acb0bed088872837f916029d8800c33f9f94)
2018-07-04 06:44:32 -07:00
b29dd6c33f x86-64: Clear the R_X86_64_converted_reloc_bit bit
We need to clear the R_X86_64_converted_reloc_bit bit after setting it
to avoid leaking it out by --emit-relocs.

bfd/

	PR ld/23324
	* elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
	R_X86_64_converted_reloc_bit bit.

ld/

	PR ld/23324
	* testsuite/ld-x86-64/pr23324.s: New file.
	* testsuite/ld-x86-64/pr23324a.d: Likewise.
	* testsuite/ld-x86-64/pr23324b.d: Likewise.

(cherry picked from commit b638b5d57fafc84a8dc0ff91d7579a3c24aad90c)
2018-07-04 06:38:15 -07:00
30d282bede Automatic date update in version.in 2018-07-04 00:02:46 +00:00
4486c1a557 Automatic date update in version.in 2018-07-03 00:02:48 +00:00
9d00ec4b84 Automatic date update in version.in 2018-07-02 00:02:40 +00:00
89beb62e86 Automatic date update in version.in 2018-07-01 00:02:47 +00:00
544e0c4ee3 Automatic date update in version.in 2018-06-30 00:02:05 +00:00
59ee9ce57c Automatic date update in version.in 2018-06-29 00:02:16 +00:00
f2504aef8f Automatic date update in version.in 2018-06-28 00:02:28 +00:00
217e7ac9b3 Automatic date update in version.in 2018-06-27 00:02:44 +00:00
71b4e2ec66 Updated translations.
opcodes	* po/uk.po: Updated Ukranian translation.
	* po/de.po: Updated German translation.
	* po/pt_BR.po: Updated Brazilian Portuguese translation.

ld	* po/uk.po: Updated Ukranian translation.
gold	* po/uk.po: Updated Ukranian translation.
gas	* po/uk.po: Updated Ukranian translation.
bfd	* po/uk.po: Updated Ukranian translation.

binutils* po/sv.po: Updated Swedish translation.
	* po/uk.po: Updated Ukranian translation.
2018-06-26 13:55:59 +01:00
26d12bc025 Automatic date update in version.in 2018-06-26 00:02:27 +00:00
a45c28e358 Fix a compile time warning building the AArch64 BFD backend.
* elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check
	for malloc returning NULL.
	(_bfd_aarch64_erratum_843419_fixup): Check for
	_bfd_aarch64_erratum_835769_stub_name returning NULL.
2018-06-25 12:51:10 +01:00
176c2a5e0e Reset version to 2.30.90. Update configure files. Regenerate pot files. 2018-06-24 19:49:22 +01:00
719d828850 Add 2.30 branch notes to ChangeLogs and NEWS files. 2018-06-24 18:36:15 +01:00
6706f77062 Automatic date update in version.in 2018-06-24 00:01:17 +00:00
2e7a29d570 Automatic date update in version.in 2018-06-23 00:00:50 +00:00
8ea3acd626 Automatic date update in version.in 2018-06-22 00:00:53 +00:00
1ced1a5f10 MIPS/BFD: Correct formatting of compact EH backend methods
Correct the formatting of `_bfd_mips_elf_compact_eh_encoding' and
`_bfd_mips_elf_cant_unwind_opcode' definitions which extend beyond 79
columns.

	bfd/
	* elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding)
	(_bfd_mips_elf_cant_unwind_opcode): Correct formatting.
2018-06-21 21:40:57 +01:00