Commit Graph

6578 Commits

Author SHA1 Message Date
Alan Modra b657622c3e Re: Change readelf's display of symbol names
Fixes some fallout from git commit 0942c7ab94.

	PR 26028
gas/
	* testsuite/gas/ia64/unwind-ilp32.d: Add -T to readelf options.
gold/
	* testsuite/Makefile.am (file_in_many_sections.stdout): Add -W
	to readelf options.
	* testsuite/Makefile.in: Regenerate.
ld/
	* testsuite/ld-arm/arm-elf.exp (vxworks1): Pass --wide to readelf
	when dumping relocs.
	* testsuite/ld-i386/i386.exp (vxworks1): Likewise.
	* testsuite/ld-sh/sh-vxworks.exp (vxworks1): Likewise.
	* testsuite/ld-sparc/sparc.exp (vxworks1): Likewise.
	* testsuite/ld-arm/vxworks1.rd: Adjust to suit.
	* testsuite/ld-i386/vxworks1.rd: Adjust.
	* testsuite/ld-sh/vxworks1.rd: Adjust.
	* testsuite/ld-sparc/vxworks1.rd: Adjust.
2020-07-03 17:15:16 +09:30
Nick Clifton 0942c7ab94 Change readelf's display of symbol names (when not in --wide mode) so that if they are going to be truncated then "[...]" is displayed at the end. Add a comment line option to disable this enhancement and restore the old behaviour.
PR 26028
binutils* readelf.c (print_symbol): Handle truncation of symbol names.
	(options): Add -T/--silent-truncation option.
	(parse_args): Handle the option.
	(print_dynamic_symbol): Correct calculation of width available to
	display symbol name.
	* doc/binutils.texi: Document the -T option to readelf.
	* NEWS: Mention the new feature.

gas	* testsuite/gas/ia64/group-2.d: Add -T option to readelf
	command line.
	* testsuite/gas/ia64/unwind.d: Likewise.
	* testsuite/gas/mmix/bspec-1.d: Likewise.
	* testsuite/gas/mmix/bspec-2.d: Likewise.
	* testsuite/gas/mmix/comment-1.d: Likewise.
	* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.

ld	* testsuite/ld-powerpc/powerpc.exp: Add -T option to readelf
	command line when running some tests.
	* testsuite/ld-arm/arm-elf.exp: Likewise.
	* testsuite/ld-mips-elf/mips-elf.exp: Likewise.
	* testsuite/ld-mmix/local1.d: Likewise.
	* testsuite/ld-mmix/local3.d: Likewise.
	* testsuite/ld-mmix/local5.d: Likewise.
	* testsuite/ld-mmix/local7.d: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
2020-07-02 11:30:52 +01:00
H.J. Lu bbd19b19e4 Remove x86 NaCl target support
NaCl has been deprecated:

https://developer.chrome.com/native-client/migration

and NaCl will completely disappear in 2021:

https://lists.llvm.org/pipermail/llvm-dev/2020-April/141107.html

Remove x86 NaCl target support from bfd, binutils, gas and ld.

bfd/

	* archures.c (bfd_mach_i386_nacl): Removed.
	(bfd_mach_i386_i386_nacl): Likewise.
	(bfd_mach_x86_64_nacl): Likewise.
	(bfd_mach_x64_32_nacl): Likewise.
	* config.bfd: Remove *-*-nacl* targets.
	* configure.ac: Remove x86 NaCl target vectors.
	* cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
	(bfd_x64_32_nacl_arch): Likewise.
	(bfd_x86_64_nacl_arch): Likewise.
	(bfd_i386_nacl_arch): Likewise.
	(bfd_x64_32_arch_intel_syntax): Updated.
	* elf32-i386.c: Don't include "elf-nacl.h".
	(elf_i386_nacl_plt): Removed.
	(elf_i386_nacl_plt0_entry): Likewise.
	(elf_i386_nacl_plt_entry): Likewise.
	(elf_i386_nacl_pic_plt0_entry): Likewise.
	(elf_i386_nacl_pic_plt_entry): Likewise.
	(elf_i386_nacl_eh_frame_plt): Likewise.
	(elf_i386_nacl_plt): Likewise.
	(elf32_i386_nacl_elf_object_p): Likewise.
	(elf_i386_get_synthetic_symtab): Updated.
	(elf_i386_link_setup_gnu_properties): Likewise.
	* elf64-x86-64.c: Don't include "elf-nacl.h".
	(elf_x86_64_nacl_plt): Removed.
	(elf64_x86_64_nacl_elf_object_p): Likewise.
	(elf_x86_64_nacl_plt0_entry): Likewise.
	(elf_x86_64_nacl_plt_entry): Likewise.
	(elf_x86_64_nacl_eh_frame_plt): Likewise.
	(elf_x86_64_nacl_plt): Likewise.
	(elf32_x86_64_nacl_elf_object_p): Likewise.
	(elf_x86_64_get_synthetic_symtab): Updated.
	(elf_x86_64_link_setup_gnu_properties): Likewise.
	* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
	* targets.c: Remove x86 NaCl target vectors.
	* bfd-in2.h: Regenerated.
	* configure: Likewise.

binutils/

	* NEWS: Mention x86 NaCl target support removal.
	* dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): Remove
	x86 NaCl target support.
	* testsuite/binutils-all/elfedit-1.d: Likewise.
	* testsuite/binutils-all/i386/i386.exp: Likewise.
	* testsuite/binutils-all/x86-64/objects.exp: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
	* testsuite/binutils-all/x86-64/x86-64.exp: Likewise.

gas/

	* NEWS: Mention x86 NaCl target support removal.
	* config/tc-i386.c: Remove x86 NaCl target support.
	* config/tc-i386.h: Likewise.
	* configure.tgt: Likewise.
	* testsuite/gas/i386/i386.exp: Likewise.
	* testsuite/gas/i386/iamcu-1.d: Likewise.
	* testsuite/gas/i386/iamcu-2.d: Likewise.
	* testsuite/gas/i386/iamcu-3.d: Likewise.
	* testsuite/gas/i386/iamcu-4.d: Likewise.
	* testsuite/gas/i386/iamcu-5.d: Likewise.
	* testsuite/gas/i386/k1om.d: Likewise.
	* testsuite/gas/i386/l1om.d: Likewise.

ld/

	* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_nacl.c,
	eelf32_x86_64_nacl.c, eelf_x86_64_nacl.c.
	Remove x86 NaCl dep files.
	* NEWS: Mention x86 NaCl target support removal.
	* configure.tgt: Remove x86 NaCl target support.
	* testsuite/ld-elf/binutils.exp: Likewise.
	* testsuite/ld-elf/elf.exp: Likewise.
	* testsuite/ld-elfvers/vers.exp: Likewise.
	* testsuite/ld-i386/align-branch-1.d: Likewise.
	* testsuite/ld-i386/export-class.exp: Likewise.
	* testsuite/ld-i386/i386.exp: Likewise.
	* testsuite/ld-i386/load1.d: Likewise.
	* testsuite/ld-i386/pie1.d: Likewise.
	* testsuite/ld-i386/pr12570a.d: Likewise.
	* testsuite/ld-i386/pr12570b.d: Likewise.
	* testsuite/ld-i386/pr19636-1d.d: Likewise.
	* testsuite/ld-i386/pr19636-1l.d: Likewise.
	* testsuite/ld-i386/pr19636-2c.d: Likewise.
	* testsuite/ld-i386/pr19636-2d.d: Likewise.
	* testsuite/ld-i386/pr19636-2e.d: Likewise.
	* testsuite/ld-i386/pr20244-1a.d: Likewise.
	* testsuite/ld-i386/pr20244-1b.d: Likewise.
	* testsuite/ld-i386/pr20244-2a.d: Likewise.
	* testsuite/ld-i386/pr20244-2b.d: Likewise.
	* testsuite/ld-i386/pr20244-2c.d: Likewise.
	* testsuite/ld-i386/pr20244-4a.d: Likewise.
	* testsuite/ld-i386/pr20244-4b.d: Likewise.
	* testsuite/ld-i386/pr21884.d: Likewise.
	* testsuite/ld-ifunc/binutils.exp: Likewise.
	* testsuite/ld-ifunc/ifunc-10-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
	* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
	* testsuite/ld-ifunc/pr17154-i386-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
	* testsuite/ld-plugin/lto.exp: Likewise.
	* testsuite/ld-x86-64/align-branch-1.d: Likewise.
	* testsuite/ld-x86-64/dwarfreloc.exp: Likewise.
	* testsuite/ld-x86-64/line.exp: Likewise.
	* testsuite/ld-x86-64/load1a.d: Likewise.
	* testsuite/ld-x86-64/load1b.d: Likewise.
	* testsuite/ld-x86-64/load1c.d: Likewise.
	* testsuite/ld-x86-64/load1d.d: Likewise.
	* testsuite/ld-x86-64/pie3.d: Likewise.
	* testsuite/ld-x86-64/pr18160.d: Likewise.
	* testsuite/ld-x86-64/pr19013-x32.d: Likewise.
	* testsuite/ld-x86-64/pr19013.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1b.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1f.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1h.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1j.d: Likewise.
	* testsuite/ld-x86-64/pr20253-1l.d: Likewise.
	* testsuite/ld-x86-64/pr21884.d: Likewise.
	* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
	* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
	* testsuite/ld-x86-64/tlsgd10.dd: Likewise.
	* testsuite/ld-x86-64/tlsgd5.dd: Likewise.
	* testsuite/ld-x86-64/tlsgd8.dd: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* emulparams/elf32_x86_64_nacl.sh: Removed.
	* emulparams/elf_i386_nacl.sh: Likewise.
	* emulparams/elf_x86_64_nacl.sh: Likewise.
	* testsuite/ld-i386/emit-relocs-nacl.rd: Likewise.
	* testsuite/ld-i386/load1-nacl.d: Likewise.
	* testsuite/ld-i386/pie1-nacl.d: Likewise.
	* testsuite/ld-i386/plt-nacl.pd: Likewise.
	* testsuite/ld-i386/plt-pic-nacl.pd: Likewise.
	* testsuite/ld-i386/pr17709-nacl.rd: Likewise.
	* testsuite/ld-i386/pr19636-1d-nacl.d: Likewise.
	* testsuite/ld-i386/pr19636-2c-nacl.d: Likewise.
	* testsuite/ld-i386/pr19636-2d-nacl.d: Likewise.
	* testsuite/ld-i386/pr19636-2e-nacl.d: Likewise.
	* testsuite/ld-i386/pr19827-nacl.rd: Likewise.
	* testsuite/ld-i386/pr21884-nacl.d: Likewise.
	* testsuite/ld-i386/pr21884-nacl.t: Likewise.
	* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsbin2-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
	* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
	* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
	* testsuite/ld-i386/tlspic2-nacl.rd: Likewise.
	* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1a-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1b-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1c-nacl.d: Likewise.
	* testsuite/ld-x86-64/load1d-nacl.d: Likewise.
	* testsuite/ld-x86-64/pie3-nacl.d: Likewise.
	* testsuite/ld-x86-64/plt-nacl.pd: Likewise.
	* testsuite/ld-x86-64/pr17709-nacl.rd: Likewise.
	* testsuite/ld-x86-64/pr19013-nacl.d: Likewise.
	* testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise.
	* testsuite/ld-x86-64/pr19827-nacl.rd: Likewise.
	* testsuite/ld-x86-64/pr21884-nacl.d: Likewise.
	* testsuite/ld-x86-64/pr21884-nacl.t: Likewise.
	* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsdesc-nacl.pd: Likewise.
	* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
	* testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise.
	* Makefile.in: Regenerated.
	* po/BLD-POTFILES.in: Likewise.
2020-06-30 08:56:14 -07:00
Alan Modra fb4a044b5a solaris XPASS ld-elf/group1
* testsuite/ld-elf/group1.d: Don't xfail all solaris targets, just
	ix86 and x86_64.
2020-06-30 14:26:05 +09:30
Alan Modra b9b9b0ef34 Don't xfail nds32 for ld-elf/reloc-discard test
* testsuite/ld-elf/reloc-discard.d: Don't xfail nds32.
2020-06-30 14:26:05 +09:30
Alan Modra 39d050ee50 microblaze-linux XPASS ld-elf/var1
microblaze-linux uses the standard ELF script, microblaze-elf its own
script lacking an input section pattern needed to make this test pass.
Add the missing pattern for .data, in line with most other sections
that do have .* patterns.

	* scripttempl/elfmicroblaze.sc (.data): Add .data.* entry.
	* testsuite/ld-elf/var1.d: Don't xfail microblaze.
2020-06-30 13:32:04 +09:30
H.J. Lu a57f74bb7c tic6x: Call _bfd_elf_add_dynamic_tags
Update tic6x linker tests to expect C6000_DSBT_BASE, C6000_DSBT_SIZE and
C6000_DSBT_INDEX dynamic tags immediately before NULL dynamic tag.

bfd/

	* elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Call
	_bfd_elf_add_dynamic_tags.

ld/

	* testsuite/ld-tic6x/shlib-1.rd: Move C6000_DSBT_BASE,
	C6000_DSBT_SIZE and C6000_DSBT_INDEX dynamic tags to the last.
	* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
	* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
	* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
	* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
	* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
	* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
	* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
	* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
2020-06-29 05:53:01 -07:00
Alan Modra 290a25dc2d x86_64 k1om tests
On x86_64-nacl we currently see
FAIL: Absolute non-overflowing relocs
FAIL: ld-x86-64/protected2-k1om
FAIL: ld-x86-64/protected3-k1om

This limits the tests as per the l1om variants.

	* testsuite/ld-x86-64/abs-k1om.d: Run only on x86_64-*-linux*.
	* testsuite/ld-x86-64/protected2-k1om.d: Likewise.
	* testsuite/ld-x86-64/protected3-k1om.d: Likewise.
2020-06-29 10:04:11 +09:30
Nick Alcock 094e34f221 binutils, ld: work with --disable-libctf
This unfortunately means conditionalizing out all the libctf code, but
the result is not too unbearably ugly, if a bit repetitive.  I have
stubbed out code in the !ENABLE_LIBCTF path to avoid extra redundant
ifdefs where it seems that might be helpful.  (The stubs are not too
disruptive, but I've tried to keep them on one line where possible to
avoid filling up the screen with stubs that nobody would care about.
If this is too much of a coding style violation I can change it.)

Changes since v2: use GCC_ENABLE rather than repeating all the
                  AC_ARG_ENABLE stuff over and over again.

ld/
	* configure.ac [--enable-libctf]: New, default yes.
	Set ENABLE_LIBCTF accordingly.
	* Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF.
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* ldlang.c (ctf_output): Conditionalize on ENABLE_LIBCTF.
	(ldlang_open_ctf): Likewise.
	(lang_merge_ctf): Likewise.
	(ldlang_ctf_apply_strsym): Likewise.
	(lang_write_ctf): Likewise.
	(ldlang_write_ctf_late): Likewise.
	(ldlang_open_ctf) [!ENABLE_LIBCTF]: Warn about the presence of CTF
	sections.
	(lang_merge_ctf) [!ENABLE_LIBCTF]: New stub.
	(ldlang_ctf_apply_strsym) [!ENABLE_LIBCTF]: Likewise.
	(lang_write_ctf) [!ENABLE_LIBCTF]: Likewise.
	(ldlang_write_ctf_late) [!ENABLE_LIBCTF]: Likewise.
	* ldelfgen.c (ldelf_emit_ctf_early): Conditionalize on
	ENABLE_LIBCTF.
	(struct ctf_strsym_iter_cb_arg): Likewise.
	(ldelf_ctf_strtab_iter_cb): Likewise.
	(ldelf_ctf_symbols_iter_cb): Likewise.
	(ldelf_examine_strtab_for_ctf): Likewise.
	(ldelf_emit_ctf_early) [!ENABLE_LIBCTF]: New stub.
	(ldelf_examine_strtab_for_ctf) [!ENABLE_LIBCTF]: New stub.

binutils/
	* configure.ac [--enable-libctf]: New, default yes.
	Set ENABLE_LIBCTF accordingly.
	* Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF and LIBCTF_NOBFD.
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* objdump.c (usage): Conditionalize portions on ENABLE_LIBCTF.
	(option_values): Likewise.
	(long_options): Likewise.
	(main): Likewise.
	(dump_ctf_indent_lines): Conditionalize out when !ENABLE_LIBCTF.
	(make_ctfsect): Likewise.
	(dump_ctf_archive_member): Likewise.
	(dump_ctf) [ENABLE_LIBCTF]: Likewise.
	(dump_ctf) [!ENABLE_LIBCTF]: New empty stub.
	* readelf.c (options): Conditionalize portions on ENABLE_LIBCTF.
	(usage): Likewise.
	(process_section_contents): Likewise.
	(shdr_to_ctf_sect): Conditionalize out when !ENABLE_LIBCTF.
	(dump_ctf_indent_lines): Likewise.
	(dump_section_as_ctf) [ENABLE_LIBCTF]: Likewise.
2020-06-26 15:56:39 +01:00
Jan Beulich 198e1db737 ld/x86: actually invoke k1om tests
Unlike claimed by the ChangeLog entries added by 7a9068fe16 ("Add
initial Intel K1OM support") these tests did never get enabled.
2020-06-26 16:43:38 +02:00
Pat Bernardi 85f7484a3a m68k: tag floating-point ABI used
This patch adds GNU attribute support to m68k and utilises it to tag the
floating-point calling convention used (hard-float or soft-float). It enables
the linker to ensure linked objects use a consistent floating-point ABI and
allows tools like GDB to infer the ABI used from the ELF file. It is based on
similar work done for PowerPC.

bfd/
	* elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
	(elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
binutils/
	* readelf.c (display_m68k_gnu_attribute): New function.
	(process_arch_specific): Call display_m68k_gnu_attribute for EM_68K.
gas/
	* config/tc-m68k.c (m68k_elf_gnu_attribute): New function.
	(md_pseudo_table): Handle "gnu_attribute".
	* doc/as.texi: Document GNU attribute for M68K.
include/
	* elf/m68k.h: Add enum for GNU object attribute with floating point
	tag name and values.
ld/
	* testsuite/ld-m68k/attr-gnu-4-0.s: New file.
	* testsuite/ld-m68k/attr-gnu-4-1.s: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-2.s: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-00.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-01.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-02.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-10.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-11.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-12.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-20.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-21.d: Likewise.
	* testsuite/ld-m68k/attr-gnu-4-22.d: Likewise.
	* testsuite/ld-m68k/m68k.exp: Run the new tests.
2020-06-26 14:42:19 +09:30
H.J. Lu 4bf05d4a90 ld: Correct --dependency-file order
Change ld --help output to

  -d, -dc, -dp                Force common symbols to be defined
  --dependency-file FILE      Write dependency file

instead of

  -d, -dc                     Force common symbols to be defined
  --dependency-file FILE, -dp Write dependency file

	PR ld/26165
	* lexsup.c (ld_options): Correct --dependency-file order.
2020-06-24 06:39:03 -07:00
H.J. Lu 2c8e370829 csky: Don't generate unnecessary dynamic tags
Dynamic tags, DT_JMPREL, PLTREL and PLTRELSZ, are needed only if there
are relocation entries for PLT.  Don't generate them if there are no
relocation entries for PLT.

bfd/

	PR ld/26083
	* elf32-csky.c (csky_elf_size_dynamic_sections): Call
	_bfd_elf_add_dynamic_tags.

ld/

	PR ld/26083
	* testsuite/ld-csky/tls-ie-v1.d: Updated.
	* testsuite/ld-csky/tls-ie.d: Likewise.
2020-06-24 06:14:28 -07:00
H.J. Lu c679ec98a1 cris: Don't generate unnecessary dynamic tags
Dynamic tags, DT_JMPREL, PLTREL and PLTRELSZ, are needed only if there
are relocation entries for PLT.  Don't generate them if there are no
relocation entries for PLT.

bfd/

	PR ld/26083
	* elf32-cris.c (elf_cris_size_dynamic_sections): Call
	_bfd_elf_add_dynamic_tags.

ld/

	PR ld/26083
	* testsuite/ld-cris/libdso-15b.d: Updated.
	* testsuite/ld-cris/libdso-1c.d: Likewise.
	* testsuite/ld-cris/libdso-1d.d: Likewise.
	* testsuite/ld-cris/libdso-15c.d: New file.
2020-06-24 04:00:31 -07:00
H.J. Lu 5376d47f66 ld: Set non_ir_ref_regular on source for assignment
We need to set non_ir_ref_regular on the source for assignment to get
the correct LTO resolution:

190 a27be7f4ad90c5ce PREVAILING_DEF real_g

instead of

190 30c3b2d8f967f5ea PREVAILING_DEF_IRONLY real_g

	PR ld/26163
	* ldexp.c (exp_fold_tree_1): Set non_ir_ref_regular on the source
	for assignment.
	* testsuite/ld-plugin/lto.exp: Run ld/26163 test.
	* testsuite/ld-plugin/pr26163a.c: New file.
	* testsuite/ld-plugin/pr26163b.c: Likewise.
2020-06-24 03:56:16 -07:00
Alan Modra a5aae5087c ld --help output
It's best if help message output does not contain tabs, since we don't
know tab stop settings or even if tabs are handled by the output
device.  This reverts some 2020-06-23 changes and fixes the csky help
message.

	* lexsup.c (elf_shlib_list_options): Properly format help message.
	(elf_plt_unwind_list_options): Likewise.
	* emultempl/cskyelf.em (PARSE_AND_LIST_OPTIONS): Likewise.
2020-06-24 20:00:08 +09:30
Roland McGrath f37b21b481 PR 22843: ld, gold: Add --dependency-file option.
gold/
	* options.h (class General_options): Add --dependency-file option.
	* fileread.cc (File_read::files_read): New static variable.
	(File_read::open): Add the file to the files_read list.
	(File_read::record_file_read): New static member function.
	(File_read::write_dependency_file): New static member function.
	* fileread.h (class File_read): Declare them.
	* layout.cc (Layout::read_layout_from_file): Call record_file_read.
	(Close_task_runner::run): Call write_dependency_file if
	--dependency-file was passed.

ld/
	* NEWS: Note --dependency-file.
	* ld.texi (Options): Document --dependency-file.
	* ldlex.h (enum option_values): Add OPTION_DEPENDENCY_FILE.
	* ld.h (ld_config_type): New member dependency_file.
	* lexsup.c (ld_options, parse_args): Parse --dependency-file.
	* ldmain.c (struct dependency_file): New type.
	(dependency_files, dependency_files_tail): New static variables.
	(track_dependency_files): New function.
	(write_dependency_file): New function.
	(main): Call it when --dependency-file was passed.
	* ldfile.c (ldfile_try_open_bfd): Call track_dependency_files.
	(ldfile_open_command_file_1): Likewise.
	* ldelf.c (ldelf_try_needed): Likewise.
	* pe-dll.c (pe_implied_import_dll): Likewise.
2020-06-23 12:01:24 -07:00
Alan Modra 9221725d1f PR26150, Assertion when asm() defines global symbols, -flto and --start-group
If an archive map contains symbols that aren't actually defined by the
indexed element for any reason, then loading that element will leave
the symbol undefined (or common).  This leads to the possibility of
the element being loaded again should the archive be searched again
due to the action of --start-group/--end-group.  The testcase
triggering this problem was an archive containing fat lto objects,
with the archive map incorrectly created by ar rather than gcc-ar.

	PR 26150
	* ldlang.c (ldlang_add_file): Assert that we aren't adding the
	current end of link.next list again too.
	* ldmain.c (add_archive_element): Don't load archive elements
	again that have already been loaded.
2020-06-24 00:50:48 +09:30
Alan Modra c7c970e4c6 Correct bfin XPASSes
bfin-elf and bfin-linux differ.  This patch fixes these:
bfin-linux-uclibc  -XPASS: PR ld/14170
bfin-linux-uclibc  -XPASS: pr17068 link --as-needed lib in group
bfin-linux-uclibc  -XPASS: -Bsymbolic-functions
bfin-linux-uclibc  -XPASS: pr22374 function pointer initialization

	* testsuite/ld-elf/shared.exp (pr14170): Clear xfail for
	bfin-*-linux*.
	(pr17068, symbolic-func.so, pr22374): Likewise.
2020-06-23 11:03:34 +09:30
Nelson Chu 39ff0b8123 RISC-V: Report warning when linking the objects with different priv specs.
We do know some conflicts among different privileged specs.  For linker,
the safest approach is that don't allow the object linked with others which
may cause conflicts.  But this may cause inconvenience since not all objects
with conflicting priv specs are linked will cause problems.  But it is hard
to know the detailed conflict cases for linker, so we probably need a option
to tell linker that we do know there are no conflicts, or we are willing to
take risks to link the objects with conflicted priv specs.  But the option
is still under discussion.

Therefore, we can report warnings rather than errors when linking the objects
with conflicted priv specs.  This not only makes the linker more flexible,
but also warns people that the conflicts may happen.  We also need to update
the output priv spec version once the input priv spec is newer.

	bfd/
	* elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from
	opcodes/riscv-opc.c to bfd/elfxx-riscv.c, since we need it in linker.
	(riscv_get_priv_spec_class): Likewise.
	(riscv_get_priv_spec_name): Likewise.
	(riscv_get_priv_spec_class_from_numbers): New function, convert
	the version numbers into string, then call riscv_get_priv_spec_class
	to get the priv spec class.
	* elfxx-riscv.h (riscv_get_priv_spec_class): Move forward declaration
	from include/opcode/riscv.h to bfd/elfxx-riscv.h.
	(riscv_get_priv_spec_name): Likewise.
	(riscv_get_priv_spec_class_from_numbers): New forward declaration.
	(opcode/riscv.h): Include it in the header rather than elfxx-riscv.c.
	* elfnn-riscv.c (riscv_merge_attributes):  Get the priv spec classes
	of input and output objects form their priv spec attributes by
	riscv_get_priv_spec_class_from_numbers.  Report warning rather than
	errors when linking objects with differnet priv spec versions.  We do
	know v1.9.1 may have conflicts to other versions, so report the
	warning, too.  After that, update the output priv spec version to the
	newest one so far.

	gas/
	* config/tc-riscv.c (buf_size, buf): Remove the unused variables.
	(riscv_set_default_priv_spec): Get the priv spec version from the
	priv spec attributes by riscv_get_priv_spec_class_from_numbers.

	include/
	* opcode/riscv.h (riscv_get_priv_spec_class): Move the function
	forward declarations to bfd/elfxx-riscv.h.
	(riscv_get_priv_spec_name): Likewise.

	opcodes/
	* riscv-opc.c: Move the structures and functions to bfd/elfxx-riscv.c.
	* riscv-dis.c: Include elfxx-riscv.h.

	ld/
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Updated.
2020-06-22 10:01:14 +08:00
Alan Modra 0381901e62 Do without ld ENABLE_PLUGINS
Instead, use BFD_SUPPORTS_PLUGINS.

	* ldfile.c: Replace uses of ENABLE_PLUGINS with BFD_SUPPORTS_PLUGINS.
	* ldlang.c: Likewise.
	* ldlang.h: Likewise.
	* ldlex.h: Likewise.
	* ldmain.c: Likewise.
	* lexsup.c: Likewise.
	* plugin.c: Wrap body of file in #if BFD_SUPPORTS_PLUGINS.
	* testplug.c: Likewise.
	* testplug2.c: Likewise.
	* testplug3.c: Likewise.
	* testplug4.c: Likewise.
	* configure.ac (ENABLE_PLUGINS): Don't define AM_CONTITIONAL.
	* Makefile.am: Remove ENABLE_PLUGINS conditionals.
	(PLUGIN_CFLAGS): Don't define.
	(PLUGIN_C, PLUGIN_H, PLUGIN_OBJECT): Likewise.  Substitute all
	uses with plugin file name.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
2020-06-21 22:16:10 +09:30
Alan Modra 348fe36b1d Remove perror from ld_assemble, ld_compile and ld_nm
ERROR should really be reserved for errors in the testsuite framework,
not just normal errors from the tools under test.  Removing use of
perror has been suggested before but without action, over concerns
that some test failures might be missed.  This patch removes uses of
perror in ld_assemble, ld_compile and ld_nm, and updates numerous
places that ignored the result of these functions by inappropriately
returning an "unresolved" test status.  Net result over my large set
of targets look good, in some cases improving the diagnostics, eg:

i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  +FAIL: script
i386-msdos  +FAIL: MRI script
i386-msdos  +FAIL: MEMORY
i386-msdos  +FAIL: MEMORY with symbols

	* testsuite/lib/ld-lib.exp (default_ld_compile): Don't perror on
	a compiler error.
	(default_ld_assemble): Similarly for an assembler error.
	(default_ld_nm): Similarly for an nm error.
	(run_ld_link_tests): Report ld_assemble errors as a fail.
	(check_as_cfi): Remove now unnecessary perror substitution.
	* testsuite/ld-elf/exclude.exp: Report ld_nm error return as test
	fails rather then unresolved.
	* testsuite/ld-gc/gc.exp: Likewise.
	* testsuite/ld-scripts/alignof.exp: Likewise.
	* testsuite/ld-scripts/defined.exp: Likewise.
	* testsuite/ld-scripts/script.exp: Likewise.
	* testsuite/ld-scripts/sizeof.exp: Likewise.
	* testsuite/ld-selective/selective.exp: Likewise.
	* testsuite/ld-scripts/extern.exp: Likewise.  Return on ld_link
	failure.
	* testsuite/ld-elfweak/elfweak.exp: Report compiler errors as
	test unresolved.
	* testsuite/ld-fastcall/fastcall.exp: Report assember errors as
	test fails.
	* testsuite/ld-i386/i386.exp (iamcu_tests): Likewise.
	* testsuite/ld-ia64/line.exp: Likewise.
	* testsuite/ld-mep/mep.exp: Likewise.
	* testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
	* testsuite/ld-nios2/nios2.exp: Likewise.
	* testsuite/ld-scripts/alignof.exp: Likewise.
	* testsuite/ld-x86-64/line.exp: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-scripts/log2.exp: Formatting.
	* testsuite/ld-tic6x/tic6x.exp: Report ld_link errors as a test fail.
2020-06-20 15:53:37 +09:30
Alan Modra b0ee49d21b ecoff testsuite fixes
The aim of this change is to remove a whole lot of "assembly failed"
errors for ecoff targets.

	* testsuite/ld-alpha/alpha.exp: Exclude *ecoff targets.
	* testsuite/ld-elf/binutils.exp: Likewise.
	* testsuite/ld-elf/tls.exp: Likewise.
	* testsuite/ld-elf/tls_common.exp: Likewise.
	* testsuite/ld-scripts/phdrs2.exp: Likewise.
2020-06-20 10:59:11 +09:30
Alan Modra e2201c2a57 SH gas configure and ld tests
All current SH gas targets use BFD.  sh-coff was incorrectly reported
as unsupported.

gas/
	* configure.tgt: Set bfd_gas for all SH targets.
ld/
	* testsuite/ld-sh/sh.exp: Don't run relax tests for non-ELF.
	Fail when ld_assemble fails.  Use elseif to reduce indentation.
2020-06-20 10:56:39 +09:30
Alan Modra e443398846 Re: ld testsuite fixes for alpha
I missed some.

	* testsuite/ld-plugin/pr22983.1.d: Accept st_other notations.
	* testsuite/ld-plugin/pr22983.2.d: Likewise.
	* testsuite/ld-plugin/pr22983.4.d: Likewise.
2020-06-19 12:59:30 +09:30
Alan Modra 2d0a923cc6 ld testsuite fixes for alpha
Some tests failed just due to st_other info, eg. [NOPV], being
emitted by readelf or objdump.  Fix that.  Also since alpha doesn't
support ifunc, don't run the ifunc tests for alpha.

	* testsuite/ld-elf/dynamic-1.rd: Accept st_other notations.
	* testsuite/ld-elf/rdynamic-1.rd: Likewise.
	* testsuite/ld-elf/pr9676.rd: Likewise.
	* testsuite/ld-elf/pr9679.rd: Likewise.
	* testsuite/ld-elfvers/vers30.dsym: Likewise.
	* testsuite/ld-elfvers/vers31.dsym: Likewise.
	* testsuite/ld-plugin/pr22983.3.d: Likewise.
	* testsuite/ld-ifunc/ifunc.exp: Exclude alpha.
2020-06-19 10:01:09 +09:30
Alan Modra 5fd104addf Emit a warning when -z relro is unsupported
ld silently accepts -z relro and -z norelro for targets that lack the
necessary GNU_RELRO support.  This patch makes those targets emit a
warning instead, and adds testsuite infrastructure to detect when
relro is unsupported.

binutils/
	* testsuite/config/default.exp (ld_elf_shared_opt): Don't set.
	* testsuite/lib/binutils-common.exp (check_relro_support): New proc.
	(run_dump_test): Use check_relro_support to decide whether to pass
	extra ld option "-z norelro".
ld/
	* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Omit
	-z relro and -z norelro when target support for GNU_RELRO is lacking.
	(gld${EMULATION_NAME}_before_parse): Ignore RELRO default too.
	* emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Ignore
	RELRO default when target support for GNU_RELRO is lacking.
	* emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise.
	* emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Likewise.
	* emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise.
	* testsuite/config/default.exp (ld_elf_shared_opt): Don't set.
	* testsuite/ld-elf/pr16322.d: xfail when no relro support.
	* testsuite/ld-elf/pr22393-1a.d: Likewise.
	* testsuite/ld-elf/pr22393-1b.d: Likewise.
	* testsuite/ld-elf/shared.exp (pr20995-2.so, pr20995-2): Likewise.
	* testsuite/lib/ld-lib.exp (run_ld_link_tests): Use check_relro_support
	to decide whether to pass extra ld option "-z norelro".
2020-06-19 09:50:20 +09:30
H.J. Lu 00401e65be ld: Suppress warning for unsupported attribute from older GCC
Suppress warning for unsupported attribute from older GCC:

.../ld/testsuite/ld-elf/pr25754-1a.c:9: warning: 'noclone' attribute directive ignored
.../ld/testsuite/ld-elf/pr25754-1a.c:9: warning: 'noclone' attribute directive ignored
ERROR: .../ld/testsuite/ld-elf/pr25754-1a.c: compilation failed
UNRESOLVED: Build pr25754-1a ( )

	* testsuite/ld-elf/linux-x86.exp (check_pr25749a): Append "-w"
	to cflags.
2020-06-17 07:53:19 -07:00
H.J. Lu 22aa1d5119 ld: Require GCC 5 for Build pr25749-1b (-pie -fPIE)
Before GCC 5, Build pr25749-1b (-pie -fPIE) won't trigger the expected
linker error.

	* testsuite/ld-elf/linux-x86.exp: Require GCC 5 for Build
	pr25749-1b (-pie -fPIE).
2020-06-17 07:39:28 -07:00
Alan Modra 5f89899448 Re: Use __asm__ rather than asm in ld testsuite
* testsuite/ld-elf/pr19553c.c: Replace asm with __asm__.
	* testsuite/ld-elfvers/vers27b.c: Likewise.
2020-06-16 22:44:13 +09:30
Alan Modra 07e7fdfd42 Use __asm__ rather than asm in ld testsuite
* testsuite/ld-elf/pr23428.c: Define _DEFAULT_SOURCE.
	* testsuite/ld-elf/indirect1b.c: Replace asm with __asm__.
	* testsuite/ld-elf/indirect2.c: Likewise.
	* testsuite/ld-elf/indirect3b.c: Likewise.
	* testsuite/ld-elf/indirect4b.c: Likewise.
	* testsuite/ld-elf/pr14323-2.c: Likewise.
	* testsuite/ld-elf/pr18720b.c: Likewise.
	* testsuite/ld-elf/pr23428.c: Likewise.
	* testsuite/ld-elfvsb/common.c: Likewise.
	* testsuite/ld-elfvsb/main.c: Likewise.
	* testsuite/ld-elfvsb/sh1.c: Likewise.
	* testsuite/ld-elfvsb/test.c: Likewise.
	* testsuite/ld-pe/aligncomm-1.c: Likewise.
	* testsuite/ld-pe/aligncomm-2.c: Likewise.
	* testsuite/ld-pe/aligncomm-3.c: Likewise.
	* testsuite/ld-pe/aligncomm-4.c: Likewise.
	* testsuite/ld-plugin/pr23958.c: Likewise.
	* testsuite/ld-size/size-1b.c: Likewise.
	* testsuite/ld-size/size-2b.c: Likewise.
	* testsuite/ld-size/size-3a.c: Likewise.
	* testsuite/ld-size/size-3b.c: Likewise.
	* testsuite/ld-size/size-3c.c: Likewise.
	* testsuite/ld-size/size-4b.c: Likewise.
	* testsuite/ld-size/size-5b.c: Likewise.
	* testsuite/ld-size/size-6a.c: Likewise.
	* testsuite/ld-size/size-7a.c: Likewise.
	* testsuite/ld-size/size-8a.c: Likewise.
	* testsuite/ld-size/size-9b.c: Likewise.
	* testsuite/ld-size/size-10b.c: Likewise.
2020-06-16 22:13:20 +09:30
Alan Modra a435742a7f Really remove tic30-aout support
bfd/
	* aout-tic30.c: Delete file.
	* Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
	(BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
	* config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
	(xc16x-*-elf): Sort properly.
	* configure.ac: Remove tic30_aout_vec.
	* targets.c: Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
gas/
	* config/tc-tic30.h: Remove OBJ_AOUT support.
	* configure.tgt: Delete tic30-*-*aout* entry.
ld/
	* emulparams/tic30aout.sh: Delete file.
	* scripttempl/tic30aout.sc: Delete file.
	* Makefile.am: Remove etic30aout.c from ALL_EMULATION_SOURCES and
	delete dependency.
	* configure.tgt: Delete tic30-*-*aout* entry.
	* testsuite/ld-scripts/sane1.d: Delete tic30-*-aout mention.
	* testsuite/ld-scripts/segment-start.d: Likewise.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2020-06-16 15:57:59 +09:30
Max Filippov 7a77f1ac2c xtensa: allow runtime ABI selection
2020-06-15  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
	(XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
	(elf32xtensa_abi): New global variable.
	(xtensa_abi_choice): New function.
	(elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
	XSHAL_ABI to select PLT code.

gas/
	* config/tc-xtensa.c (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New
	macros.
	(elf32xtensa_abi): New declaration.
	(option_abi_windowed, option_abi_call0): New enum constants.
	(md_longopts): Add entries for --abi-windowed and --abi-call0.
	(md_parse_option): Add handlers for --abi-windowed and
	--abi-call0.
	(xtensa_add_config_info): Use xtensa_abi_choice instead of
	XSHAL_ABI to format ABI tag.
	* doc/as.texi (Target Xtensa options): Add --abi-windowed and
	--abi-call0 to the list of options.
	* doc/c-xtensa.texi: Add description for options --abi-windowed
	and --abi-call0.
	* testsuite/gas/xtensa/abi-call0.d: New test definition.
	* testsuite/gas/xtensa/abi-windowed.d: New test definition.
	* testsuite/gas/xtensa/abi.s: New test source.

include/
	* elf/xtensa.h (xtensa_abi_choice): New declaration.

ld/
	* emultempl/xtensaelf.em (XSHAL_ABI): Remove macro definition.
	(XTHAL_ABI_UNDEFINED, XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New
	macros.
	(elf32xtensa_abi): New declaration.
	(xt_config_info_unpack_and_check): Set elf32xtensa_abi if it is
	undefined.  Use xtensa_abi_choice instead of XSHAL_ABI to test
	ABI tag consistency.
	(xtensa_add_config_info): Use xtensa_abi_choice instead of
	XSHAL_ABI to format ABI tag.
	(PARSE_AND_LIST_PROLOGUE): Define OPTION_ABI_WINDOWED,
	OPTION_ABI_CALL0 and declare elf32xtensa_abi.
	(PARSE_AND_LIST_LONGOPTS): Add entries for --abi-windowed and
	--abi-call0.
	(PARSE_AND_LIST_OPTIONS): Add help text for --abi-windowed and
	--abi-call0.
	(PARSE_AND_LIST_ARGS_CASES): Add handlers for --abi-windowed and
	--abi-call0.
	* ld.texi: Add description for options --abi-windowed and
	--abi-call0.
2020-06-15 13:01:30 -07:00
Roland McGrath cae64165f4 gold, ld: Implement -z start-stop-visibility=... option.
gold/
	Implement -z start-stop-visibility=... option.
	* options.h (class General_options): Handle -z start-stop-visibility=.
	(General_options::start_stop_visibility_enum): New public method.
	(General_options::set_start_stop_visibility_enum): New private method.
	(General_options::start_stop_visibility_enum_): New private member.
	* options.cc (General_options::General_options): Add initializer.
	(General_options::finalize): Set this->start_stop_visibility_enum_
	from string value.
	* layout.cc (Layout::define_section_symbols): Use option setting.

bfd/
	* elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
	field of bfd_link_info.

include/
	* bfdlink.h (struct bfd_link_info): New field start_stop_visibility.

ld/
	* NEWS: Mention -z start-stop-visibility=... option for ELF.
	* ld.texi (Options): Document -z start-stop-visibility=... option.
	* ldmain.c (main): Initialize link_info.start_stop_visibility.
	* emultempl/elf.em (gld${EMULATION_NAME}_handle_option):
	Parse -z start-stop-visibility=... option.
2020-06-15 11:45:02 -07:00
Alan Modra 1298463902 Unnecessary load_lib in ld testsuite
ld-lib.exp is loaded in config/defaults.exp

	* testsuite/ld-scripts/include.exp: Don't load ld-lib.exp.
	* testsuite/ld-scripts/phdrs3.exp: Likewise.
	* testsuite/ld-scripts/rgn-at.exp: Likewise.
	* testsuite/ld-scripts/rgn-over.exp: Likewise.
	* testsuite/ld-scripts/sort.exp: Likewise.
	* testsuite/ld-discard/discard.exp: Likewise.  Use is_elf_format.
2020-06-15 15:07:13 +09:30
Alan Modra ea4b3731ec PR26103 testcase
PR 26103
	* testsuite/ld-linkonce/ref1.s,
	* testsuite/ld-linkonce/ref2.s,
	* testsuite/ld-linkonce/sym1.s,
	* testsuite/ld-linkonce/sym2.s,
	* testsuite/ld-linkonce/sym3.s: New test files.
	* testsuite/ld-linkonce/linkonce.exp: Run tests for PE too.
	Add pr26103 test.  Remove unnecessary load_lib.
2020-06-15 12:11:27 +09:30
Alan Modra cda58d5f97 ld-linkonce test
* testsuite/ld-linkonce/zeroeh_x.s: Rename from x.s.
	* testsuite/ld-linkonce/zeroeh_y.s: Rename from y.s.
	* testsuite/ld-linkonce/zeroehl32.d: Adjust for renaming.  Support
	big-endian output.  Run for powerpc.
2020-06-15 12:08:33 +09:30
Alan Modra 382264181d Run certain ld-plugun lto tests only for ELF
lto-6.c refers to _etext, pr12760b.c has a .gnu.warning section,
the pr23818 test uses readelf, and pr23958.c has a .symver directive.

	* testsuite/ld-plugin/lto.exp (lto_link_tests): Move lto-6,
	pr12760, pr23818 and pr23958 tests to..
	(lto_link_elf_tests): ..here.
2020-06-11 18:22:42 +09:30
Nick Clifton 928055a369 Fix a compile time warning in the linker testsuite when compiling using clang.
* testsuite/ld-elf/pr26094-1b.c (main): Change return type to
	int.
2020-06-11 09:27:41 +01:00
Alan Modra 84df1f9dcb Fix x86 ld testsuite fails with glibc < 2.28
* testsuite/ld-elf/linux-x86.exp: Build tests when non-native.
	(check_pr25749b): Add optional args.  Set expected pass file
	from args.  Run -1b and -2a tests with passall.out.
	* testsuite/ld-elf/passall.out: New file.
	* testsuite/ld-elf/pr25749-1.c: Adjust to pass with older glibc.
	* testsuite/ld-elf/pr25749-2.c: Likewise.
	* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use
	regexp_diff to compare expected output from running binary.
2020-06-10 22:19:07 +09:30
H.J. Lu e1b5d517d1 ELF: Properly handle section symbols
When defining the section symbol, __start_FOO, for the section FOO:

1. Treat the common symbol, __start_FOO, in input object file as
definition.
2. Clear verinfo.verdef.

bfd/

	PR ld/26094
	* elflink.c (bfd_elf_define_start_stop): Handle common symbols.
	Clear verinfo.verdef.

ld/

	PR ld/26094
	* testsuite/ld-elf/pr26094-1.ver: New fike.
	* testsuite/ld-elf/pr26094-1a.c: Likewise.
	* testsuite/ld-elf/pr26094-1a.rd: Likewise.
	* testsuite/ld-elf/pr26094-1b.c: Likewise.
	* testsuite/ld-elf/pr26094-1b.rd: Likewise.
	* testsuite/ld-elf/pr26094-1c.c: Likewise.
	* testsuite/ld-elf/shared.exp: Run ld/26094 tests.
2020-06-10 05:31:31 -07:00
H.J. Lu cebd6b8ac1 IFUNC: Update IFUNC resolver check with DT_TEXTREL
Add ifunc_resolvers to elf_link_hash_table and use it for both x86 and
ppc64.  Before glibc commit b5c45e837, DT_TEXTREL is incompatible with
IFUNC resolvers.  Set ifunc_resolvers if there are IFUNC resolvers and
issue a warning for IFUNC resolvers with DT_TEXTREL.

bfd/

	PR ld/18801
	* elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
	(_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
	bfd_boolean * argument.  Set ifunc_resolvers if there are IFUNC
	resolvers.
	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
	Set ifunc_resolvers if there are FUNC resolvers.
	* elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
	(build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
	with elf.ifunc_resolvers.
	(write_plt_relocs_for_local_syms): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	(ppc64_elf_finish_dynamic_sections): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
	Updated.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
	(_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
	instead of readonly_dynrelocs_against_ifunc.
	* elfxx-x86.h (elf_x86_link_hash_table): Remove
	readonly_dynrelocs_against_ifunc.

ld/

	PR ld/18801
	* testsuite/ld-i386/i386.exp: Run ifunc-textrel-1a,
	ifunc-textrel-1b, ifunc-textrel-2a and ifunc-textrel-2b.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/ifunc-textrel-1a.d: Likewise.
	* testsuite/ld-i386/ifunc-textrel-1b.d: Likewise.
	* testsuite/ld-i386/ifunc-textrel-2a.d: Likewise.
	* testsuite/ld-i386/ifunc-textrel-2b.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-1.s: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-1a.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-1b.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-2.s: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-2a.d: Likewise.
	* testsuite/ld-x86-64/ifunc-textrel-2b.d: Likewise.
	* testsuite/ld-i386/pr18801a.d: Expect warning for IFUNC
	resolvers.
	* testsuite/ld-i386/pr18801b.d: Likewise.
	* estsuite/ld-x86-64/pr18801a.d: Likewise.
	* estsuite/ld-x86-64/pr18801b.d: Likewise.
2020-06-09 06:57:25 -07:00
Alan Modra a61e306070 PR26065, ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail
PR 26065
	* testsuite/ld-elf/shared.exp: Compile dl4main.c -fPIC.
	(dl4e, dl4f): Expect dl4a.out.
	* testsuite/ld-elf/dl4e.out: Delete.
2020-06-09 17:34:52 +09:30
H.J. Lu 597344c9a4 ld: Pass $LFLAGS to PR ld/21703 shared test
$LFLAGS is needed for -shared test.  This fixes

FAIL: PR ld/21703 shared

for tic6x-*-elf.

	* testsuite/ld-elf/shared.exp: Pass $LFLAGS to PR ld/21703
	shared test.
2020-06-07 14:50:01 -07:00
H.J. Lu 656e4a22f3 ld: Xfail pr20995 and pr20995-2 for tic6x-*-*
Xfail pr20995 and pr20995-2 for tic6x-*-* since GNU_RELRO is not
supported.

	* testsuite/ld-elf/shared.exp: Xfail pr20995/pr20995-2 for
	tic6x-*-*.
2020-06-07 11:52:18 -07:00
H.J. Lu 0fd91d25e2 pr11304.d: Skip tic6x-*-elf
Since address 0x800000 overlaps with .heap section on tic6x-*-elf, skip
pr11304.d on tic6x-*-elf.

	* testsuite/ld-elf/pr11304.d: Skip tic6x-*-elf.
2020-06-07 08:47:02 -07:00
Alan Modra 1fc47f8089 Re: PR13802, referred common symbol not UNDefined
It looks like this one was previously just swept under the rug.  Prior
to git commit c4b126b87a, the arm backend emitted an absolute
dynamic symbol "foo" with value zero for what was originally a common
symbol.  That was just wrong.

The patch also removes an xfail for bfin-linux-uclibc.

	PR 13802
	* testsuite/ld-elf/comm-data.exp: Don't xfail arm or bfin-linux.
2020-06-06 14:44:32 +09:30
Alan Modra 070558eb0d ld -plugin options when plugins are disabled
This patch makes ld accept and ignore -plugin options when configured
with --disable-plugins.  The idea is to allow using a linker built
without plugin support with a gcc built with plugin support.  Quite
obviously such a combination won't work if using LTO, but gcc has a
habit of passing a bunch of -plugin and -plugin-opt arguments to ld
even when not generating or linking LTO objects.

Why do I want to do this?  Well, it lets me and other binutils
developers answer the question as to whether plugin support breaks
binutils in some areas.  Which it does for some targets.

	* lexsup.c (ld_options): Accept -plugin and -plugin-opt when
	!ENABLE_PLUGINS.
	* testsuite/lib/ld-lib.exp (check_plugin_api_available): Adjust.
2020-06-06 11:28:08 +09:30
Nelson Chu 412857647f RISC-V: The object without priv spec attributes can be linked with any object.
bfd/
	* elfnn-riscv.c (riscv_merge_attributes): Add new boolean
	priv_may_conflict, in_priv_zero and out_priv_zero to decide whether
	the object can be linked according to it's priv attributes.  The object
	without any priv spec attributes can be linked with others.  If the first
	input object doesn't contain any priv attributes, then we need to copy
	the setting from the next input one.  Also report more detailed error
	messages to user.

	ld/
	* testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Rename to
	attr-merge-priv-spec-01.d.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s: Set priv spec
	to 1.11.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s: Empty priv spec
	setting.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d: New testcase.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2020-06-05 12:20:53 +08:00
Nelson Chu 3fc6c3dc2a RISC-V: Don't generate the ELF privilege attributes when no CSR are used.
gas/
	* config/tc-riscv.c (explicit_csr): New static boolean.
	Used to indicate CSR are explictly used.
	(riscv_ip): Set explicit_csr to TRUE if any CSR is used.
	(riscv_write_out_attrs): If we already have set elf priv
	attributes, then generate them.  Otherwise, don't generate
	them when no CSR are used.

	* testsuite/gas/riscv/attribute-01.d: Remove the priv attributes.
	* testsuite/gas/riscv/attribute-02.d: Likewise.
	* testsuite/gas/riscv/attribute-03.d: Likewise.
	* testsuite/gas/riscv/attribute-04.d: Likewise.
	* testsuite/gas/riscv/attribute-05.d: Likewise.
	* testsuite/gas/riscv/attribute-06.d: Likewise.
	* testsuite/gas/riscv/attribute-07.d: Likewise.
	* testsuite/gas/riscv/attribute-08.d: Likewise.
	* testsuite/gas/riscv/attribute-09.d: Likewise.
	* testsuite/gas/riscv/attribute-10.d: Likewise.
	* testsuite/gas/riscv/attribute-unknown.d: Likewise.
	* testsuite/gas/riscv/attribute-11.s: New testcase.
	* testsuite/gas/riscv/attribute-11.d: New testcase.  The CSR is
	used, so we should output the ELF priv attributes.
	* testsuite/gas/riscv/attribute-12.d: New testcase.  The CSR is
	used, so output the priv attributes according to the -mpriv-spec.
	* testsuite/gas/riscv/attribute-13.d: New testcase.  The CSR isn't
	used, so ignore the -mpriv-spec setting.

	ld/
	* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-stack-align.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-01.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-02.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-04.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-05.d: Likewise.
	* testsuite/ld-riscv-elf/call-relax.d: Add -mno-arch-attr.
2020-06-05 12:14:44 +08:00