Commit Graph

16988 Commits

Author SHA1 Message Date
Alan Modra
472dd8b357 Sanity check _bfd_coff_read_string_table
* coffgen.c (_bfd_coff_read_string_table): Catch overflows
	when calculating string table file location.
2021-07-30 15:06:56 +09:30
Alan Modra
6329d1e13e IMAGE_SCN_LNK_NRELOC_OVFL
From microsoft docs: It is an error if IMAGE_SCN_LNK_NRELOC_OVFL is
set and there are fewer than 0xffff relocations in the section.

	* coffcode.h (coff_set_alignment_hook): Sanity check overflow
	reloc count.
2021-07-30 13:15:58 +09:30
GDB Administrator
bbf1c6a237 Automatic date update in version.in 2021-07-30 00:00:24 +00:00
Clément Chigot
cd026728f3 gas: improve C_BSTAT and C_STSYM symbols handling on XCOFF
A C_BSTAT debug symbol specifies the beginning of a static block.
Its n_value is the index of the csect containing static symbols.
A C_STSYM debug symbol represents the stabstring of a statically
allocated symbol. Its n_value is the offset in the csect pointed
by the containing C_BSTAT.

These two special n_value were not correctly handled both when
generating object files with gas or when reading them with objdump.
This patch tries to improve that and, above all, to allow gas-generated
object files with such symbols to be accepted by AIX ld.

bfd/
	* coff-bfd.c (bfd_coff_get_syment): Adjust n_value of symbols
	having fix_value = 1 in order to be an index and not a memory
	offset.
	* coffgen.c (coff_get_symbol_info): Likewize.
	(coff_print_symbol): Likewize.

gas/
	* config/tc-ppc.c (ppc_frob_label): Don't change within if
	already set.
	(ppc_stabx): Remove workaround changing exp.X_add_symbol's
	within.
	* config/tc-ppc.h (struct ppc_tc_sy): Update comments.
	* symbols.c (resolve_symbol_value): Remove symbol update
	when final_val is 0 and it's an AIX debug symbol.
	* testsuite/gas/ppc/aix.exp: Add new tests.
	* testsuite/gas/ppc/xcoff-stsym-32.d: New test.
	* testsuite/gas/ppc/xcoff-stsym-64.d: New test.
	* testsuite/gas/ppc/xcoff-stsym.s: New test.
2021-07-29 10:55:22 +02:00
GDB Administrator
588f5af532 Automatic date update in version.in 2021-07-29 00:00:23 +00:00
H.J. Lu
5a98fb7513 bfd: Close the file descriptor if there is no archive fd
Close the file descriptor if there is no archive plugin file descriptor
to avoid running out of file descriptors on thin archives with many
archive members.

bfd/

	PR ld/28138
	* plugin.c (bfd_plugin_close_file_descriptor): Close the file
	descriptor there is no archive plugin file descriptor.

ld/

	PR ld/28138
	* testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
	* testsuite/ld-plugin/pr28138.c: New file.
	* testsuite/ld-plugin/pr28138-1.c: Likewise.
	* testsuite/ld-plugin/pr28138-2.c: Likewise.
	* testsuite/ld-plugin/pr28138-3.c: Likewise.
	* testsuite/ld-plugin/pr28138-4.c: Likewise.
	* testsuite/ld-plugin/pr28138-5.c: Likewise.
	* testsuite/ld-plugin/pr28138-6.c: Likewise.
	* testsuite/ld-plugin/pr28138-7.c: Likewise.
2021-07-28 06:01:32 -07:00
will schmidt
254db2f336 Externalize the _bfd_set_gp_value function
This change adds an external-visible wrapper for the _bfd_set_gp_value
function.  This is a prerequisite for some gdb patches that better
handle powerpc64le relocations against ".TOC.".

	* bfd.c (bfd_set_gp_value): New externally visible wrapper
	for _bfd_set_gp_value.
	* bfd-in2.h: Regenerate.
2021-07-28 13:36:58 +09:30
GDB Administrator
b30049f188 Automatic date update in version.in 2021-07-28 00:00:27 +00:00
GDB Administrator
7122377642 Automatic date update in version.in 2021-07-27 00:00:23 +00:00
H.J. Lu
5b37a5ca1d bfd: Set error to bfd_error_malformed_archive only if unset
When reading an archive member, set error to bfd_error_malformed_archive
on open_nested_file failure only if the error is unset.

	PR ld/28138
	* archive.c (_bfd_get_elt_at_filepos): Don't set error to
	bfd_error_malformed_archive if it has been set.
2021-07-26 16:21:47 -07:00
GDB Administrator
b924d9bad5 Automatic date update in version.in 2021-07-26 00:00:27 +00:00
GDB Administrator
60a5fb48d1 Automatic date update in version.in 2021-07-25 00:00:20 +00:00
Alan Modra
c09c8b4202 Revert: PowerPC: Don't generate unused section symbols
Blindly following x86 broke linux kernel builds.

bfd/
	* elf32-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define as true.
	* elf64-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Likewise.
gas/
	* testsuite/gas/ppc/power4.d: Adjust for section sym change.
	* testsuite/gas/ppc/test1elf32.d: Likewise.
	* testsuite/gas/ppc/test1elf64.d: Likewise.
ld/
	* testsuite/ld-powerpc/tlsexe.r: Adjust for section sym change.
	* testsuite/ld-powerpc/tlsexe32.r: Likewise.
	* testsuite/ld-powerpc/tlsexe32no.r: Likewise.
	* testsuite/ld-powerpc/tlsexeno.r: Likewise.
	* testsuite/ld-powerpc/tlsexenors.r: Likewise.
	* testsuite/ld-powerpc/tlsexers.r: Likewise.
	* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
	* testsuite/ld-powerpc/tlsexetocrs.r: Likewise.
	* testsuite/ld-powerpc/tlsget.d: Likewise.
	* testsuite/ld-powerpc/tlsget.wf: Likewise.
	* testsuite/ld-powerpc/tlsget2.d: Likewise.
	* testsuite/ld-powerpc/tlsget2.wf: Likewise.
	* testsuite/ld-powerpc/tlsso.r: Likewise.
	* testsuite/ld-powerpc/tlsso32.r: Likewise.
	* testsuite/ld-powerpc/tlstocso.r: Likewise.
2021-07-24 17:59:52 +09:30
GDB Administrator
febbfd5154 Automatic date update in version.in 2021-07-24 00:00:21 +00:00
GDB Administrator
9234efeee5 Automatic date update in version.in 2021-07-23 00:00:22 +00:00
GDB Administrator
fec458f0fc Automatic date update in version.in 2021-07-22 00:00:29 +00:00
Nick Clifton
e8c36d1fc2 Updated Russian translation for the bfd library 2021-07-21 14:37:39 +01:00
John Ericson
e28a9225b8 Remove netbsdpe support
netbsdpe was deprecated in c2ce831330.
Since then, a release has passed (2.37), and it was marked obselete in
5c9cbf07f3. Unless I am mistaken, that
means we can now remove support altogether.

All branches in the "active" code are remove, and the target is
additionally marked as obsolete next to the other removed ones for
libbfd and gdb.

Per [1] from the NetBSD toolchain list, PE/COFF support was removed a
decade ago. Furthermore, the sole mention of this target in the binutils
commit history was in 2002. Together, I'm led to believe this target
hasn't seen much attention in quite a while.

[1]: https://mail-index.netbsd.org/tech-toolchain/2021/06/16/msg003996.html

bfd/
	* config.bfd: Remove netbsdpe entry.
binutils/
	* configure.ac: Remove netbsdpe entry.
	* testsuite/lib/binutils-common.exp (is_pecoff_format): Likewise.
	* configure: Regenerate.
gas/
	* configure.tgt: Remove netbsdpe entry.
gdb/
	* configure.tgt: Add netbsdpe to removed targets.
ld/
	* configure.tgt: Remove netbsdpe entry.
	* testsuite/ld-bootstrap/bootstrap.exp: Likewise.
2021-07-21 11:00:35 +09:30
GDB Administrator
8258b1353c Automatic date update in version.in 2021-07-21 00:00:24 +00:00
Nelson Chu
cb959bd895 RISC-V: Minor updates for architecture parser.
* Two add subset functions is redundant.  Keep the riscv_add_implicit_subset,
and renamed it to riscv_add_subset.  Besides, if the subset is added in order,
then we just add it at the tail of the subset list.

* Removed the "-march:" prefix from the error messages.  Since not only the
-march= option will use the parser, but also the architecture elf attributes,
the default architecture setting and linker will use the same parser.

* Use a function, riscv_parse_check_conflicts, to check the conflicts
of extensions, including the rv64e and rv32q.

The rv32emc-elf/rv32i-elf/rv32gc-linux/rv64gc-elf/rv64gc-linux regressions
are tested and passed.

bfd/
	* elfxx-riscv.c (riscv_lookup_subset): Check the subset tail list
	first.  If the subset is added in order, then we can just add it to
	the tail without searching the whole list.
	(riscv_add_subset): Replaced by riscv_add_implicit_subset.
	(riscv_add_implicit_subset): Renamed to riscv_add_subset.
	(riscv_parse_add_subset): Updated.
	(riscv_parsing_subset_version): Removed the "-march:" prefix from
	the error message.
	(riscv_parse_prefixed_ext): Likewise.
	(riscv_parse_std_ext): Likewise.  And move the rv<xlen>e check
	to riscv_parse_check_conflicts.
	(riscv_parse_check_conflicts): New function used to check conflicts.
	(riscv_parse_subset): Updated.
gas/
	* testsuite/gas/riscv/march-fail-base-02.l: Updated.
	* testsuite/gas/riscv/march-fail-unknown-std.l: Likewise.
2021-07-20 18:04:44 +08:00
GDB Administrator
c2a7621771 Automatic date update in version.in 2021-07-20 00:00:26 +00:00
GDB Administrator
972a7621fc Automatic date update in version.in 2021-07-19 00:00:17 +00:00
Nick Clifton
5c9cbf07f3 Move pending-obsolesence targets onto the obsolete list.
* config.bfd: Move pending obsoletion targets to obsolete list.
2021-07-18 20:10:52 +01:00
GDB Administrator
04dd8003c0 Automatic date update in version.in 2021-07-18 00:00:24 +00:00
GDB Administrator
1c7682f9f2 Automatic date update in version.in 2021-07-17 00:00:23 +00:00
Giulio Benetti
05a1dd47cc or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation.
bfd	* elf32-or1k.c (or1k_elf_relocate_section): Use a separate entry
	in switch case R_OR1K_INSN_REL_26 where we need to check for
	!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
2021-07-16 15:03:07 +01:00
GDB Administrator
66b3b362dc Automatic date update in version.in 2021-07-16 00:00:12 +00:00
GDB Administrator
600ac5b461 Automatic date update in version.in 2021-07-15 00:00:10 +00:00
Clément Chigot
51d29b8cac objdump: add DWARF support for AIX
DWARF sections have special names on AIX which need be handled
by objdump in order to correctly print them.
This patch also adds the correlation in bfd for future uses.

bfd/
	* libxcoff.h (struct xcoff_dwsect_name): Add DWARF name.
	* coff-rs6000.c (xcoff_dwsect_names): Update.
	* coffcode.h (sec_to_styp_flags): Likewise.
	(coff_new_section_hook): Likewise.
binutils/
	* dwarf.h (struct dwarf_section): Add XCOFF name.
	* dwarf.c (struct dwarf_section_display): Update.
	* objdump.c (load_debug_section): Add XCOFF name handler.
	(dump_dwarf_section): Likewise.
gas/
	* config/tc-ppc.c (ppc_change_debug_section): Update to
	match new name's field.
2021-07-14 21:40:05 +09:30
GDB Administrator
fac3b6a2e0 Automatic date update in version.in 2021-07-14 00:00:09 +00:00
GDB Administrator
c9e7dfb64f Automatic date update in version.in 2021-07-13 00:00:09 +00:00
GDB Administrator
b926827d44 Automatic date update in version.in 2021-07-12 00:00:11 +00:00
GDB Administrator
381575f24a Automatic date update in version.in 2021-07-11 00:00:10 +00:00
Alan Modra
f8dd364658 Tidy commit 49910fd88d
Pointer range checking is UB if the values compared are outside the
underlying array elements (plus one).

	* dwarf2.c (read_address): Remove accidental commit.
	(read_ranges): Compare offset rather than pointers.
2021-07-10 13:29:04 +09:30
GDB Administrator
34c54daa33 Automatic date update in version.in 2021-07-10 00:00:12 +00:00
H.J. Lu
6f365fda85 elf: Add GNU_PROPERTY_1_NEEDED check
If GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS is set on any input
relocatable files:

1. Don't generate copy relocations.
2. Turn off extern_protected_data since it implies
GNU_PROPERTY_NO_COPY_ON_PROTECTED.
3. Treate reference to protected symbols with indirect external access
as local.
4. Set GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS on output.
5. When generating executable, clear this bit when there are non-GOT or
non-PLT relocations in input relocatable files without the bit set.
6. Add -z [no]indirect-extern-access to control indirect external access.

bfd/

	* elf-bfd (elf_obj_tdata): Add has_indirect_extern_access.
	(elf_has_indirect_extern_access): New.
	* elf-properties.c (_bfd_elf_parse_gnu_properties): Set
	elf_has_indirect_extern_access and elf_has_no_copy_on_protected
	when seeing GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
	(elf_write_gnu_propertie): Add an argument to pass link_info.
	Set needed_1_p for GNU_PROPERTY_1_NEEDED in memory.
	(_bfd_elf_link_setup_gnu_properties): Handle
	GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS for
	-z indirect-extern-access.  Set nocopyreloc to true and
	extern_protected_data to false for indirect external access.
	(_bfd_elf_convert_gnu_properties): Updated.
	* elf32-i386.c (elf_i386_check_relocs): Set
	non_got_ref_without_indirect_extern_access on legacy non-GOT or
	non-PLT references.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elflink.c (_bfd_elf_symbol_refs_local_p): Return true for
	STV_PROTECTED symbols with indirect external access.
	* elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Clear
	indirect_extern_access for legacy non-GOT/non-PLT references.
	* elfxx-x86.h (elf_x86_link_hash_entry): Add
	non_got_ref_without_indirect_extern_access.

include/

	* bfdlink.h (bfd_link_info): Add indirect_extern_access and
	needed_1_p.  Change nocopyreloc to int.

ld/

	* NEWS: Mention -z [no]indirect-extern-access
	* ld.texi: Document -z [no]indirect-extern-access
	* ldmain.c (main): Initialize link_info.indirect_extern_access
	to -1.
	* emulparams/extern_protected_data.sh: Support
	-z [no]indirect-extern-access.
	* testsuite/ld-elf/indirect-extern-access-1.rd: New file
	* testsuite/ld-elf/indirect-extern-access-1a.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-1b.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-2.rd: Likewise.
	* testsuite/ld-elf/indirect-extern-access-2a.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-2b.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-3.rd: Likewise.
	* testsuite/ld-elf/indirect-extern-access.S: Likewise.
	* testsuite/ld-elf/property-1_needed-1b.d: Likewise.
	* testsuite/ld-elf/property-1_needed-1c.d: Likewise.
	* testsuite/ld-x86-64/indirect-extern-access.rd: Likewise.
	* testsuite/ld-x86-64/protected-data-1.h: Likewise.
	* testsuite/ld-x86-64/protected-data-1a.c: Likewise.
	* testsuite/ld-x86-64/protected-data-1b.c: Likewise.
	* testsuite/ld-x86-64/protected-data-2a.S: Likewise.
	* testsuite/ld-x86-64/protected-data-2b.S: Likewise.
	* testsuite/ld-x86-64/protected-func-2a.S: Likewise.
	* testsuite/ld-x86-64/protected-func-2b.S: Likewise.
	* testsuite/ld-x86-64/protected-func-2c.c: Likewise.
	* testsuite/ld-elf/linux-x86.exp: Run test with
	GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
	* testsuite/ld-x86-64/x86-64.exp: Run tests for protected
	function and data with indirect external access.
2021-07-08 18:14:31 -07:00
GDB Administrator
ce8fea3651 Automatic date update in version.in 2021-07-09 00:00:12 +00:00
H.J. Lu
661b504df9 x86-64: Disallow PC reloc against weak undefined symbols in PIE
Disallow PC relocations against weak undefined symbols in PIE since they
can lead to non-zero address at run-time.

bfd/

	PR ld/21782
	* elf64-x86-64.c (elf_x86_64_relocate_section): Disallow PC
	relocations against weak undefined symbols in PIE.

ld/

	PR ld/21782
	* testsuite/ld-x86-64/pie3.d: Expect linker error.
2021-07-08 13:57:52 -07:00
H.J. Lu
a8dde0a211 ld: Limit cache size and add --max-cache-size=SIZE
When link_info.keep_memory is true, linker caches the relocation
information and symbol tables of input files in memory.  When there
are many input files with many relocations, we may run out of memory.
Add --max-cache-size=SIZE to set the maximum cache size.

bfd/

	PR ld/18028
	* bfd.c (bfd): Add alloc_size.
	* elf-bfd.h (_bfd_elf_link_info_read_relocs): New.
	* elf32-i386.c (elf_i386_check_relocs): Use _bfd_link_keep_memory.
	Update cache_size.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elflink.c (_bfd_elf_link_read_relocs): Renamed to ...
	(_bfd_elf_link_info_read_relocs): This.  Update cache_size.
	(_bfd_elf_link_read_relocs): New.
	(_bfd_elf_link_check_relocs): Call _bfd_elf_link_info_read_relocs
	instead of _bfd_elf_link_read_relocs.
	(elf_link_add_object_symbols): Likewise.
	(elf_link_input_bfd): Likewise.
	(init_reloc_cookie_rels): Likewise.
	(init_reloc_cookie): Update cache_size.  Call
	_bfd_elf_link_info_read_relocs instead of
	_bfd_elf_link_read_relocs.
	(link_info_ok): New.
	(elf_gc_smash_unused_vtentry_relocs): Updated.  Call
	_bfd_elf_link_info_read_relocs instead of
	_bfd_elf_link_read_relocs.
	(bfd_elf_gc_sections): Use link_info_ok.  Pass &link_info_ok
	to elf_gc_smash_unused_vtentry_relocs.
	* libbfd-in.h (_bfd_link_keep_memory): New.
	* linker.c (_bfd_link_keep_memory): New.
	* opncls.c (bfd_alloc): Update alloc_size.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.

include/

	PR ld/18028
	* bfdlink.h (bfd_link_info): Add cache_size and max_cache_size.

ld/

	PR ld/18028
	* NEWS: Mention --max-cache-size=SIZE.
	* ld.texi: Document --max-cache-size=SIZE.
	* ldlex.h (option_values): Add OPTION_MAX_CACHE_SIZE.
	* ldmain.c: (main): Set link_info.max_cache_size to -1.
	* lexsup.c (ld_options): Add --max-cache-size=SIZE.
	(parse_args): Support OPTION_MAX_CACHE_SIZE.
	* testsuite/ld-bootstrap/bootstrap.exp: Add test for
	--max-cache-size=-1.
2021-07-08 09:59:28 -07:00
Nick Clifton
f1cee83766 Updated Portuguese translation for the BFD sub-directory 2021-07-08 12:39:31 +01:00
GDB Administrator
14a6b9b4b6 Automatic date update in version.in 2021-07-08 00:00:10 +00:00
Nick Clifton
ca52626bab Remove an accidental change to elfcode.h included as part of commit 6e0dfbf420.
PR 27659
	* elfcode.h (elf_swap_symbol_out): Revert accidental change that
	removed an abort if the shndx pointer is NULL.
2021-07-07 16:50:33 +01:00
H.J. Lu
7a30ac441a ld: Check archive only for archive member
Since plugin_maybe_claim calls bfd_close on the original input BFD if it
isn't an archive member, pass NULL to bfd_plugin_close_file_descriptor
to indicate that the BFD isn't an archive member.

bfd/

	PR ld/18028
	* plugin.c (bfd_plugin_close_file_descriptor): Check archive
	only of abfd != NULL.
	(try_claim): Pass NULL to bfd_plugin_close_file_descriptor if
	it isn't an archive member.

ld/

	PR ld/18028
	* plugin.c (plugin_input_file): Add comments for abfd and ibfd.
	(plugin_object_p): Set input->ibfd to NULL if it isn't an
	archive member.
2021-07-07 07:44:39 -07:00
Rainer Orth
f07afc65d0 Fix Solaris gprof build with --disable-nls
gprof fails to compile on Solaris 10 and 11.3 with --disable-nls:

In file included from /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/gprof.h:33,
                 from /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/basic_blocks.c:24:
/usr/include/libintl.h:45:14: error: expected identifier or '(' before 'const'
   45 | extern char *dcgettext(const char *, const char *, const int);
      |              ^~~~~~~~~
/usr/include/libintl.h:46:14: error: expected identifier or '(' before 'const'
   46 | extern char *dgettext(const char *, const char *);
      |              ^~~~~~~~
/usr/include/libintl.h:47:14: error: expected identifier or '(' before 'const'
   47 | extern char *gettext(const char *);
      |              ^~~~~~~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:165:33:
error: expected identifier or '(' before 'do'
  165 | # define textdomain(Domainname) do {} while (0)
      |                                 ^~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:165:39:
error: expected identifier or '(' before 'while'
  165 | # define textdomain(Domainname) do {} while (0)
      |                                       ^~~~~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:166:46:
error: expected identifier or '(' before 'do'
  166 | # define bindtextdomain(Domainname, Dirname) do {} while (0)
      |                                              ^~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:166:52:
error: expected identifier or '(' before 'while'
  166 | # define bindtextdomain(Domainname, Dirname) do {} while (0)
      |                                                    ^~~~~
/usr/include/libintl.h:55:14: error: expected identifier or '(' before 'unsigned'
   55 | extern char *dcngettext(const char *, const char *,
      |              ^~~~~~~~~~
/usr/include/libintl.h:57:14: error: expected identifier or '(' before 'unsigned'
   57 | extern char *dngettext(const char *, const char *,
      |              ^~~~~~~~~
/usr/include/libintl.h:59:14: error: expected identifier or '(' before 'unsigned'
   59 | extern char *ngettext(const char *, const char *, unsigned long int);
      |              ^~~~~~~~

This is a known issue already partially fixed in binutils/sysdep.h.  For
gprof, the same fix needs to be applied in bfd/sysdep.h, as the
following patch does.  Tested on i386-pc-solaris2.10 and
i386-pc-solaris2.11.

2021-07-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	bfd:
	* sysdep.h [!ENABLE_NLS]: Prevent inclusion of <libintl.h> on
	Solaris.
2021-07-07 13:51:55 +02:00
Rainer Orth
b737d3047c Check for strnlen declaration to fix Solaris 10 build
binutils currently fails to compile on Solaris 10:

/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function 'bfd_get_debug_link_info_1':
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: implicit declaration of function 'strnlen' [-Werror=implicit-function-declaration]
 1231 |	  crc_offset = strnlen (name, size) + 1;
      |		       ^~~~~~~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: incompatible implicit declaration of built-in function 'strnlen' [-Werror]
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function 'bfd_get_alt_debug_link_info':
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1319:20: error: incompatible implicit declaration of built-in function 'strnlen' [-Werror]
 1319 |	  buildid_offset = strnlen (name, size) + 1;
      |			   ^~~~~~~

and in a couple of other places.  The platform lacks strnlen, and while
libiberty.h can provide a fallback declaration, the necessary configure
test isn't run.

Fixed with the following patch.  Tested on i386-pc-solaris2.10.

2021-07-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	bfd:
	* configure.ac: Check for strnlen declaration.
	* configure, config.in: Regenerate.

	binutils:
	* configure.ac: Check for strnlen declaration.
	* configure, config.in: Regenerate.
2021-07-07 13:49:27 +02:00
Nick Clifton
ffa5352c0c Fix problems translating messages when a percentage sign appears at the end of a string.
PR 28051
gas	* config/tc-i386.c (offset_in_range): Reformat error messages in
	order to fix problems when translating.
	(md_assemble): Likewise.
	* messages.c (as_internal_value_out_of_range): Likewise.
	* read.c (emit_expr_with_reloc): Likewise.
	* testsuite/gas/all/overflow.l Change expected output format.
	* po/gas.pot: Regenerate.

bfd	* coff-rs6000.c (xcoff_reloc_type_tls): Reformat error messages in
	order to fix problems when translating.
	* cofflink.c (_bfd_coff_write_global_sym): Likewise.
	* elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
	Likewise.
	* po/bfd.pot: Regenerate.
2021-07-07 10:25:41 +01:00
GDB Administrator
1f00b55dba Automatic date update in version.in 2021-07-07 00:00:10 +00:00
Yuri Chornoivan
579f0281f3 PR 28053: Fix spelling mistakes: usupported -> unsupported and relocatation -> relocation. 2021-07-06 14:56:05 +01:00
Michael Matz
235f5ef4a6 elf/riscv: Fix relaxation with aliases [PR28021]
the fix for PR22756 only changed behaviour for hidden aliases,
but the same situation exists for non-hidden aliases: sym_hashes[]
can contain multiple entries pointing to the same symbol structure
leading to relaxation adjustment to be applied twice.

Fix this by testing for duplicates for everything that looks like it
has a version.

PR ld/28021

bfd/
	* elfnn-riscv.c (riscv_relax_delete_bytes): Check for any
	versioning.

ld/
	* testsuite/ld-riscv-elf/relax-twice.ver: New.
	* testsuite/ld-riscv-elf/relax-twice-1.s: New.
	* testsuite/ld-riscv-elf/relax-twice-2.s: New.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp
	(run_relax_twice_test): New, and call it.
2021-07-06 15:49:03 +02:00
Nelson Chu
70a590636b RISC-V: Fix the build broken with -Werror.
ChangeLog:

bfd/

	* elfnn-riscv.c(riscv_elf_additional_program_headers): Removed the
	unused variable s.
	(riscv_elf_modify_segment_map): Added ATTRIBUTE_UNUSED for the
	unused parameter info.
2021-07-06 17:31:14 +08:00