]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ld: Parse linker script only once
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Jan 2025 13:21:02 +0000 (21:21 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Jan 2025 21:50:37 +0000 (05:50 +0800)
commite76d66a53ee9ef0a70fdb44a3150518fcc8086ea
treef9880673ab9d9587a174b380453671e8a289afa7
parent9d375dfebba2c10fa074c5cf0ecd0bdaef7bba7a
ld: Parse linker script only once

Parsing linker script twice caused

FAIL: ld-plugin/lto-3r
FAIL: ld-plugin/lto-5r
FAIL: PR ld/19317 (2)

for x86_64-w64-mingw32 with the linker error:

./ld-new:built in linker script:27 assignment to location counter invalid outside of SECTIONS

ldscripts/i386pep.xr has

 24   .rdata  :
 25   {
 26     *(.rdata)
 27     . = ALIGN(4);
 28     /* .ctors & .dtors */
 29     /* .CRT */
 30     /* ___crt_xl_end__ is defined in the TLS Directory support code */
 31   }

Remove ld_parse_linker_script to parse linker script only once.

* ldlang.c (cmdline_emit_object_only_section): Don't call
ld_parse_linker_script.
* ldmain.c (main): Fold ld_parse_linker_script.
(ld_parse_linker_script): Removed.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
ld/ldlang.c
ld/ldmain.c
ld/ldmain.h