Commit Graph

7372 Commits

Author SHA1 Message Date
Alan Modra
a2c7ca15a5 Use stdint types in coff internal_auxent
long is a poor choice of type to store 32-bit values read from
objects files by H_GET_32.  H_GET_32 doesn't sign extend so tests like
that in gdb/coffread.c for "negative" values won't work if long is
larger than 32 bits.  If long is 32-bit then code needs to be careful
to not accidentally index negative array elements.  (I'd rather see a
segfault on an unmapped 4G array index than silently reading bogus
data.)  long is also a poor choice for x_sect.s_scnlen, which might
have 64-bit values.  It's better to use unsigned exact width types to
avoid surprises.

I decided to change the field names too, which makes most of this
patch simply renaming.  Besides that there are a few places where
casts are no longer needed, and where printf format strings or tests
need adjusting.

include/
	* coff/internal.h (union internal_auxent): Use unsigned stdint
	types.  Rename l fields to u32 and u64 as appropriate.
bfd/
	* coff-bfd.c,
	* coff-rs6000.c,
	* coff64-rs6000.c,
	* coffcode.h,
	* coffgen.c,
	* cofflink.c,
	* coffswap.h,
	* peXXigen.c,
	* xcofflink.c: Adjust to suit internal_auxent changes.
binutils/
	* rdcoff.c: Adjust to suit internal_auxent changes.
gas/
	* config/obj-coff.h,
	* config/tc-ppc.c: Adjust to suit internal_auxent changes.
gdb/
	* coffread.c,
	* xcoffread.c: Adjust to suit internal_auxent changes.
ld/
	* pe-dll.c: Adjust to suit internal_auxent changes.
2023-03-27 21:58:46 +10:30
Szabolcs Nagy
5834f36d93 bfd: aarch64: Optimize BTI stubs PR30076
Don't insert a second stub if the target is already compatible with
an indirect branch.
2023-03-23 12:49:32 +00:00
Szabolcs Nagy
15b4f66b0a bfd: aarch64: Fix stubs that may break BTI PR30076
Insert two stubs in a BTI enabled binary when fixing long calls: The
first is near the call site and uses an indirect jump like before,
but it targets the second stub that is near the call target site and
uses a direct jump.

This is needed when a single stub breaks BTI compatibility.

The stub layout is kept fixed between sizing and building the stubs,
so the location of the second stub is known at build time, this may
introduce padding between stubs when those are relaxed.  Stub layout
with BTI disabled is unchanged.
2023-03-23 12:49:32 +00:00
Cupertino Miranda
5f784ec927 Changed ld and gas BPF tests
Recent BPF patch removed and renamed the list of relocations based on
the limitations of BPF instruction set.
This patch is a correction to the tests.
2023-03-20 15:35:21 +00:00
Alan Modra
2bdec58f59 Regen ld/po/BLD-POTFILES.in 2023-03-19 22:19:19 +10:30
Alan Modra
1d7e244fc5 Another source_sh
* scripttempl/z80.sc: Use source_sh to source elf.sc.
2023-03-17 21:10:05 +10:30
Christophe Lyon
b7571e1e6f Re: Add --enable-linker-version option
The recently-added ld-version*.d tests expect
.*GNU ld \(GNU Binutils\) 2.*
in the .comment section.

However, when buidling --with-pkgversion=XXX, we get
GNU ld (XXX) 2.[...]
instead, leading to a spurious FAIL.

This small patch replaces "GNU Binutils" with ".*" instead.

I inspected other testcases to see if we already had similar
occurrences but I couldn't see any, so I hope this fix is OK for the
purpose?

Thanks,

Christophe
2023-03-16 14:39:12 +00:00
Clément Chigot
f7a5019a91 ld/testsuite: disable ilp32 tests for aarch64-qnx
aarch64nto32 emulation isn't supported. The tests will then fall back
on aarch64elf32. It does work but some extra warnings are being
generated because the "-z relro" being added aarch64nto but ignored by
aarch64elf32 emulation.
Skip the tests to avoid any problems.

ld/ChangeLog:

        * testsuite/ld-aarch64/emit-relocs-112-overflow.d: Skip for
        aarch64nto.
        * testsuite/ld-aarch64/emit-relocs-112.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-113.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-114-overflow.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-114.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-115.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-116-overflow.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-116.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-117.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-118-overflow.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-118.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-119.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-22.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-23.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-28.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-86-overflow.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-86.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-87.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-88-overflow.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-88.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-89.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-90-overflow.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-90.d: Likewise.
        * testsuite/ld-aarch64/emit-relocs-92.d: Likewise.
        * testsuite/ld-aarch64/tls-desc-ie-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-all-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-gd-ie-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-ie-le-2-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-ie-le-3-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-ie-le-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-ld-le-small-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-relax-ld-le-tiny-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-tiny-desc-ie-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-tiny-desc-le-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-tiny-gd-ie-ilp32.d: Likewise.
        * testsuite/ld-aarch64/tls-tiny-gd-le-ilp32.d: Likewise.
2023-03-16 15:01:05 +01:00
Clément Chigot
7dedc6daab ld/testsuite: add aarch64nto to ld-aarch64
ld/ChangeLog:

        * testsuite/ld-aarch64/aarch64-elf.exp: Add support for
        aarch64nto.
2023-03-16 15:01:05 +01:00
Clément Chigot
b119512977 ld: add support of QNX stack arguments for aarch64nto
QNX is handling the stack argument using a .note section. Generate it
according to ELF argument -zexecstack, -zstack-size and a new NTO
argument --lazy-stack. Another NTO argument --stack mimicking
-zstack-size is added in order to ensure compatibility with previously
made NTO linkers.
This requires a new emultempl nto.em which is applied above the default
${ARCH}elf.em.

ld/ChangeLog:

	* emulparams/aarch64nto.sh: Move to nto.em.
	* emultempl/nto.em: New file.
	* testsuite/ld-aarch64/aarch64-nto.exp: New test.
	* testsuite/ld-aarch64/nto-stack-note-1.d: New test.
	* testsuite/ld-aarch64/nto-stack-note-2.d: New test.
	* testsuite/ld-aarch64/start.s: New test.
2023-03-16 15:01:05 +01:00
Clément Chigot
567e0dfb01 configure: add new target aarch64-*-nto*
This target has its own ld emulation based on aarch64elf.em.
2023-03-16 15:01:05 +01:00
Alan Modra
6752dd75f7 Re: Add --enable-linker-verssion
Output sections without any input sections to initialise their flags
have their flags initialised by data statements to LOAD, ALLOC,
HAS_CONTENTS by default.  This is wrong for .comment.  Fix that by
making the script initialise the section type to INFO, one of the
noalloc section types.  That also allows the address of .comment to be
set to zero, as is usual for non-alloc sections.

Also, use source_sh for all of the sourced scripts to set up make
dependencies.

	PR 30187
	* scripttempl/misc-sections.sc: Set .comment address to zero
	and type to INFO.
	* scripttempl/ft32.sc: Fix breakages from last edit.
	* scripttempl/arclinux.sc: Use source_sh to source DWARF.sc
	and misc-sections.sc.
	* scripttempl/avr.sc: Likewise.
	* scripttempl/dlx.sc: Likewise.
	* scripttempl/elf.sc: Likewise.
	* scripttempl/elf32cr16.sc: Likewise.
	* scripttempl/elf32crx.sc: Likewise.
	* scripttempl/elf32msp430.sc: Likewise.
	* scripttempl/elf64bpf.sc: Likewise.
	* scripttempl/elf64hppa.sc: Likewise.
	* scripttempl/elf_chaos.sc: Likewise.
	* scripttempl/elfarc.sc: Likewise.
	* scripttempl/elfarcv2.sc: Likewise.
	* scripttempl/elfd10v.sc: Likewise.
	* scripttempl/elfd30v.sc: Likewise.
	* scripttempl/elfm68hc11.sc: Likewise.
	* scripttempl/elfm68hc12.sc: Likewise.
	* scripttempl/elfm9s12z.sc: Likewise.
	* scripttempl/elfmicroblaze.sc: Likewise.
	* scripttempl/elfxgate.sc: Likewise.
	* scripttempl/elfxtensa.sc: Likewise.
	* scripttempl/epiphany_4x4.sc: Likewise.
	* scripttempl/i386beos.sc: Likewise.
	* scripttempl/i386go32.sc: Likewise.
	* scripttempl/ia64vms.sc: Likewise.
	* scripttempl/ip2k.sc: Likewise.
	* scripttempl/iq2000.sc: Likewise.
	* scripttempl/mep.sc: Likewise.
	* scripttempl/mmo.sc: Likewise.
	* scripttempl/nds32elf.sc: Likewise.
	* scripttempl/pru.sc: Likewise.
	* scripttempl/v850.sc: Likewise.
	* scripttempl/v850_rh850.sc: Likewise.
	* scripttempl/visium.sc: Likewise.
	* scripttempl/xstormy16.sc: Likewise.
	* scripttempl/z80.sc: Likewise.
	* testsuite/ld-scripts/ld-version-2.d: Don't skip ft32 or pru.
2023-03-16 17:30:28 +10:30
Nick Clifton
2d5783fad7 Add --enable-linker-version option to bfd linker to add an entry in the .comment section.
PR 30187
  * NEWS: Mention the new feature. * ld.texi: Document the new feature. * ldgram.y: Handle LINKER_VERSION token. * ldlang.c (lang_add_version): New function. (enable_linker_version): New global variable. * ldlang.h (land_add_version): Prototype. (enable_linker_version): Export. * ldlex.h (OPTION_ENABLE_LINKER_VERSION): Define. (OPTION_DISABLE_LINKER_VERSION): Define. * ldlex.l (LINKER_VERSION): Add token. * lexsup.c (ld_options): Add --enable-linker-version and --disable-linker-version. (parse_args): Handle the new options. * scripttempl/arclinux.sc: Remove stabs and comment sections and replace with inclusion of misc-sections.sc * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/ft32.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/script.exp: Run new tests. * scripttempl/misc-sections.sc: New file. * testsuite/ld-scripts/ld-version-2.d: New file. * testsuite/ld-scripts/ld-version.d: New file. * testsuite/ld-scripts/ld-version.t: New file.
2023-03-15 14:27:21 +00:00
Alan Modra
a4d5aec71e Revert ld ASCII support
Revert "Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant."
This reverts commit adbe951fc9.

Revert "ld test asciz and ascii fails"
This reverts the ascii.d part of commit 5f497256be.

Revert "Add support for the ASCII directive inside linker scripts."
This mostly reverts commit 9fe129a410
leaving the asciz.d and asciz.t changes in place.
2023-03-10 21:22:16 +10:30
Alan Modra
75bd292bea Revert ld DIGEST support
This is a hopefully temporary reversion of new ld features for
embedded processors by Ulf Samuelsson, plus some followup patches.

Squashed together from the following:

Revert "lddigest 32-bit support and gcc-4 compile errors"
This reverts commit d7ee19be87110a8f5342cec6e323d83d01c641d1.

Revert "ld: Use correct types for crc64 calculations"
This reverts commit 9a534b9f8e.

Revert "Re: DIGEST: testsuite"
This reverts commit c8e85484d8.

Revert "Regen potfiles"
This reverts commit 4d98c966f8.

Revert "DIGEST: Makefile.*"
This reverts commit 78ef6ab03f.

Revert "DIGEST: calculation"
This reverts commit 5243990191.

Revert "DIGEST: ldlang.*: add timestamp"
This reverts commit bd9466d4aa.

Revert "DIGEST: ldmain.c"
This reverts commit c8f8653fa7.

Revert "DIGEST: ldgram.y"
This reverts commit d73c01be26.

Revert "DIGEST: ldlex.l"
This reverts commit 48b5163a9d.

Revert "DIGEST: testsuite"
This reverts commit a4135d1a48.

Revert "DIGEST: Documentation"
This reverts commit 3ec28966c3.

Revert "DIGEST: NEWS"
This reverts commit 099bf2927d.

Revert "DIGEST: LICENSING"
This reverts commit 5c8a0c6654.
2023-03-10 21:22:16 +10:30
Alan Modra
bf0e353754 lddigest 32-bit support and gcc-4 compile errors
* ld.texi: Revert 2023-03-08 commit 9a534b9f8e.
	* testsuite/ld-scripts/crc64-poly.d: Likewise.
	* testsuite/ld-scripts/crc64-poly.t: Likewise.
	* lddigest.c: Formatting.
	(get_uint64_t): New function.
	(lang_add_digest): Take etree_type* args.  Replace "illegal" with
	"invalid" in error message.
	* lddigest.h (lang_add_digest): Update prototype.
	* lddigest_tab.c (algorithms): Work around gcc-4 errors.
	* ldgram.y (polynome): Adjust lang_add_digest call.
	* testsuite/ld-scripts/crc64-poly-size.d: Update expected error.
2023-03-09 16:02:57 +10:30
Nick Clifton
9a534b9f8e ld: Use correct types for crc64 calculations 2023-03-08 13:11:37 +00:00
Alan Modra
c8e85484d8 Re: DIGEST: testsuite
Correct test target/skip lines to fix fails on alpha-dec-vms,
alpha-linux-gnuecoff, i386-bsd, i386-msdos, ns32k-openbsd,
ns32k-pc532-mach, pdp11-dec-aout, rs6000-aix*, tic4x-coff, and
tic54x-coff.
2023-03-08 13:43:34 +10:30
Alan Modra
4d98c966f8 Regen potfiles 2023-03-08 11:25:31 +10:30
Ulf Samuelsson
3a80a48386 Build ldint
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
78ef6ab03f DIGEST: Makefile.*
The Makefile.in was generated using automake
after adding a few files.

When adding the ldreflect.* files, the autotools
versions were wrong.
After upgrading the host OS, autotools were upgraded to 2.71
reinstalling the desired 2.69 still generates a lot of changes.

Makefile.ini has therefore been manually edited.

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
5243990191 DIGEST: calculation
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
bd9466d4aa DIGEST: ldlang.*: add timestamp
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
c8f8653fa7 DIGEST: ldmain.c
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
d73c01be26 DIGEST: ldgram.y
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
48b5163a9d DIGEST: ldlex.l
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:11 +00:00
Ulf Samuelsson
a4135d1a48 DIGEST: testsuite
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:10 +00:00
Ulf Samuelsson
3ec28966c3 DIGEST: Documentation
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:10 +00:00
Ulf Samuelsson
099bf2927d DIGEST: NEWS
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:10 +00:00
Ulf Samuelsson
5c8a0c6654 DIGEST: LICENSING
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
2023-03-07 13:53:10 +00:00
Nick Clifton
adbe951fc9 Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant.
PR 30193 * ldgram.y (ASCII): Fail if the size is not a constant.
2023-03-03 13:56:36 +00:00
Nick Clifton
3ac23310f2 Fix typo with my email address 2023-03-01 14:38:16 +00:00
Mark Harmstone
38395c77d7 ld: Sort section contributions in PDB files
Microsoft's DIA library, and thus also MSVC and WinDbg, expects section
contributions to be ordered by section number and offset, otherwise it's
unable to resolve line numbers.
2023-02-28 00:28:26 +00:00
Clément Chigot
2b69325792 testsuite: prune DOS drive letter in test outputs
On DOS systems, absolute paths start with the drive letter. This can
trigger failures in the regexp from dump tests, especially for those
checking for warnings or errors. They are usually skipping everything
before the first ":" as it has to be the file path.
  | [^:]*: warning: ...

In order to avoid modifying many regexps to allow such drive letters,
prune them from all the outputs if they are found at the beginning of
a line.

binutils/ChangeLog:

	* testsuite/lib/binutils-common.exp (prune_dump_output): New
	(run_dump_test): Use it.

ld/ChangeLog:

	* testsuite/ld-elf/noinit-sections-2.l: Remove DOS drive letter
	handler.
2023-02-24 14:35:10 +01:00
Alan Modra
18e7a6587e PR30155, ld segfault in _bfd_nearby_section
The segfault was a symptom of messing with the absolute section next
field, confusing bfd_section_removed_from_list in linker.c:fix_syms.
That's not all that was going wrong.  The INSERT list of output
sections was being inserted into itself, ie. lost from the main
list of linker statements.

	PR 30155
	* ldlang.c (process_insert_statements): Handle pathological
	case of the insert script being inserted before the first
	output section statement in the default script.
	(output_prev_sec_find): Don't test section owner here.
	(insert_os_after): Change parameter to a list union pointer.
	(lang_insert_orphan): Test section owner here and adjust
	insert_os_after call.
2023-02-24 18:20:49 +10:30
Fangrui Song
50980ba351 RISC-V: Add --[no-]relax-gp to ld
--relax enables all relaxations.  --no-relax-gp disables GP relaxation to
allow measuring its effect.

The option can test effectiveness of GP relaxation and support some ABI
variants that use GP for other purposes.

Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/298

bfd/
    * elfnn-riscv.c (struct riscv_elf_link_hash_table): Add params.
    (riscv_elfNN_set_options): New.
    (riscv_info_to_howto_rela): Check relax_gp.
    (_bfd_riscv_relax_section): Likewise.
    * elfxx-riscv.h (struct riscv_elf_params): New.
    (riscv_elf32_set_options): New.
    (riscv_elf64_set_options): New.
ld/
    * emultempl/riscvelf.em: Add option parsing.
    * testsuite/ld-riscv-elf/code-model-relax-medlow-01-norelaxgp.d: New.
    * testsuite/ld-riscv-elf/pcgp-relax-01-norelaxgp.d: New.
    * testsuite/ld-riscv-elf/pcgp-relax-02.d: Test --relax --relax-gp can be
      used together.
2023-02-23 22:11:14 -08:00
Alexey Lapshin
d273049e14 bfd: xtensa: fix __stop_SECTION literal drop 2023-02-23 10:48:16 +00:00
Clément Chigot
fd7f7424f5 ld/testsuite: don't output to /dev/null
Mingw doesn't have /dev/null and thus "-o /dev/null" will fail.
Currently, all the options are checked using this "-o /dev/null",
resulting in them being disabled on mingw hosts.
Fix that by outputting to a real file for all targets.

ld/ChangeLog:

	* testsuite/config/default.exp: Replace "-o /dev/null" by a
	file.
2023-02-21 09:07:06 +01:00
Alan Modra
284e8cbae0 Both FAIL and PASS "check sections 2"?
* testsuite/ld-checks/checks.exp (check sections 2): Don't
	continue on with rest of test past first fail.
2023-02-21 16:21:42 +10:30
Alan Modra
4a5752f31d ld-libs test on alpha-vms
* testsuite/ld-libs/libs.exp: Don't run for alpha-vms.
2023-02-21 16:21:25 +10:30
Alan Modra
294540ac96 alpha-*-vms missing libraries
For this:
./ld-new: cannot find -limagelib: No such file or directory
./ld-new: cannot find -lstarlet: No such file or directory
./ld-new: cannot find -lsys$public_vectors: No such file or directory
the logs showed
creating dummy tmpdir/libimagelib:
creating dummy No
creating dummy such
etc.
So rubbish instead of tmpdir/libimagelib.a and the other required libs.

	* testsuite/config/default.exp: Correct regex detecting missing
	libraries automatically searched by alpha-dec-vms-ld.
2023-02-21 16:18:53 +10:30
Clément Chigot
a38cd00799 ld/testsuite: handle Windows drive letter in a noinit test
The regexp in "noinit sections (ld -r)" is skipping the file path before
the first ":". However, on Windows, a path can start with "C:". Adjust
the regexp to allow such cases.

ld/ChangeLog:

	* testsuite/ld-elf/noinit-sections-2.l: Allow Windows paths
	(starting with C:).
2023-02-20 15:24:00 +01:00
Clément Chigot
df937aa12a ld/testsuite: adjust to Windows path separator.
In some tests, the path reported on Windows will have a \ instead of a
/. This occurs when a file is concatened with the search path in
ldfile.c.:  "ld -Ltmpdir -ltext" will result into "tmpdir\libtext.a".

ld/ChangeLog:

	* testsuite/ld-elf/retain5.map: Allow \ path separator.
	* testsuite/ld-plugin/plugin-10.d: Likewise.
	* testsuite/ld-plugin/plugin-11.d: Likewise.
	* testsuite/ld-plugin/plugin-18.d: Likewise.
	* testsuite/ld-plugin/plugin-19.d: Likewise.
	* testsuite/ld-plugin/plugin-20.d: Likewise.
	* testsuite/ld-plugin/plugin-22.d: Likewise.
2023-02-20 15:23:56 +01:00
Nick Clifton
c9802aca6d So the linker from producing an export data table when run with --exclude-all-symbols.
PR 30004 * pe-dll.c (pe_dll_build_sections): Do not build an edata section if all symbols are being excluded.
2023-02-20 11:32:52 +00:00
Alan Modra
5f497256be ld test asciz and ascii fails
Fix these fails:
alpha-dec-vms  +FAIL: ld-scripts/asciz
alpha-dec-vms  +FAIL: ld-scripts/ascii
i386-go32  +FAIL: ld-scripts/asciz
sh-coff  +FAIL: ld-scripts/asciz

It's better to positively select targets for .section support than to
try to exclude all targets that don't.  Make a new is_coff_format so
we can easily select such.

binutils/
	* testsuite/lib/binutils-common.exp (is_coff_format): New.
ld/
	* testsuite/ld-scripts/ascii.d: Use is_elf_format and
	is_coff_format to select targets, exclude ti coff.
	* testsuite/ld-scripts/asciz.d: Likewise.  Accept trailing zeros.
2023-02-17 15:19:47 +10:30
Nick Clifton
9fe129a410 Add support for the ASCII directive inside linker scripts.
* ldlex.l: Add ASCII token.
 * ldgram.y: Add parsing of the ASCII command.
 * ldlang.c (lang_add_string): Add maximum size parameter.  Move escape character handling code into separate function.
 * ldlang.h (lang_add_string): Update prototype.
 * NEWS: Mention the new feature.
 * ld.texi (Output Section Data): Document the new directives.
 * testsuite/ld-scripts/asciz.t: Adjust to work on more architectures and to test more aspects of the ASCIZ directive.
 * testsuite/ld-scripts/asciz.d: Adjust to match the changes to the test linker script.
 * testsuite/ld-scripts/ascii.d: New test driver.
 * testsuite/ld-scripts/ascii.s: New test assembler source.
 * testsuite/ld-scripts/ascii.t: New test script.
 * testsuite/ld-scripts/script.exp: Run the new test.
2023-02-16 16:27:08 +00:00
Alan Modra
7ed4ad59e9 Delete PROGRESS macros
I don't see much point in cluttering the source with the PROGRESS
macros, which of course do nothing at all with the definitions in
progress.h.  progress.h is unchanged apart from the copyright comment
since commit d4d4c53c68 in 1994.

binutils/
	* ar.c: Don't include progress.h, or invoke PROGRESS macros.
	* nm.c: Likewise.
	* objcopy.c: Likewise.
	* objdump.c: Likewise.
gas/
	* as.h: Don't include progress.h.
	* as.c: Don't invoke PROGRESS macros.
	* write.c: Likewise.
include/
	* progress.h: Delete.
ld/
	* ldmain.c: Don't include progress.h, or invoke PROGRESS macros.
2023-02-16 21:00:50 +10:30
Nick Clifton
2b56cd9191 Fix the linker's merge4 test for the HPPA architecture.
PR 30078 * testsuite/ld-elf/merge4b.s: Use .asciz instead of .string in order to avoid the special behaviour of the .string directive on HPPA architectures.
2023-02-15 09:26:10 +00:00
Nick Clifton
9b38b85ec3 Mention that the -plugin command line option is used to load plugins. 2023-02-14 12:01:06 +00:00
Ulf Samuelsson
0d79a2a8e2 ASCIZ Command for output section
Adds a new directive to the linker script syntax: ASCIZ.
This inserts a zero-terminated string into the output at the place where it is used.
2023-02-14 10:13:28 +00:00