From 7d4ef16efebe489b247b55740bc284b36d6879e2 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 13 Jan 2021 19:13:21 -0800 Subject: Makefile.inc: Avoid --emit-relocs on RISC-V There seems to be a bug[1] in the GNU linker for the RISC-V architecture triggered by symbols that are more than 2GB offset from the program counter. My next patch is introducing symbols like that and stuck on this problem. The code path that runs into the issue is only taken when passing the --emit-relocs flag, which is really only needed for building rmodules. Since RISC-V platforms don't use any rmodules at the moment, let's disable the flag on RISC-V until the issue can be fixed in the toolchain. [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=27180 Signed-off-by: Julius Werner Change-Id: I784a506034325c0ba937589416acaafbf80080e2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/49449 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- Makefile.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile.inc b/Makefile.inc index f0cbb34e380c..54adaa220bce 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -484,7 +484,13 @@ ADAFLAGS_common += -gnatwa.eeD.HHTU.U.W.Y # Disable style checks for now ADAFLAGS_common += -gnatyN -LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static --emit-relocs +LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static + +# Workaround for RISC-V linker bug, merge back into above line when fixed. +# https://sourceware.org/bugzilla/show_bug.cgi?id=27180 +ifneq ($(CONFIG_ARCH_RISCV),y) +LDFLAGS_common += --emit-relocs +endif ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y) CFLAGS_common += -Werror -- cgit v1.2.3