Commit Graph

7552 Commits

Author SHA1 Message Date
Nick Clifton
e922d1eaa3 Add ability to change linker warning messages into errors when reporting executable stacks and/or executable segments.
include
  * bfdlink.h (struct bfd_link_info): Update descriptions of the 'execstack', 'noexecstack' and 'warn_execstack' fields. Add 'error_exectack' and 'warn_is_error_for_rwx_segments' fields.

  bfd
  * elf.c (assign_file_positions_except_relocs): Turn warnings about executable segments into errors if so requested.
  * elflink.c (bfd_elf_size_dynamic_sections): Turn warnings about executable stacks into errors if so requested.

  ld
  * ldlex.h (enum option_values): Add OPTION_ERROR_EXECSTACK, OPTION_NO_ERROR_EXECSTACK, OPTION_WARN_EXECSTACK_OBJECTS, OPTION_ERROR_RWX_SEGMENTS and OPTION_NO_ERROR_RWX_SEGMENTS. (struct ld_option): Add new long options. (parse_args): Parse new long options. (elf_static_list_options): Display the new options.
  * ld.texi: Document the new command line options.
  * configure.ac (error-execstack): New configuration option. (error-rwx-segments): New configuration option.
  * emultempl/elf.em (_before_parse): Initialse the new linkinfo fields.
  * NEWS: Mention the new features.
  * config.in: Regenerate.
  * configure: Regenerate.
  * testsuite/ld-elf/commonpage2.d: Disable errors for RWX segments and/or executable stacks.
  * testsuite/ld-elf/elf.exp: Likewise.
  * testsuite/ld-elf/header.d: Likewise.
  * testsuite/ld-elf/loadaddr1.d: Likewise.
  * testsuite/ld-elf/loadaddr2.d: Likewise.
  * testsuite/ld-elf/maxpage4.d: Likewise.
  * testsuite/ld-elf/nobits-1.d: Likewise.
  * testsuite/ld-elf/note-1.d: Likewise.
  * testsuite/ld-elf/orphan-10.d: Likewise.
  * testsuite/ld-elf/orphan-11.d: Likewise.
  * testsuite/ld-elf/orphan-12.d: Likewise.
  * testsuite/ld-elf/orphan-5.d: Likewise.
  * testsuite/ld-elf/orphan-7.d: Likewise.
  * testsuite/ld-elf/orphan-8.d: Likewise.
  * testsuite/ld-elf/orphan-9.d: Likewise.
  * testsuite/ld-elf/orphan-region.d: Likewise.
  * testsuite/ld-elf/orphan.d: Likewise.
  * testsuite/ld-elf/pr19539.d: Likewise.
  * testsuite/ld-elf/pr26256-1a.d: Likewise.
  * testsuite/ld-elf/pr26907.d: Likewise.
  * testsuite/ld-elf/pr28597.d: Likewise.
  * testsuite/ld-elf/retain2.d: Likewise.
  * testsuite/ld-elf/shared.exp: Likewise.
  * testsuite/ld-elf/size-1.d: Likewise.
  * testsuite/ld-elf/textaddr7.d: Likewise.
  * testsuite/ld-elf/warn1.d: Likewise.
  * testsuite/ld-elf/warn2.d: Likewise.
  * testsuite/ld-i386/discarded1.d: Likewise.
  * testsuite/ld-i386/pr19175.d: Likewise.
  * testsuite/ld-i386/pr19539.d: Likewise.
  * testsuite/ld-i386/pr23189.d: Likewise.
  * testsuite/ld-plugin/lto-3r.d: Likewise.
  * testsuite/ld-plugin/lto-5r.d: Likewise.
  * testsuite/ld-plugin/lto.exp: Likewise.
  * testsuite/ld-powerpc/ppc476-shared.d: Likewise.
  * testsuite/ld-powerpc/ppc476-shared2.d: Likewise.
  * testsuite/ld-powerpc/pr28827-2.d: Likewise.
  * testsuite/ld-s390/s390.exp: Likewise.
  * testsuite/ld-scripts/align2a.d: Likewise.
  * testsuite/ld-scripts/align2b.d: Likewise.
  * testsuite/ld-scripts/align5.d: Likewise.
  * testsuite/ld-scripts/alignof.exp: Likewise.
  * testsuite/ld-scripts/crossref.exp: Likewise.
  * testsuite/ld-scripts/defined2.d: Likewise.
  * testsuite/ld-scripts/defined3.d: Likewise.
  * testsuite/ld-scripts/defined5.d: Likewise.
  * testsuite/ld-scripts/pr14962.d: Likewise.
  * testsuite/ld-scripts/pr18963.d: Likewise.
  * testsuite/ld-scripts/pr20302.d: Likewise.
  * testsuite/ld-scripts/print-memory-usage.exp: Likewise.
  * testsuite/ld-scripts/rgn-at1.d: Likewise.
  * testsuite/ld-scripts/rgn-at10.d: Likewise.
  * testsuite/ld-scripts/rgn-at4.d: Likewise.
  * testsuite/ld-scripts/rgn-at6.d: Likewise.
  * testsuite/ld-scripts/rgn-at8.d: Likewise.
  * testsuite/ld-scripts/rgn-at9.d: Likewise.
  * testsuite/ld-scripts/rgn-over1.d: Likewise.
  * testsuite/ld-scripts/rgn-over2.d: Likewise.
  * testsuite/ld-scripts/rgn-over4.d: Likewise.
  * testsuite/ld-scripts/rgn-over5.d: Likewise.
  * testsuite/ld-scripts/rgn-over6.d: Likewise.
  * testsuite/ld-scripts/script.exp: Likewise.
  * testsuite/ld-scripts/sizeof.exp: Likewise.
  * testsuite/ld-scripts/sort-file.d: Likewise.
  * testsuite/ld-x86-64/discarded1.d: Likewise.
  * testsuite/ld-x86-64/pr19175.d: Likewise.
  * testsuite/ld-x86-64/pr19539a.d: Likewise.
  * testsuite/ld-x86-64/pr19539b.d: Likewise.
  * testsuite/ld-x86-64/pr23189.d: Likewise.
2023-11-10 11:37:27 +00:00
Nick Clifton
a73c0d9b22 Move new features above the 'Changes in 2.41' comment 2023-11-10 10:21:34 +00:00
Szabolcs Nagy
7b0c124970 ld: aarch64: Use lp64 abi in recent BTI stub tests
The tests are not compatible with ilp32 abi: the GNU property
note is ABI dependent (size changes) and the disasm is ABI
dependent too.  Making the test portable between the ABIs is
not trivial.

For now force lp64 abi.
2023-11-09 14:52:17 +00:00
Szabolcs Nagy
b418c9d49e ld: aarch64: Add BTI stub insertion test PR30930
The test creates a large shared library and covers a number of
BTI stub insertion cases.
2023-11-09 14:44:38 +00:00
Clément Chigot
fb29080935 ld: print branch fixups into the map file for ppc elf targets
In a safety context, it could interesting to track the trampolines being
generated, ensuring there are expected or not.

bfd/ChangeLog:

	* elf32-ppc.c (ppc_elf_relax_section): Log branch fixups.

ld/ChangeLog:

	* ld.texi (--print-map): Add new item about fixups.
2023-11-08 09:07:02 +01:00
Jan Beulich
eab996435f ld/x86: reduce testsuite dependency on system object files
PR ld/30722
Tests looking for certain .note-section recorded properties may not
involve object files from the underlying platform (e.g. via using the C
compiler for linking): Such object files may themselves have similar
note sections, and hence they may influence the overall outcome.

For now convert just the tests known to be affected by crt*.o coming
with "ISA v3 needed" notes. Eventually other tests ought to be
converted, too.
2023-11-07 13:58:32 +01:00
Jan Beulich
50df0f438e Revert "ld x86_64 tests: Accept x86-64-v3 as a needed ISA"
This reverts commit bf77f42f67.
It wrongly altered testcase expectations; the issue will need
taking care of differently.
2023-11-07 13:54:57 +01:00
Nick Clifton
f1837d9c3f ld: =fillexp different behaviors for hexidecimal literal
PR 30865
  * ld.texi: Update description of the FILL command.
  * testsuite/ld-scripts/fill2.d: New test.
  * testsuite/ld-scripts/fill2.t: New test source.
  * testsuite/ld-scripts/data.exp: Run the new test.
2023-11-06 13:59:53 +00:00
Nick Clifton
bf77f42f67 ld x86_64 tests: Accept x86-64-v3 as a needed ISA
* testsuite/ld-x86-64/property-3.r: Update regexp to allow for targets which support x86-64-v3.
  * testsuite/ld-x86-64/property-4.r: Likewise.
  * testsuite/ld-x86-64/property-5.r: Likewise.
2023-11-02 09:57:39 +00:00
Nick Clifton
5fbee060e8 Fix typo in recent update to the ld/NEWS file 2023-11-01 15:51:44 +00:00
Nick Clifton
85921e9a25 ld: Support input section description keyword: REVERSE
PR 27565
  * ldlex.l: Add REVERSE.
  * ldgram.y: Allow REVERSE to be used wherever a sorting command can be used.
  * ld.h (struct wildcard_spec): Add 'reversed' field.
  * ldlang.h (lang_wild_statement_struct): Add 'filenames_reversed' field.
  * ldlang.c (compare_sections): Add reversed parameter. (wild_sort): Reverse the comparison if requested. (print_wild_statement): Handle the reversed field.
  * ld.texi: Document the new feature.
  * NEWS: Mention the new feature.
  * testsuite/ld-scripts/sort-file-reversed-1.d: New test driver.
  * testsuite/ld-scripts/sort-file-reversed-1.t: New test source.
  * testsuite/ld-scripts/sort-file-reversed-2.t: New test source.
  * testsuite/ld-scripts/sort-file-reversed-2.d: New test driver.
  * testsuite/ld-scripts/sort-sections-reversed-1.d: New test driver.
  * testsuite/ld-scripts/sort-sections-reversed-1.t: New test source.
  * testsuite/ld-scripts/sort-sections-reversed-2.t: New test source.
  * testsuite/ld-scripts/sort-sections-reversed-2.d: New test driver.
  * testsuite/ld-scripts/sort-sections-reversed-3.d: New test driver.
  * testsuite/ld-scripts/sort-sections-reversed-3.t: New test source.
2023-11-01 13:51:17 +00:00
Nick Clifton
69bded9260 New Georgian translation for the ld sub-directory 2023-10-30 15:18:15 +00:00
Alan Modra
1b1b9bc05f PR30984, assertion fail elf.c:8485
PR 30984
	* ldelf.c (ldelf_place_orphan): Don't allow bfd_abs_section as
	a potential output section.
2023-10-20 08:57:34 +10:30
Jose E. Marchesi
8fa1b632c1 ld: fix typo in ld.texi metdata->metadata 2023-10-19 21:53:57 +02:00
Nick Clifton
22bfda88f8 Update the documentation of the LINKER_VERSIOn script command to actually mention the name of the command. 2023-10-17 10:42:44 +01:00
Nick Clifton
a79e9a07a0 Fix: GNU-ld: ARM: Issues when trying to set target output architecture
PR 28910
  * lexsup.c (ld_options): Require that the --architecture option is given exactly two dashes, so that it does not become confused with the -a option.
2023-10-16 15:48:26 +01:00
Clément Chigot
b5248d602e ld: replace wrong bfd_malloc in nto.em
xmalloc should be called in ld instead of bfd_malloc.

ld/ChangeLog:

	* emultempl/nto.em (nto_lookup_QNX_note_section): Replace
	bfd_malloc by xmalloc.
2023-10-13 16:50:23 +02:00
Clément Chigot
4f6f3bea52 ld: warn when duplicated QNX stack note are detected
This warning is triggered only when a stack parameter is given to
the linker.

ld/ChangeLog:

        * emultempl/nto.em: Add warning when several QNX .note are
        detected.
2023-10-13 16:23:39 +02:00
Clément Chigot
1eba15a501 ld: correctly handle QNX --lazy-stack without -zstack-size
The warning was skipped if -zstack-size is not provided.

ld/ChangeLog:

        * emultempl/nto.em: Move --lazy-stack warning before missing
        -zstack-size skip.
2023-10-13 16:23:39 +02:00
Clément Chigot
318d83e658 ld: allow update of existing QNX stack note
Up to now, the linker would always create a QNX stack note from scratch.
However, object files could already have such note, ending up into
duplicates. QNX loader doesn't handle that.

Update the mechanism to first search through the input files for a .note
section holding a QNX stack note. If none are found, then a new section
is created into the stub file as before. This requires this search to be
done once the file have been opened, moving the whole logic a bit later
in the emulation process.

As part for this update, also allow to request an executable stack
without necessarily having to provide its size as well.  In this case, s
etup a default lazy stack of 0x1000.

ld/ChangeLog:

        * emultempl/nto.em (nto_create_QNX_note_section): New Function.
        (nto_lookup_QNX_note_section): New Function.
        (nto_add_note_section): Move the creation of the note section
        in the above new functions.
        (nto_create_output_section_statements): rename nto_after_open
        * testsuite/ld-aarch64/aarch64-nto.exp: add new test.
        * testsuite/ld-aarch64/nto-stack-note-3.d: New test.
        * testsuite/ld-aarch64/nto-stack-note.s: New test.
2023-10-13 16:23:39 +02:00
Nick Clifton
1b334e27f8 Fix: Null pointer dereference in ldlex.l
PR 30951
  * ldlex.l (yy_input): Check for YY_CURRENT_BUFFER being NULL.
2023-10-09 17:52:39 +01:00
Nick Clifton
ee1cb49e5a Fix: A potential null_pointer_deference bug
PR 30954
  * ldlang.c (map_input_to_output_sections): Check that os is non NULL before using it.
2023-10-09 17:13:25 +01:00
A. Wilcox
1499719e6d Fix: ld: Test case pr28158 fails on x86_64-linux-musl when index is > 19
PR 30905
  * testsuite/ld-elf/pr28158.rd: Adjust regexp to allow for section indicies larger than 9.
2023-10-05 15:05:15 +01:00
A. Wilcox
8838ac1c9e Fix: ld testsuite: glibc-specific DT_RELR tests should not be run on musl systems
PR 30917
  * testsuite/ld-elf/dt-relr.exp: Skip for MUSL targets.
2023-10-05 14:26:32 +01:00
A. Wilcox
99b06f8a80 Fix: ld testsuite: non-PIC shared tests fail on powerpc-linux-musl
PR 30918
  * testsuite/ld-shared/shared.exp: Add XFAILs for tests that fail with the MUSL library.
2023-10-05 13:52:56 +01:00
A. Wilcox
8023a05464 Fix: ld testsuite: Thumb PLT and GOT tests should be skipped on musl armhf targets
PR 30923
  * testsuite/ld-arm/thumb-plt-got.d: Skip test for configurations using the MUSL library.
  * testsuite/ld-arm/thumb-plt.d: Likewise.
2023-10-05 12:51:53 +01:00
A. Wilcox
693ac69b4d Fix: ld testsuite: pr22001-1 test segfaults on musl/x86
PR 30925
  PR 22001
  * testsuite/ld-i386/i386.exp: Skip the pr22001 test with TEXTREL relocations enabled on configurations using the MUSL library.
2023-10-05 12:38:40 +01:00
A. Wilcox
41ef7afa97 Fix: ld testsuite: 'Version' pattern grabs 'Version5 EABI', breaking test on arm-linux-musleabihf
PR 30924
  * testsuite/ld-elfvers/vers.exp (objdump_emptyverstuff): Handle EABI version information in objdump's output.
2023-10-05 12:13:08 +01:00
Neal Frager
2aafdd4de6 ld: microblaze: ignore rwx segments
The linker will generate warnings if it is creating an executable
stack or a segment with all three read, write and execute permissions.
These settings are not appropriate for all targets including
MicroBlaze.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-04 08:38:58 -07:00
Nick Clifton
6a6117ab0f Use bfd_get_current_time in places where it is suitable 2023-10-02 13:24:05 +01:00
H.J. Lu
832ca732b8 x86-64: Add -z mark-plt and -z nomark-plt
The PLT entry in executables and shared libraries contains an indirect
branch, like

 	jmp *foo@GOTPCREL(%rip)
	push $index_foo
	jmp .PLT0

or

	endbr64
 	jmp *foo@GOTPCREL(%rip)
 	NOP padding

which is used to branch to the function, foo, defined in another object.
Each R_X86_64_JUMP_SLOT relocation has a corresponding PLT entry.

The dynamic tags have been added to the x86-64 psABI to mark such PLT
entries:

6d824a52a4

Add an x86-64 linker option, -z mark-plt, to mark PLT entries with

 #define DT_X86_64_PLT     (DT_LOPROC + 0)
 #define DT_X86_64_PLTSZ   (DT_LOPROC + 1)
 #define DT_X86_64_PLTENT  (DT_LOPROC + 3)

1. DT_X86_64_PLT: The address of the procedure linkage table.
2. DT_X86_64_PLTSZ: The total size, in bytes, of the procedure linkage
table.
3. DT_X86_64_PLTENT: The size, in bytes, of a procedure linkage table
entry.

and set the r_addend field of the R_X86_64_JUMP_SLOT relocation to the
memory offset of the indirect branch instruction.  The dynamic linker
can use these tags to update the PLT section to direct branch.

bfd/

	* elf-linker-x86.h (elf_linker_x86_params): Add mark_plt.
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Set the
	r_addend of R_X86_64_JUMP_SLOT to the indirect branch offset
	in PLT entry for -z mark-plt.
	* elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Add
	DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT for
	-z mark-plt.
	(_bfd_x86_elf_finish_dynamic_sections): Set DT_X86_64_PLT,
	DT_X86_64_PLTSZ and DT_X86_64_PLTENT.
	(_bfd_x86_elf_get_synthetic_symtab): Ignore addend for
	JUMP_SLOT relocation.
	(_bfd_x86_elf_link_setup_gnu_properties): Set
	plt_indirect_branch_offset.
	* elfxx-x86.h (elf_x86_plt_layout): Add plt_indirect_branch_offset.

binutils/

	* readelf.c (get_x86_64_dynamic_type): New function.
	(get_dynamic_type): Call get_x86_64_dynamic_type.

include/

	* elf/x86-64.h (DT_X86_64_PLT): New.
	(DT_X86_64_PLTSZ): Likewise.
	(DT_X86_64_PLTENT): Likewise.

ld/

	* ld.texi: Document -z mark-plt and -z nomark-plt.
	* emulparams/elf32_x86_64.sh: Source x86-64-plt.sh.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/x86-64-plt.sh: New file.
	* testsuite/ld-x86-64/mark-plt-1.s: Likewise.
	* testsuite/ld-x86-64/mark-plt-1a-x32.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1a.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1b-x32.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1b.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1c-x32.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1c.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1d-x32.d: Likewise.
	* testsuite/ld-x86-64/mark-plt-1d.d: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run -z mark-plt tests.
2023-09-29 07:58:53 -07:00
Hsinyuan Xavier
193327db9f Fix: Output section type does not been applied to section forced output by . = . assignment
PR 30875
  * ldlang.c (get_os_init_flag): New function. (exp_init_os, map_input_to_output_sections): Use it.
2023-09-27 13:21:43 +01:00
Claudiu Zissulescu
ad6a51b91c Revert "arc: Add new LD tests for ARCv3."
This reverts commit 6e467e9a94.
2023-09-25 17:03:20 +03:00
Claudiu Zissulescu
7f2b40892a Revert "arc: Add new linker emulation and scripts for ARCv3 ISA."
This reverts commit 4deb1ee57f.
2023-09-25 17:02:55 +03:00
Claudiu Zissulescu
f14cd06ba4 Revert "arc: Update NEWS files"
This reverts commit a47d304b12.
2023-09-25 17:01:47 +03:00
Andreas Schwab
7345d05aaf RISC-V: Protect .got with relro
Move .got before .data so that it can be protected with -zrelro.  Also
separate .got.plt from .got if -znow is not in effect; the first two words
of .got.plt are placed within the relro region.

ld:
	PR ld/30877
	* emulparams/elf32lriscv-defs.sh (DATA_GOT, SEPARATE_GOTPLT):
	Define.
	* emulparams/elf64lriscv-defs.sh (SEPARATE_GOTPLT): Define.
	* testsuite/ld-elf/binutils.exp (binutils_test): Remove riscv*-*-*
	from relro_got expression.
2023-09-25 12:36:58 +02:00
Claudiu Zissulescu
a47d304b12 arc: Update NEWS files
Add ARCv3 support in NEWS files.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-09-25 11:33:12 +03:00
Claudiu Zissulescu
4deb1ee57f arc: Add new linker emulation and scripts for ARCv3 ISA.
Add ARCv3's linker bits. Remove obsolete tests.

ld/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* ld/Makefile.am: Add ARC64 targets.
	* ld/configure.tgt: Likewise.
	* ld/Makefile.in: Regenerate.
	* ld/emulparams/arc64elf32.sh: New file.
	* ld/emulparams/arc64elf64.sh: Likewise.
	* ld/emulparams/arc64linux32.sh: Likewise.
	* ld/emulparams/arc64linux64.sh: Likewise.
	* ld/scripttempl/elfarc.sc: Update stack and heap definitions.
	* ld/testsuite/ld-arc/got-weak.d: Deleted file.
	* ld/testsuite/ld-arc/got-weak.s: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-09-25 10:55:51 +03:00
Claudiu Zissulescu
6e467e9a94 arc: Add new LD tests for ARCv3.
Add new linker tests for ARCv3 ISA. All the new tests are added in a
distinct new folder named arc64.

ld/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* ld/testsuite/ld-arc64/arcv3_64-reloc-near-exe.dd: New file.
	* ld/testsuite/ld-arc64/arcv3_64-reloc-near-so.dd: Likewise.
	* ld/testsuite/ld-arc64/arcv3_64-reloc-near.s: Likewise.
	* ld/testsuite/ld-arc64/arcv3_64.exp: Likewise.
	* ld/testsuite/ld-arc64/bl34.dd: Likewise.
	* ld/testsuite/ld-arc64/bl34.s: Likewise.
	* ld/testsuite/ld-arc64/linkscript.ld: Likewise.
	* ld/testsuite/ld-arc64/plt34-got.dd: Likewise.
	* ld/testsuite/ld-arc64/plt34-got.s: Likewise.
	* ld/testsuite/ld-arc64/plt34-reloc.dd: Likewise.
	* ld/testsuite/ld-arc64/plt34-reloc.s: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-09-25 10:55:51 +03:00
Thomas Weißschuh
0ad14a8c34 ld: write resolved path to included file to dependency-file
In ldfile_open_command_file_1() name written to the dependency files is
the name as specified passed to the "INCLUDE" directive.
This is before include-path processing so the tracked dependency
location is most likely wrong.

Instead track the opened file at the point where the resolved path is
actually available, in try_open().

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-09-21 08:03:09 +02:00
Christophe Lyon
b3a1e48614 arm: Make 'conflicting CPU architectures' error message more user-friendly
Error messages such as "conflicting CPU architectures 10/16" are not
very to understand, so this patch replaces the numbers with the
description they actually mean:
"conflicting CPU architectures ARM v7E-M vs Pre v4"

2023-09-01  Christophe Lyon  <christophe.lyon@linaro.org>

	bfd/
	* elf32-arm.c (tag_cpu_arch_combine): Add name_table parameter and
	use it.
	(elf32_arm_merge_eabi_attributes): Update call to
	tag_cpu_arch_combine.

	ld/
	* testsuite/ld-arm/attr-merge-9.out: Update expected error
	message.
	* testsuite/ld-arm/attr-merge-arch-2.d: Likewise.
2023-09-04 12:34:30 +00:00
Jan Beulich
f438659a6f RISC-V: move various alias entries
For disassembly to only use spec-mandated aliases, respective non-alias
entries need to come ahead of their alias ones. Since identical
mnemonics need to stay together, whole groups are moved up where
necessary.

This partly reverts 839189bc93 ("RISC-V: re-arrange opcode table for
consistent alias handling"), but then also goes beyond a plain revert.

Reviewed-by: Tsukasa OI <research_trasio@irq.a4lg.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-09-01 12:26:46 +02:00
Jerry Zhang Jian
be3bed0696 Fix ld Makefile variable naming: ELF_CLFAGS -> ELF_CFLAGS
Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2023-09-01 17:59:49 +09:30
H.J. Lu
12123021f1 elf: Adjust PR ld/30791 tests
Adjust PR ld/30791 tests:

1. Generic linker targets don't comply with all orhpan section merging
rules.
2. z80 fails since a, b, c, d are registers for z80.
3. hppa fails since .text sections aren't merged for relocatable link.

	PR ld/30791
	* testsuite/ld-elf/pr30791a.d: Xfail for generic and z80
	targets.
	* testsuite/ld-elf/pr30791b.d: Xfail for hppa and z80 targets.
2023-08-31 16:21:17 -07:00
Claudiu Zissulescu
cd60a3956d arc: Update elfarcv2 script template
Update ARC's elfarcv2 script template with:

- The .ivt section (Interrupt Vector Table) is mapped at the begining
  of STARTUP_MEMORY when ivtbase_addr is not defined. Previously, it
  was pointing to 0x00.

- MEMORY_FILE is a new emulation paramter and sets the name for the
  linker script file which holds the MEMORY commands required by
  arcv2elfx emulation.

- Four new linker variables are introduced available when arcv2elf emulation is used:
  * __TEXT_REGION_ORIGIN__ Once defined it is setting the text region origin. By default it points to zero.
  * __TEXT_REGION_LENGTH__ Once defined it is setting the text region length. By default it is set to 2M.
  * __DATA_REGION_ORIGIN__ Once defined it is setting the data region origin. By default it is set to 0x80000000.
  * __DATA_REGION_LENGTH__ Once defined it is setting the data region length. By default it is set to 2M.

ld/ChangeLog:

	* scripttempl/elfarcv2.sc: Update script template.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-08-31 08:13:53 +03:00
H.J. Lu
68a2d9bf87 elf: Don't merge sections with different SHF_LINK_ORDER
For relocatable link, don't merge 2 SHF_LINK_ORDER sections if output
sections of their linked to sections are different.

	* ldelf.c (elf_orphan_compatible): Don't merge sections with
	different SHF_LINK_ORDER.
	* testsuite/ld-elf/pr30791a.d: New file.
	* testsuite/ld-elf/pr30791a.s: Likewise.
	* testsuite/ld-elf/pr30791b.d: Likewise.
	* testsuite/ld-elf/pr30791b.s: Likewise.
	* testsuite/ld-elf/pr30791c.s: Likewise.
	* testsuite/ld-elf/pr30791d.s: Likewise.
2023-08-30 17:17:31 -07:00
Maciej W. Rozycki
c1a5464809 Revert "MIPS: Use 64-bit a ABI by default for `mipsisa64*-*-linux*' targets"
This reverts commit 025e84f935.  It was
applied unapproved.
2023-08-30 18:45:14 +01:00
YunQiang Su
025e84f935 MIPS: Use 64-bit a ABI by default for `mipsisa64*-*-linux*' targets
Following the arrangement in GCC select a 64-bit ABI by default, either
n32 or n64, rather than o32 for `mipsisa64*-*-linux*' targets, just as
with the corresponding `mips64*-*-linux*' targets.
2023-08-27 23:43:30 -04:00
Alan Modra
9cadc5fa8d Re: ld STRINGIFY
Oops there was a reference to the old name.

	* emultempl/aix.em: Use stringify.sed.
2023-08-27 13:51:37 +09:30
Alan Modra
b8a0c93058 ld STRINGIFY
Delete support for old compilers that don't support string
concatentation.

	* Makefile.am (stringify.sed): Delete rule.
	(GEN_DEPENDS, DISTCLEANFILES): Adjust.
	* configure.ac (STRINGIFY): Delete.
	* emultempl/beos.em: Use stringify.sed from srcdir.
	* emultempl/elf.em: Likewise.
	* emultempl/generic.em: Likewise.
	* emultempl/msp430.em: Likewise.
	* emultempl/pdp11.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/stringify.sed: Renamed from..
	* emultempl/astring.sed: ..this.
	* emultempl/ostring.sed: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2023-08-26 10:57:00 +09:30