Commit Graph

16799 Commits

Author SHA1 Message Date
GDB Administrator
b2d14d3d8f Automatic date update in version.in 2021-04-24 00:00:15 +00:00
Eric Botcazou
f5e98b7d67 Fix type of .persistent.bss section
The change implementing the .persistent family of sections broke the
existing support for the .persistent.bss section in the compiler:

int a __attribute__ ((section (".persistent.bss")));

t.s: Assembler messages:
t.s:4: Warning: setting incorrect section type for .persistent.bss

The compiler encodes it as @nobits but the assembler expects @progbits.
The assembler is incorrect and should treat the section like the compiler.

bfd/
	* elf.c (special_sections_p): Add .persistent.bss.
gas/
	* testsuite/gas/elf/section25.d: Run it everywhere.
	* testsuite/gas/elf/section26.d: Likewise.
	* testsuite/gas/elf/section26.s: Add test for .persistent.bss.
2021-04-23 19:13:52 +02:00
Jan Beulich
c21346c5e2 x86: TLS desc call relocs target zero-size fields
These are marker relocations, so together with their bit size being zero
their byte size should be zero as well. This is expressed by a value of
3, not 0.
2021-04-23 09:18:48 +02:00
GDB Administrator
ae6a3f81a1 Automatic date update in version.in 2021-04-23 00:00:15 +00:00
Cl?ment Chigot
bdd2aaf69e fix string table generation for XCOFF64 .debug section
bfd	* hash.c (struct bfd_strtab_hash): Remove xcoff field.
	Add length_field_size field.
	(_bfd_stringtab_init): Change prototype.
	Adapt to new length_field_size.
	(_bfd_xcoff_stringtab_init): Likewise.
	(_bfd_stringtab_add): Likewise.
	(_bfd_stringtab_emit): Likewise.
	* libbfd-in.h (_bfd_xcoff_stringtab_init):
	Change prototype.
	* libbfd.h: Regenerate.
	* xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create):
	Call _bfd_xcoff_stringtab_init with isxcoff64 value.
2021-04-22 15:31:02 +01:00
Cl?ment Chigot
b11b2969a9 Harmonize and improve auxiliary entries support for XCOFF
bfd/ChangeLog:
	* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Add errors for
	unsupported storage class or auxialiry entries.
	Improve and adapt to new aux structures.
	Add C_DWARF support.
	(_bfd_xcoff_swap_aux_out): Likewise.
	* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
	(_bfd_xcoff64_swap_aux_out): Likewise.

binutils/ChangeLog:
	* od-xcoff.c (dump_xcoff32_symbols): Adapt to new
	aux structures.

include/ChangeLog:
	* coff/internal.h (union internal_auxent):
	 Add x_sect structure.
	* coff/rs6000.h (union external_auxent): Rework to
	match official documentation.
	* coff/rs6k64.h (union external_auxent): Likewise.
	(_AUX_SECT): New define.
2021-04-22 12:28:50 +01:00
GDB Administrator
1202f464b2 Automatic date update in version.in 2021-04-22 00:00:15 +00:00
Eli Zaretskii
18e9a809e8 Extend the description of PE header flags.
PR 27760
include	* coff/pe.h (IMAGE_DLLCHARACTERISTICS_APPCONTAINER): Define.
	(IMAGE_DLLCHARACTERISTICS_GUARD_CF): Define.

bfd	* peXXigen.c (_bfd_XX_print_private_bfd_data_common): Add display
	of IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP,
	IMAGE_FILE_NET_RUN_FROM_SWAP and IMAGE_FILE_UP_SYSTEM_ONLY flags.
	Decode the contents of the DllCharacteristics field.
2021-04-21 17:38:52 +01:00
Nick Clifton
33fe00c123 Fix an assertion failure in the BFD library when parsing a corrupt SREC format file.
PR 27759
	* srec.c (srec_read_section): Replace assertions with error
	returns.
2021-04-21 11:09:11 +01:00
GDB Administrator
9c7c5f1e5c Automatic date update in version.in 2021-04-21 00:00:16 +00:00
Cl?ment Chigot
c5df7e442e Rework the R_NEG support on both gas and ld for the PowerPC AIX targets, in order to manage C++ exceptions built with GCC.
bfd	PR binutils/21700
	* reloc.c (BFD_RELOC_PPC_NEG): New relocation.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* coff-rs6000.c (_bfd_xcoff_reloc_type_lookup): Add
	BFD_RELOC_PPC_NEG handler.
	(xcoff_reloc_type_neg): Correctly substract addend.
	* coff64-rs6000.c (xcoff64_howto_table): Add R_NEG_32
	howto.
	(xcoff64_rtype2howto): Add handler for R_NEG_32.
	(xcoff64_reloc_type_lookup): Add BFD_RELOC_PPC_NEG handler.
	* xcofflink.c (xcoff_need_ldrel_p): Check output section
	for R_POS-like relocations. New argument added.
	(xcoff_mark): Adapt to new xcoff_need_ldrel_p argument.
	(xcoff_link_input_bfd): Likewise.

gas	* config/tc-ppc.c (ppc_get_csect_to_adjust): New function.
	(ppc_fix_adjustable): Manage fx_subsy part.
	(tc_gen_reloc): Create second relocation when both
	fx_addsy and fx_subsy are provided.
	* config/tc-ppc.h (RELOC_EXPANSION_POSSIBLE): New define.
	(MAX_RELOC_EXPANSION): Likewise.
	(TC_FORCE_RELOCATION_SUB_SAME): Likewise
	(UNDEFINED_DIFFERENCE_OK): Likewise
	* testsuite/gas/all/gas.exp: Skip difference between two
	undefined symbols test.

ld	* testsuite/ld-powerpc/aix52.exp: Add new test.
	* testsuite/ld-powerpc/aix-neg-reloc-32.d: New test.
	* testsuite/ld-powerpc/aix-neg-reloc-64.d: New test.
	* testsuite/ld-powerpc/aix-neg-reloc.ex: New test.
	* testsuite/ld-powerpc/aix-neg-reloc.s: New test.
2021-04-20 14:40:43 +01:00
GDB Administrator
66d6b8522e Automatic date update in version.in 2021-04-20 00:00:16 +00:00
GDB Administrator
9eab4c18bd Automatic date update in version.in 2021-04-19 00:00:13 +00:00
GDB Administrator
100cfce897 Automatic date update in version.in 2021-04-18 00:00:15 +00:00
GDB Administrator
1b348b6b67 Automatic date update in version.in 2021-04-17 00:00:15 +00:00
Alan Modra
6f8f6017a0 PR27567, Linking PE files adds alignment section flags to executables
So don't set those flags for an executable.  In the patch I also test
DYNAMIC even though the PE bfd code doesn't appear to set it for dlls.
I figure it doesn't hurt to include that flag too.

	PR 27567
bfd/
	* coffcode.h (styp_to_sec_flags): Use an unsigned long styp_flags.
	(coff_write_object_contents): Pass bfd to COFF_ENCODE_ALIGNMENT,
	ignore alignment checks when return is false.  Formatting.
include/
	* coff/internal.h (struct internal_scnhdr): Make s_flags unsigned long.
	* coff/pe.h (COFF_ENCODE_ALIGNMENT): Don't set align flags for an
	executable and return false.  Do so for a relocatable object and
	evaluate to true.
	* coff/ti.h (COFF_ENCODE_ALIGNMENT): Add bfd arg and evaluate to true.
	(COFF_DECODE_ALIGNMENT): Formatting.
	* coff/z80.h (COFF_ENCODE_ALIGNMENT): Similarly.
	(COFF_DECODE_ALIGNMENT): Similarly.
2021-04-16 23:21:44 +09:30
GDB Administrator
971cd33fc6 Automatic date update in version.in 2021-04-16 00:00:17 +00:00
Nelson Chu
ddfe525f28 RISC-V: PR27584, surpress local and empty name symbols for nm.
The local ".L0" symbol are usually generated to mark where the
auipc instruction is, and clang also uses ".LBB" to do the same
thing.  Besides, clang also uses the empty name symbols for label
differences.  Arm surpress their mapping symbols by regarding them
as special symbols, and MIPS surpress all local symbols.  Therefore,
RISC-V probably need to surpress the local and empty name symbols
for nm and related tools.  User can use "--special-syms" to show
these surpressed symbols.

bfd/
    PR27584
    * elfnn-riscv.c (riscv_elf_is_target_special_symbol): Added to
    omit local and empty symbols since they usually generated to
    mark the auipc instructions.
2021-04-15 10:32:36 +08:00
Lifang Xia
f6a1f95749 CSKY: Fix special_function in howto table
The special_function for reloc should be 'bfd_elf_generic_reloc',
reloc list:
	R_CKCORE_PCREL_IMM16BY2,
	R_CKCORE_PCREL_IMM16BY4,
	R_CKCORE_PCREL_IMM10BY4,
	R_CKCORE_PCREL_IMM18BY2,
	R_CKCORE_PCREL_FLRW_IMM8BY4

bfd/
	* elf32-csky.c (csky_elf_howto_table)
	<R_CKCORE_PCREL_IMM16BY2>: Set special_function to
	bfd_elf_generic_reloc.
	<R_CKCORE_PCREL_IMM16BY4>: Likewise.
	<R_CKCORE_PCREL_IMM10BY4>: Likewise.
	<R_CKCORE_PCREL_IMM18BY2>: Likewise.
	<R_CKCORE_PCREL_FLRW_IMM8BY4>: Likewise.
2021-04-15 10:07:35 +08:00
GDB Administrator
d4015fc5aa Automatic date update in version.in 2021-04-15 00:00:15 +00:00
H.J. Lu
9917b5596a elf: Set p_memsz to p_filesz for loadable PT_NOTE segment
Since p_memsz of the loadable PT_NOTE segment should be the same as
p_filesz, set p_memsz on the loadable PT_NOTE segment when updating
p_filesz.

bfd/

	PR binutils/27708
	* elf.c (assign_file_positions_for_non_load_sections): Set
	p_memsz to p_filesz for the loadable PT_NOTE segment.

binutils/

	PR binutils/27708
	* testsuite/binutils-all/x86-64/pr27708.dump: New file.
	* testsuite/binutils-all/x86-64/pr27708.exe.bz2: Likewise.
	* testsuite/binutils-all/x86-64/x86-64.exp: Run binutils/27708
	test.
2021-04-14 05:31:15 -07:00
Frederic Cambus
5f47741bf6 Remove unneeded tests for definitions of NT_BSDNETCORE values.
binutils* readelf.c (get_netbsd_elfcore_note_type): Remove unneeded #ifdef
	checks for NT_NETBSDCORE_AUXV and NT_NETBSDCORE_LWPSTATUS.

bfd	* elf.c (elfcore_grok_netbsd_note): Remove unneeded #ifdef
	checks for NT_NETBSDCORE_AUXV and NT_NETBSDCORE_LWPSTATUS.
2021-04-14 11:15:01 +01:00
Alan Modra
8985b74b7d PR27631, ubsan: elf32-metag.c:1550:10
PR 27631
	* elf32-metag.c (elf_metag_relocate_section): Don't use &hh->elf
	when hh might be NULL, test for NULL first.
2021-04-14 17:37:27 +09:30
Alan Modra
c9f9a78d00 PR27630, ubsan: elf32-arm.c:6587:20
PR 27630
	* elf32-arm.c (elf32_arm_size_stubs): Don't use &hash->root when
	hash might be NULL, cast instead.
2021-04-14 17:26:15 +09:30
GDB Administrator
c48a248e33 Automatic date update in version.in 2021-04-14 00:00:16 +00:00
Clément Chigot
d2f1139ef0 bfd: avoid infinite loop when static linking XCOFF
git commit b95a0a3177 changed a "return FALSE" to "continue", and
missed updating the while loop iterator.

	* xcofflink.c (xcoff_link_check_ar_symbols): Update esym earlier.
2021-04-13 18:23:39 +09:30
Nelson Chu
e3839c100f RISC-V: Don't report the mismatched version warning for the implicit extensions.
bfd/
    * elfnn-riscv.c (riscv_version_mismatch): Do not report the warning
    when the version of input or output is RISCV_UNKNOWN_VERSION, since
    the extension is added implicitly.
    * elfxx-riscv.c: Updated the obsolete comments.
    (RISCV_UNKNOWN_VERSION): Moved to elfxx-riscv.h.
    * elfxx-riscv.h (RISCV_UNKNOWN_VERSION): Added.
2021-04-13 12:49:51 +08:00
GDB Administrator
8d85d1f53f Automatic date update in version.in 2021-04-13 00:00:18 +00:00
Alan Modra
43e05cd4f4 ENABLE_CHECKING in bfd, opcodes, binutils, ld
gas already has this.  Here it enables checking hash table type passed
to elf_link_hash_lookup and elf_link_hash_traverse.

bfd/
	* elf-bfd.h (ENABLE_CHECKING): Define.
	(elf_link_hash_lookup): Abort if wrong type of hash table.
	(elf_link_hash_traverse): Likewise.
	* configure.ac (--enable-checking): Add support.
	* config.in: Regenerate.
	* configure: Regenerate.
binutils/
	* configure.ac (--enable-checking): Add support.
	* config.in: Regenerate.
	* configure: Regenerate.
ld/
	* configure.ac (--enable-checking): Add support.
	* config.in: Regenerate.
	* configure: Regenerate.
opcodes/
	* configure.ac (--enable-checking): Add support.
	* config.in: Regenerate.
	* configure: Regenerate.
2021-04-13 00:35:44 +09:30
Alan Modra
2cc15b10e5 convert elf_link_hash macros to inline functions
Involves a bit of editing as we now need to be more precise in pointer
types.

bfd/
	* elf-bfd.h (is_elf_hash_table): Convert macro to inline function.
	(elf_link_hash_lookup, elf_link_hash_traverse): Likewise.
	(elf_hash_table, elf_hash_table_id): Likewise.
	* elf32-arm.c (elf32_arm_setup_section_lists): Delete redundant
	is_elf_hash_table check.
	* elf32-csky.c (elf32_csky_setup_section_lists): Likewise.
	* elf32-hppa.c (clobber_millicode_symbols): Correct param types.
	* elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
	* elfnn-ia64.c (elfNN_ia64_global_dyn_info_free: Likewise.
	(elfNN_ia64_global_dyn_sym_thunk: Likewise.
	* elf64-ia64-vms.c (elf64_ia64_global_dyn_info_free): Likewise.
	(elf64_ia64_global_dyn_sym_thunk): Likewise.
	(elf64_vms_link_add_object_symbols): Pass base type of hash table
	to is_elf_hash_table.
	* elflink.c (_bfd_elf_dynamic_symbol_p): Likewise.
	(_bfd_elf_symbol_refs_local_p, _bfd_elf_add_dynamic_entry): Likewise.
	(_bfd_elf_strip_zero_sized_dynamic_sections): Likewise.
	(_bfd_elf_link_check_relocs, elf_link_add_object_symbols): Likewise.
	(bfd_elf_final_link): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_setup_section_lists): Likewise.
	* elf64-ppc.c (ppc64_elf_set_toc): Likewise.  Use bfd_link_hash_lookup.
ld/
	* emultempl/mipself.em (mips_create_output_section_statements):
	Pass base type of hash table to is_elf_hash_table.
	* ldelf.c (ldelf_after_open): Likewise.
2021-04-12 21:19:02 +09:30
Alan Modra
b585e89996 elf_backend_archive_symbol_lookup
elf_backend_archive_symbol_lookup might be called when the linker hash
table has entries of type generic_link_hash_entry.  This happens for
instance when running the mmix target linker testsuite where the
output is mmo but input is elf64-mmix.

	* elf-bfd.h (struct elf_backend_data): Return bfd_link_hash_entry*
	from elf_backend_archive_symbol_lookup.
	(_bfd_elf_archive_symbol_lookup): Return bfd_link_hash_entry*.
	* elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Likewise.  Check
	we have a ppc_hash_table before accessing ppc_link_hash_entry
	fields.
	* elflink.c (_bfd_elf_archive_symbol_lookup): Return
	bfd_link_hash_entry*.
	(elf_link_add_archive_symbols): Adjust to suit.
2021-04-12 21:19:02 +09:30
Nelson Chu
f5b1097353 RISC-V: The version of i-ext should be RISCV_UNKNOWN_VERSION when expanding g-ext.
Fix the wrong version of i-ext when expanding g-ext.  This was changed by
the previous patch accidently.

bfd/
    * elfxx-riscv.c (riscv_parse_std_ext): Fixed the wrong versions of
    i-ext when expanding g-ext.
2021-04-12 18:04:12 +08:00
Nelson Chu
f0bae2552d RISC-V: Add i-ext as the implicit extension when e-ext is set.
The linker does not care the default versions of the extensions, since
it does not have the default ISA spec setting.  Therefore, linker won't
insert the implicit extensions for the input objects.  But we used to
insert the i-ext as the explicit extension, even if the e-ext is set.
This causes linker to report "cannot find default versions of the ISA
extension `i'" errors when linking the input objects with e-ext.

This patch fixes the above linker problem, and also remove the confused
riscv_ext_dont_care_version function.  Unless these "dont care" extensions
are set in the input architecture explicitly, otherwise we always insert
them as the implicit ones.  Afterwards, let riscv_arch_str1 surpress them
not to output to the architecture string if their versions are
RISCV_UNKNOWN_VERSION.

bfd/
    * elfxx-riscv.c (riscv_ext_dont_care_version): Removed.
    (riscv_parse_add_subset): Always add the implicit extensions, even if
    their versions are RISCV_UNKNOWN_VERSION.
    (riscv_parse_std_ext): Delay to add i-ext as the implicit extension
    in the riscv_parse_add_implicit_subsets.  Besides, add g-ext as the
    implicit extension after it has been expanded.
    (riscv_parse_add_implicit_subsets): Updated.
2021-04-12 17:51:07 +08:00
Nelson Chu
e601909a32 RISC-V: Support to parse the multi-letter prefix in the architecture string.
The original discussion is as follows,
https://github.com/riscv/riscv-isa-manual/issues/637

I never considered the prefixes may have multiple letters, like zxm.
But the ISA spec has been updated for a long time that I haven't noticed.
This patch rewrites the part of architecture parser to support parsing
the multi-letter prefixes.  Besides, I also improve the parser to report
errors in details.  One of the most obvious improvement is - Do not parse
the prefixed extensions according to the orders in the parse_config.
If we do so, then we used to get "unexpected ISA string at end" errors,
but the message is a little bit  hard to know what is happening.  I Remove
the confused message, and let riscv_parse_prefixed_ext to report the details.

bfd/
    * elfxx-riscv.c (riscv_std_z_ext_strtab): Moved forward.
    (riscv_std_s_ext_strtab): Likewise.
    (riscv_std_h_ext_strtab): Likewise.
    (riscv_std_zxm_ext_strtab): Added for the zxm prefix.
    (enum riscv_prefix_ext_class): Moved forward and renamed from
    riscv_isa_ext_class.  Reorder them according to the parsing order,
    since the enum values are used to check the orders in the
    riscv_compare_subsets.
    (struct riscv_parse_prefix_config): Moved forward and renamed from
    riscv_parse_config_t.  Also removed the ext_valid_p field, the
    related functions are replaced by riscv_valid_prefixed_ext.
    (parse_config): Moved forward and updated.  The more letters of the
    prefix string, the more forward it must be defined.  Otherwise, we
    will get the wrong mapping when using strncmp in riscv_get_prefix_class.
    (riscv_get_prefix_class): Moved forward.  Support to parse the
    multi-letter prefix, like zxm.
    (riscv_known_prefixed_ext): New function, check if the prefixed
    extension is supported according to the right riscv_std_*_ext_strtab.
    (riscv_valid_prefixed_ext): New function, used to replace the
    riscv_ext_*_valid_p functions.
    (riscv_init_ext_order): Do not set the values for prefix keywords
    since they may have multiple letters for now.
    (riscv_compare_subsets): Set the order values of prefix keywords
    to negative numbers according to the riscv_prefix_ext_class.
    (riscv_parse_std_ext): Call riscv_get_prefix_class to see if we
    have parsed the prefixed extensions.
    (riscv_parse_prefixed_ext): Updated and removed the parameter config.
    Report error when the prefix is unknown.
    (riscv_parse_subset): Do not parse the prefixed extensions according
    to the orders in the parse_config.  Remove the confused message and
    let riscv_parse_prefixed_ext to report the details.
    * elfxx-riscv.h (enum riscv_isa_ext_class): Moved to elfxx-riscv.c.
    (riscv_get_prefix_class): Removed to static.
gas/
    * testsuite/gas/riscv/march-fail-order-x-std.d: Renamed from
    march-fail-porder-x-std.d.
    * testsuite/gas/riscv/march-fail-order-z-std.d: Renamed from
    march-fail-porder-z-std.d.
    * testsuite/gas/riscv/march-fail-order-x-z.d: Renamed from
    march-fail-porder-x-z.d.
    * testsuite/gas/riscv/march-fail-order-zx-std.l: Added to replace
    march-fail-porder.l.
    * testsuite/gas/riscv/march-fail-order-x-z.l: Likewise.
    * testsuite/gas/riscv/march-fail-order-x.l: Updated.
    * testsuite/gas/riscv/march-fail-order-z.l: Likewise.
    * testsuite/gas/riscv/march-fail-single-prefix-h.d: Renamed from
    march-fail-single-char-h.d.
    * testsuite/gas/riscv/march-fail-single-prefix-s.d: Renamed from
    march-fail-single-char-s.d.
    * testsuite/gas/riscv/march-fail-single-prefix-x.d: Renamed from
    march-fail-single-char-x.d.
    * testsuite/gas/riscv/march-fail-single-prefix-z.d: Renamed from
    march-fail-single-char-z.d.
    * testsuite/gas/riscv/march-fail-single-prefix-zmx.d: Added.
    * testsuite/gas/riscv/march-fail-single-prefix.l: Added to replace
    march-fail-single-prefix.l.
    * testsuite/gas/riscv/march-fail-unknown-zxm.d: Added.
    * testsuite/gas/riscv/march-fail-unknown-std.l: Updated.
    * testsuite/gas/riscv/march-fail-unknown.l: Likewise.
2021-04-12 10:05:37 +08:00
GDB Administrator
6803e1cb21 Automatic date update in version.in 2021-04-12 00:00:15 +00:00
GDB Administrator
2cbb0a1b2e Automatic date update in version.in 2021-04-11 00:00:15 +00:00
GDB Administrator
ac4d7c7bfa Automatic date update in version.in 2021-04-10 00:00:15 +00:00
GDB Administrator
39178037a1 Automatic date update in version.in 2021-04-09 00:00:18 +00:00
Mike Frysinger
eec8bf7eab bfd: use https for bugzilla 2021-04-08 00:46:48 -04:00
GDB Administrator
bf5271659d Automatic date update in version.in 2021-04-08 00:00:14 +00:00
GDB Administrator
e23446bf96 Automatic date update in version.in 2021-04-07 00:00:15 +00:00
GDB Administrator
a32a7fdc94 Automatic date update in version.in 2021-04-06 00:00:15 +00:00
Alan Modra
83c79df86b C99 bfd configury
Certain library headers and functions are required by C99.  This
removes configure tests for them.  The patch also removes AC_ISC_POSIX
and AC_HEADER_DIRENT, which the autoconf manual states are obsolescent.
sys/time.h is no longer tangled up with time.h so it can be handled by
the gprof configure.

	* configure.ac: Don't check for long long or long double type.
	Don't check for alloca.h, limits.h, stddef.h, stdlib.h, string.h,
	strings.h, time.h, wchar.h, wctype.h or sys/time.h.  Don't check
	for strtoull, free, malloc, realloc, getenv, strstr, snprintf,
	vsnprintf, strlen or setitimer.  Sort AC_CHECK_DECLS.
	(AC_ISC_POSIX): Don't invoke.
	(AC_HEADER_TIME, AC_HEADER_DIRENT, ACX_HEADER_STRING): Likewise.
	* sysdep.h: Remove many HAVE_*_H checks and fallback declarations.
	Do test HAVE_SYS_TYPES_H.  Don't include sys/time.h.  Reorder
	header order as per automake AC_INCLUDES_DEFAULT.
	* bfd-in.h: Include inttypes.h unconditionally.
	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Assume long long and
	long double are available.
	(bfd_scan_vma): Assume long long and strtoull are available.
	* elflink.c: Include limits.h unconditionally.
	* elfnn-riscv.c: Likewise.
	* wasm-module.c: Likewise.
	* hpux-core.c: Include dirent.h unconditionally.
	* trad-core.c: Likewise.
	* hosts/x86-64linux.h: Include stdlib.h unconditionally.
	* peXXigen.c: Remove HAVE_WCHAR_H and HAVE_WCTYPE_H checks.
	* elf32-m68hc1x.c: Don't include alloca-conf.h.
	* elf64-hppa.c: Likewise.
	* som.c: Likewise.
	* wasm-module.c: Likewise.
	* xsym.c: Likewise.
	* bfd-in2.h: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
2021-04-05 15:27:37 +09:30
GDB Administrator
a2991571f0 Automatic date update in version.in 2021-04-05 00:00:15 +00:00
GDB Administrator
9bcbcdf229 Automatic date update in version.in 2021-04-04 00:00:14 +00:00
GDB Administrator
ca698bee0a Automatic date update in version.in 2021-04-03 00:00:14 +00:00
GDB Administrator
3451a2d7a3 Automatic date update in version.in 2021-04-02 00:00:15 +00:00
Tamar Christina
74edb473c9 PE/Windows x86_64: Fix weak undef symbols after image base change
The change in PR19011 changed the image load address from being in the lower
32-bit address space to the higher 64-bit address space.

However when you have a weak undef symbol which stays undef at the end of
linking the linker has to resolve this (Windows loader does not support undef
symbols).  As such typically these would resolve to 0.

The relocation used for these weak symbols are the normal 32-bit PC_REL call
relocs.  So when doing the overflow check LD checks if the distance between the
symbol and the call is within range.  However now that the load address is
> 32-bits and the symbol val is 0 this overflow check will always fail.

As such the linker gives a bogus error.  This patch makes the linker not emit
the overflow failure but chooses to still let the check be performed (as it's
mid-end code).

One down side of this is that it does break the common convention that the call
be to sym at 0x0. i.e. before you'd get

      401015:   74 05                   je     40101c
      401017:   e8 e4 ef bf ff          callq  0

and now you get

   140001015:   74 05                   je     14000101c
   140001017:   e8 e4 ef ff bf          call   100000000

since the call is PC_REL there's no way to get the range large enough to
resolve to 0.  As such I have chosen to leave it as the furthest simple range
that we can still represent.

By only ignoring the error we leave the symbol value itself to still be 0
such that the if(<symbol>) checks still work correctly.

bfd/ChangeLog:

2021-04-01  Tamar Christina  <tamar.christina@arm.com>

	PR ld/26659
	* cofflink.c (_bfd_coff_generic_relocate_section): Ignore overflow.

ld/ChangeLog:

2021-04-01  Tamar Christina  <tamar.christina@arm.com>

	PR ld/26659
	* testsuite/ld-pe/pe.exp: Add test.
	* testsuite/ld-pe/pr26659-weak-undef-sym.d: New test.
	* testsuite/ld-pe/pr26659-weak-undef-sym.s: New test.
2021-04-01 17:54:04 +01:00
Martin Liska
e9b095a538 Remove strneq macro and use startswith.
bfd/ChangeLog:

	* ecoff.c (strneq): Remove strneq and use startswith.
	(_bfd_ecoff_slurp_armap): Likewise.

binutils/ChangeLog:

	* elfcomm.h (strneq): Remove strneq and use startswith.
	* readelf.c (ia64_process_unwind): Likewise.
	(process_note): Likewise.

gas/ChangeLog:

	* config/obj-coff.c (strneq): Remove strneq and use startswith.
	(weak_is_altname): Likewise.
	(obj_coff_section): Likewise.
	* config/tc-cr16.c (process_label_constant): Likewise.
	* config/tc-crx.c (strneq): Likewise.

include/ChangeLog:

	* opcode/cr16.h (strneq): Remove strneq and use startswith.

ld/ChangeLog:

	* ldbuildid.c (strneq): Remove strneq and use startswith.
	(validate_build_id_style): Likewise.
	(compute_build_id_size): Likewise.

opcodes/ChangeLog:

	* arm-dis.c (strneq): Remove strneq and use startswith.
	* cr16-dis.c (print_insn_cr16): Likewise.
	* score-dis.c (streq): Likewise.
	(strneq): Likewise.
	* score7-dis.c (strneq): Likewise.
2021-04-01 15:00:56 +02:00
Martin Liska
3f3328b816 Use startswith more for strncmp function calls.
bfd/ChangeLog:

	* elf-bfd.h (bfd_section_is_ctf): Use startswith function.
	* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
	(elf_get_reloc_section): Likewise.
	* elf32-arc.c (elf_arc_size_dynamic_sections): Likewise.
	* elf32-m32r.c (m32r_elf_section_flags): Likewise.
	* elf32-microblaze.c (microblaze_elf_size_dynamic_sections): Likewise.
	* elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
	(nds32_elf_relocate_section): Likewise.
	(nds32_elf_action_discarded): Likewise.
	(nds32_elf_check_relocs): Likewise.
	(nds32_elf_section_flags): Likewise.
	* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
	* elf32-ppc.c (ppc_elf_section_from_shdr): Likewise.
	* elf32-rx.c (rx_table_find): Likewise.
	(rx_table_map): Likewise.
	* elf32-spu.c (spu_elf_backend_symbol_processing): Likewise.
	(spu_elf_find_overlays): Likewise.
	(needs_ovl_stub): Likewise.
	(allocate_spuear_stubs): Likewise.
	(build_spuear_stubs): Likewise.
	(mark_overlay_section): Likewise.
	(spu_elf_auto_overlay): Likewise.
	(spu_elf_output_symbol_hook): Likewise.
	* elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
	* elf32-xtensa.c (xtensa_property_section_name): Likewise.
	* elf64-ppc.c (ppc64_elf_section_flags): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* elflink.c (resolve_section): Likewise.
	(UNARY_OP): Likewise.
	(BINARY_OP_HEAD): Likewise.
	(elf_link_input_bfd): Likewise.
	* elfnn-riscv.c (riscv_elf_size_dynamic_sections): Likewise.
	* elfxx-riscv.c (riscv_parse_subset): Likewise.
	* elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
	* opncls.c (get_build_id): Likewise.

binutils/ChangeLog:

	* dllwrap.c: Use startswith function.
	* objcopy.c (is_dwo_section): Likewise.
	(handle_remove_section_option): Likewise.
	(copy_main): Likewise.
	* objdump.c (is_significant_symbol_name): Likewise.
2021-04-01 14:59:04 +02:00