From b90aba43c1405d3d2cb7cba05e68906e979dcda3 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Wed, 21 Jul 2021 23:14:35 +0800 Subject: Makefile.inc: Replace linker flag -nostartfiles with --nmagic While the gcc(1) driver has the `-nostartfiles` option, ld(1), the program the coreboot toolchain uses to link the object files, doesn't have it. In binutils before 2.36, this option is interpreted as `-n -o startfiles`, in which the `-o` option is overridden by a later `-o` option, so only the `-n` option has effect, which is the `--nmagic` long option of ld(1). So the correct linker option in this place is `--nmagic`. It is tested that without `--nmagic`, ld can generate a much bigger x86_64 romstage, so this option is still needed. This error is found when trying to update binutils to 2.36 and later versions, where ld(1) is unable to disambiguate options and reports an error. Change-Id: I27dc2209abdc6fec866716a252736c5cf236a347 Signed-off-by: Iru Cai Reviewed-on: https://review.coreboot.org/c/coreboot/+/56490 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile.inc') diff --git a/Makefile.inc b/Makefile.inc index b1c706709a9a..95c551e9c4a4 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -479,7 +479,7 @@ ADAFLAGS_common += -gnatwa.eeD.HHTU.U.W.Y # Disable style checks for now ADAFLAGS_common += -gnatyN -LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static +LDFLAGS_common := --gc-sections -nostdlib --nmagic -static # Workaround for RISC-V linker bug, merge back into above line when fixed. # https://sourceware.org/bugzilla/show_bug.cgi?id=27180 -- cgit v1.2.3