Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 33 insertions(+), 33 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/1
diff --git a/Makefile.inc b/Makefile.inc index e315732..ef95870 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -479,7 +479,7 @@ # Disable style checks for now ADAFLAGS_common += -gnatyN
-LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static --emit-relocs +LDFLAGS_common := -nostdlib -nostartfiles -static -Wl,--emit-relocs,--gc-sections
ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y) CFLAGS_common += -Werror diff --git a/src/arch/arm/Makefile.inc b/src/arch/arm/Makefile.inc index a8abfaf..f13bf1e 100644 --- a/src/arch/arm/Makefile.inc +++ b/src/arch/arm/Makefile.inc @@ -54,11 +54,11 @@
$(objcbfs)/bootblock.debug: $$(bootblock-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group + $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(bootblock-objs)) -Wl,--end-group
$(objcbfs)/decompressor.debug: $$(decompressor-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(call src-to-obj,decompressor,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(decompressor-objs)) --end-group + $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(call src-to-obj,decompressor,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(decompressor-objs)) -Wl,--end-group
endif # CONFIG_ARCH_BOOTBLOCK_ARM
@@ -70,7 +70,7 @@
$(objcbfs)/verstage.debug: $$(verstage-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) -T $(call src-to-obj,verstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(verstage-objs)) --end-group + $(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) -T $(call src-to-obj,verstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(verstage-objs)) -Wl,--end-group
verstage-y += boot.c verstage-y += div0.c @@ -103,7 +103,7 @@
$(objcbfs)/romstage.debug: $$(romstage-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group + $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(romstage-objs)) -Wl,--end-group
endif # CONFIG_ARCH_ROMSTAGE_ARM
@@ -132,6 +132,6 @@
$(objcbfs)/ramstage.debug: $$(ramstage-objs) @printf " CC $(subst $(obj)/,,$(@))\n" - $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group + $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(ramstage-objs)) -Wl,--end-group
endif # CONFIG_ARCH_RAMSTAGE_ARM diff --git a/src/arch/arm64/Makefile.inc b/src/arch/arm64/Makefile.inc index c3d1fe5..e9d6d05 100644 --- a/src/arch/arm64/Makefile.inc +++ b/src/arch/arm64/Makefile.inc @@ -50,11 +50,11 @@
$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(obj)/config.h @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) + $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(bootblock-objs)) -Wl,--end-group -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
$(objcbfs)/decompressor.debug: $$(decompressor-objs) $(obj)/config.h @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(decompressor-objs)) --end-group -T $(call src-to-obj,decompressor,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) + $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(decompressor-objs)) -Wl,--end-group -T $(call src-to-obj,decompressor,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
endif # CONFIG_ARCH_BOOTBLOCK_ARM64
@@ -66,7 +66,7 @@
$(objcbfs)/verstage.debug: $$(verstage-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(verstage-objs)) --end-group -T $(call src-to-obj,verstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) + $(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(verstage-objs)) -Wl,--end-group -T $(call src-to-obj,verstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
verstage-y += boot.c verstage-y += div0.c @@ -104,7 +104,7 @@
$(objcbfs)/romstage.debug: $$(romstage-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) + $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(romstage-objs)) -Wl,--end-group -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
endif # CONFIG_ARCH_ROMSTAGE_ARM64
@@ -139,7 +139,7 @@
$(objcbfs)/ramstage.debug: $$(ramstage-objs) @printf " CC $(subst $(obj)/,,$(@))\n" - $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) + $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(ramstage-objs)) -Wl,--end-group -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
# Build ARM Trusted Firmware (BL31)
diff --git a/src/arch/ppc64/Makefile.inc b/src/arch/ppc64/Makefile.inc index 1c35f6f..b8da940 100644 --- a/src/arch/ppc64/Makefile.inc +++ b/src/arch/ppc64/Makefile.inc @@ -29,8 +29,8 @@ $(objcbfs)/bootblock.debug: $$(bootblock-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \ - -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \ - $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock) + -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(bootblock-objs)) \ + $(LIBGCC_FILE_NAME_bootblock) -Wl,--end-group $(COMPILER_RT_bootblock)
endif
@@ -55,7 +55,7 @@
$(objcbfs)/romstage.debug: $$(romstage-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(COMPILER_RT_romstage) + $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(romstage-objs)) -Wl,--end-group $(COMPILER_RT_romstage)
romstage-c-ccopts += $(ppc64_flags) romstage-S-ccopts += $(ppc64_asm_flags) @@ -88,7 +88,7 @@
$(objcbfs)/ramstage.debug: $$(ramstage-objs) @printf " CC $(subst $(obj)/,,$(@))\n" - $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(COMPILER_RT_ramstage) + $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(ramstage-objs)) -Wl,--end-group $(COMPILER_RT_ramstage)
ramstage-c-ccopts += $(ppc64_flags) ramstage-S-ccopts += $(ppc64_asm_flags) diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc index 17f225a..fd18e55 100644 --- a/src/arch/riscv/Makefile.inc +++ b/src/arch/riscv/Makefile.inc @@ -69,14 +69,14 @@ $(objcbfs)/bootblock.debug: $$(bootblock-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \ - -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \ - $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock) + -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(bootblock-objs)) \ + $(LIBGCC_FILE_NAME_bootblock) -Wl,--end-group $(COMPILER_RT_bootblock)
bootblock-c-ccopts += $(riscv_flags) bootblock-S-ccopts += $(riscv_asm_flags)
ifeq ($(CONFIG_ARCH_RISCV_RV32),y) -LDFLAGS_bootblock += -m elf32lriscv +LDFLAGS_bootblock += -Wl,-m,elf32lriscv endif #CONFIG_ARCH_RISCV_RV32
endif #CONFIG_ARCH_BOOTBLOCK_RISCV @@ -104,13 +104,13 @@
$(objcbfs)/romstage.debug: $$(romstage-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(COMPILER_RT_romstage) + $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(romstage-objs)) -Wl,--end-group $(COMPILER_RT_romstage)
romstage-c-ccopts += $(riscv_flags) romstage-S-ccopts += $(riscv_asm_flags)
ifeq ($(CONFIG_ARCH_RISCV_RV32),y) -LDFLAGS_romstage += -m elf32lriscv +LDFLAGS_romstage += -Wl,-m,elf32lriscv endif #CONFIG_ARCH_RISCV_RV32
endif #CONFIG_ARCH_ROMSTAGE_RISCV @@ -153,13 +153,13 @@
$(objcbfs)/ramstage.debug: $$(ramstage-objs) @printf " CC $(subst $(obj)/,,$(@))\n" - $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(COMPILER_RT_ramstage) + $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(ramstage-objs)) -Wl,--end-group $(COMPILER_RT_ramstage)
ramstage-c-ccopts += $(riscv_flags) ramstage-S-ccopts += $(riscv_asm_flags)
ifeq ($(CONFIG_ARCH_RISCV_RV32),y) -LDFLAGS_ramstage += -m elf32lriscv +LDFLAGS_ramstage += -Wl,-m,elf32lriscv endif #CONFIG_ARCH_RISCV_RV32
endif #CONFIG_ARCH_RAMSTAGE_RISCV diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 2d00709..af52f70 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -77,7 +77,7 @@
$$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs) @printf " LINK $$(subst $$(obj)/,,$$(@))\n" - $$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) --whole-archive --start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) --no-whole-archive $$(COMPILER_RT_$(1)) --end-group -T $(call src-to-obj,$(1),$(dir)/memlayout.ld) --oformat $(2) + $$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) -Wl,--whole-archive,--start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) -Wl,--no-whole-archive $$(COMPILER_RT_$(1)) -Wl,--end-group -T $(call src-to-obj,$(1),$(dir)/memlayout.ld) -Wl,--oformat=$(2) -LANG=C LC_ALL= $$(OBJCOPY_$(1)) --only-section .illegal_globals $$(@) $$(objcbfs)/$(1)_null.offenders >/dev/null 2>&1 if [ -z "$$$$($$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders 2>&1 | grep 'no symbols')" ];then \ echo "Forbidden global variables in $(1):"; \ @@ -209,11 +209,11 @@ postcar-y += postcar.c postcar-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
-LDFLAGS_postcar += -Map $(objcbfs)/postcar.map +LDFLAGS_postcar += -Wl,-Map,$(objcbfs)/postcar.map
$(objcbfs)/postcar.debug: $$(postcar-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" - $(LD_postcar) $(LDFLAGS_postcar) -o $@ -L$(obj) $(COMPILER_RT_FLAGS_postcar) --whole-archive --start-group $(filter-out %.ld,$^) --no-whole-archive $(COMPILER_RT_postcar) --end-group -T $(call src-to-obj,postcar,src/arch/x86/memlayout.ld) + $(LD_postcar) $(LDFLAGS_postcar) -o $@ -L$(obj) $(COMPILER_RT_FLAGS_postcar) -Wl,--whole-archive,--start-group $(filter-out %.ld,$^) -Wl,--no-whole-archive $(COMPILER_RT_postcar) -Wl,--end-group -T $(call src-to-obj,postcar,src/arch/x86/memlayout.ld)
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod cp $< $@ @@ -314,9 +314,9 @@ $(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs) @printf " CC $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) - $(LD_ramstage) -m elf_i386 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group + $(LD_ramstage) -Wl,-m,elf_i386 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) -Wl,--no-whole-archive $(COMPILER_RT_ramstage) -Wl,--end-group else - $(LD_ramstage) -m elf_x86_64 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group + $(LD_ramstage) -Wl,-m,elf_x86_64 -r -o $@ $(COMPILER_RT_FLAGS_ramstage) -Wl,--whole-archive,--start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) -Wl,--no-whole-archive $(COMPILER_RT_ramstage) -Wl,--end-group endif
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64 diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc index 11a4e67..2e63fb3 100644 --- a/src/cpu/x86/smm/Makefile.inc +++ b/src/cpu/x86/smm/Makefile.inc @@ -26,7 +26,7 @@ smm-c-deps:=$$(OPTION_TABLE_H)
$(obj)/smm/smm.o: $$(smm-objs) $(COMPILER_RT_smm) - $(LD_smm) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smm) --whole-archive --start-group $(smm-objs) --no-whole-archive $(COMPILER_RT_smm) --end-group + $(LD_smm) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smm) -Wl,--whole-archive,--start-group $(smm-objs) -Wl,--no-whole-archive $(COMPILER_RT_smm) -Wl,--end-group
# change to the target path because objcopy will use the path name in its # ELF symbol names. @@ -53,7 +53,7 @@ # SMM Stub Module. The stub is used as a trampoline for relocation and normal # SMM handling. $(obj)/smmstub/smmstub.o: $$(smmstub-objs) $(COMPILER_RT_smmstub) - $(LD_smmstub) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smmstub) --whole-archive --start-group $(smmstub-objs) --no-whole-archive $(COMPILER_RT_smmstub) --end-group + $(LD_smmstub) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smmstub) -Wl,--whole-archive,--start-group $(smmstub-objs) -Wl,--no-whole-archive $(COMPILER_RT_smmstub) -Wl,--end-group
# Link the SMM stub module with a 0-byte heap. ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 085f6b2..adcd16a 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -290,7 +290,7 @@ # rmdoule is named $(1).rmod define rmodule_link $(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL) - $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group + $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--whole-archive,--start-group $(filter-out %.ld,$(2)) -Wl,--end-group $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map endef
diff --git a/toolchain.inc b/toolchain.inc index 865227b..f52a518 100644 --- a/toolchain.inc +++ b/toolchain.inc @@ -117,7 +117,7 @@ $(error Check your .config file for CONFIG_ARCH_$(1)_* settings)) CC_$(1) := $(CC_$(2)) GCC_$(1) := $(GCC_CC_$(2)) -LD_$(1) := $(LD_$(2)) +LD_$(1) := $(CC_$(2)) NM_$(1) := $(NM_$(2)) AR_$(1) := $(AR_$(2)) GNATBIND_$(1) := $(GNATBIND_$(2)) @@ -130,7 +130,7 @@ CPPFLAGS_$(1) = $$(CPPFLAGS_common) $$(CPPFLAGS_$(2)) -D__ARCH_$(2)__ COMPILER_RT_$(1) := $$(COMPILER_RT_$(2)) COMPILER_RT_FLAGS_$(1) := $$(COMPILER_RT_FLAGS_$(2)) -LDFLAGS_$(1) = $$(LDFLAGS_common) $$(LDFLAGS_$(2)) +LDFLAGS_$(1) = $$(CFLAGS_$(1)) $$(LDFLAGS_common) $$(LDFLAGS_$(2)) endef
# define_class: Allows defining any program as dynamic class and compiler tool diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 18e08a0..5e32120 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -363,7 +363,7 @@ TCLIST="i386 x86_64" TWIDTH="32" TABI="elf" - CC_RT_EXTRA_GCC="--wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3" + CC_RT_EXTRA_GCC="-Wl,--wrap=__divdi3,--wrap=__udivdi3,--wrap=__moddi3,--wrap=__umoddi3" }
arch_config_ppc64() {
Hello build bot (Jenkins), Philipp Hug, Patrick Georgi, Martin Roth, Julius Werner, ron minnich,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/40811
to look at the new patch set (#2).
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 33 insertions(+), 33 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 2: Code-Review+1
Hello build bot (Jenkins), Philipp Hug, Patrick Georgi, Martin Roth, Paul Menzel, Julius Werner, ron minnich,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/40811
to look at the new patch set (#4).
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 34 insertions(+), 34 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/4
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 5: Code-Review+1
tested successfully for system76/lemp9. builds fine, boots fine
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/40811/6/toolchain.inc File toolchain.inc:
https://review.coreboot.org/c/coreboot/+/40811/6/toolchain.inc@107 PS6, Line 107: LD_$(1) := $(CC_$(2)) It might be cleaner to use CC_.. at the target sites.
Attention is currently required from: Jacob Garber. Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 6:
(1 comment)
File Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/367d131b_f310c4e3 PS6, Line 488: --emit-relocs, This was split out in I784a506034325c0ba937589416acaafbf80080e2.
Attention is currently required from: Jacob Garber. Hello build bot (Jenkins), Philipp Hug, Patrick Georgi, Martin Roth, Paul Menzel, Julius Werner, Michael Niewöhner, Ron Minnich,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/40811
to look at the new patch set (#7).
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 36 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/7
Attention is currently required from: Stefan Reinauer, Paul Menzel. Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 7:
(2 comments)
File Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/d3eb6a3f_efe7abbe PS6, Line 488: --emit-relocs,
This was split out in I784a506034325c0ba937589416acaafbf80080e2.
Ack
File toolchain.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/cf7f007d_6be191bd PS6, Line 107: LD_$(1) := $(CC_$(2))
It might be cleaner to use CC_.. at the target sites.
Done
Attention is currently required from: Stefan Reinauer, Jacob Garber. Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS7: One failure message:
``` CC cbfs/fallback/ramstage.debug i386-elf-ld.bfd: unrecognised emulation mode: no-mmx Supported emulations: elf_i386 elf_iamcu make[1]: *** [src/arch/x86/Makefile.inc:283: /cb-build/coreboot-gerrit.0/chromeos/GOOGLE_ALEENA/cbfs/fallback/ramstage.debug] Error 1 ```
Attention is currently required from: Stefan Reinauer, Jacob Garber. Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS7:
One failure message: […]
`no-mmx` is used only once:
$ git grep no-mmx Makefile:CFLAGS_x86_32 += -mno-mmx
Attention is currently required from: Stefan Reinauer, Jacob Garber. Keith Hui has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS7: I have to manually edit this patch on my computer to get it in. Then I got a compile error:
i386-elf-gcc: error: unrecognized command-line option '--gc-sections'; did you mean '--data-sections'? i386-elf-gcc: error: unrecognized command-line option '--nmagic' make: *** [src/arch/x86/Makefile.inc:99: build/cbfs/fallback/bootblock.debug] Error 1
Commit b90aba43 replaced -nostartfiles linker flag with --nmagic which is not recognized by gcc.
I have to revert it for LTO to work, like so:
-LDFLAGS_common := --gc-sections -nostdlib --nmagic -static +LDFLAGS_common := -Wl,--gc-sections -nostdlib -nostartfiles -static
Also works is this change (output binary is identical):
LDFLAGS_common := -Wl,--gc-sections,--nmagic -nostdlib -nostartfiles -static
So far I only build tested for asus/p2b. Please help test more widely.
Attention is currently required from: Stefan Reinauer, Jacob Garber, Iru Cai. Hello build bot (Jenkins), Philipp Hug, Martin Roth - Personal, Paul Menzel, Julius Werner, Michael Niewöhner, Iru Cai, Ron Minnich,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/40811
to look at the new patch set (#8).
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 36 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/8
Attention is currently required from: Stefan Reinauer, Iru Cai. Hello build bot (Jenkins), Philipp Hug, Martin Roth - Personal, Paul Menzel, Julius Werner, Michael Niewöhner, Iru Cai, Ron Minnich,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/40811
to look at the new patch set (#9).
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 36 insertions(+), 36 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/9
Attention is currently required from: Stefan Reinauer, Jacob Garber, Iru Cai. Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(2 comments)
Patchset:
PS9: There was a no-mmx failure
File src/arch/arm/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/ef32c7ef_cea41762 PS9, Line 48: LDFLAGS_bootblock Instead of having to modify all the `LDFLAGS_` assignments, would using `$(addprefix, -Wl, $(LDFLAGS_bootblock))` work? This way we prevent people from sneaking CFLAGS into the LDFLAGS variable?
Attention is currently required from: Stefan Reinauer, Jacob Garber, Iru Cai.
Elyes Haouas has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9: still active ?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(2 comments)
Patchset:
PS9:
still active ?
Yes, it’s still active, and just needs to be rebased.
File src/arch/arm/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/8bac2b05_f8c5bba8 PS9, Line 48: LDFLAGS_bootblock
Instead of having to modify all the `LDFLAGS_` assignments, would using `$(addprefix, -Wl, $(LDFLAGS […]
Do you have an example, how to do that?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9: After rebasing I get with Debian’s toolchain (gcc (Debian 12.2.0-11) 12.2.0):
``` x86_64-linux-gnu-gcc -nostdlib -r -o build/smm/smm.o -Wl,--wrap=__divdi3,--wrap=__udivdi3,--wrap=__moddi3,--wrap=__umoddi3 -Wl,--whole-archive,--start-group build/smm/mainboard/google/rambi/static.o build/smm/acpi/acpi_pm.o build/smm/arch/x86/memcpy.o build/smm/arch/x86/memmove_32.o build/smm/arch/x86/memset.o build/smm/arch/x86/mmap_boot.o build/smm/commonlib/bsd/cbfs_mcache.o build/smm/commonlib/bsd/cbfs_private.o build/smm/commonlib/bsd/elog.o build/smm/commonlib/iobuf.o build/smm/commonlib/mem_pool.o build/smm/commonlib/region.o build/smm/console/die.o build/smm/console/post.o build/smm/cpu/x86/pae/pgtbl.o build/smm/cpu/x86/smi_trigger.o build/smm/cpu/x86/smm/save_state.o build/smm/cpu/x86/smm/smm_module_handler.o build/smm/cpu/x86/tsc/delay_tsc.o build/smm/device/device_const.o build/smm/device/pci_ops.o build/smm/drivers/pc80/pc/i8254.o build/smm/drivers/pc80/rtc/mc146818rtc.o build/smm/ec/google/chromeec/crosec_proto.o build/smm/ec/google/chromeec/ec.o build/smm/ec/google/chromeec/ec_lpc.o build/smm/ec/google/chromeec/smihandler.o build/smm/ec/google/chromeec/vstore.o build/smm/lib/boot_device.o build/smm/lib/cbfs.o build/smm/lib/crc_byte.o build/smm/lib/delay.o build/smm/lib/fmap.o build/smm/lib/gcc.o build/smm/lib/halt.o build/smm/lib/hexdump.o build/smm/lib/memcmp.o build/smm/lib/reset.o build/smm/lib/string.o build/smm/lib/version.o build/smm/mainboard/google/rambi/smihandler.o build/smm/soc/intel/baytrail/iosf.o build/smm/soc/intel/baytrail/pmutil.o build/smm/soc/intel/baytrail/smihandler.o build/smm/soc/intel/baytrail/tsc_freq.o -Wl,--no-whole-archive /usr/lib/gcc/x86_64-linux-gnu/12/32/libgcc.a -Wl,--end-group /usr/bin/ld: relocatable linking with relocations from format elf32-i386 (build/smm/mainboard/google/rambi/static.o) to format elf64-x86-64 (build/smm/smm.o) is not supported ```
Adding `-m32 -Wl,-b,elf32-i386` fixes the issue. Where can I add that?
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Jacob Garber, Iru Cai, Elyes Haouas.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9:
After rebasing I get with Debian’s toolchain (gcc (Debian 12.2.0-11) 12.2.0): […]
This suggests that CC_smmstub is an x86_64 compiler for some reason, when it should be i386 (same as CC_ramstage). You'll need to figure out why that is and fix it.
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Jacob Garber, Iru Cai.
Elyes Haouas has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9:
Yes, it’s still active, and just needs to be rebased.
would you push the rebase ?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(2 comments)
Patchset:
PS9:
After rebasing I get with Debian’s toolchain (gcc (Debian 12.2.0-11) 12.2.0): […]
``` $ grep m32 build/xcompile CLANG_CFLAGS_arm+=-Qunused-arguments -m32 GCC_CFLAGS_x86_32:= -Wno-address-of-packed-member --param=min-pagesize=1024 -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -m32 -fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none GCC_ADAFLAGS_x86_32:=-m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -m32 -fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none CLANG_CFLAGS_x86_32:=-target i386-elf -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 CLANG_CFLAGS_x86_32+=-Qunused-arguments -m32 ```
File src/arch/x86/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/8855f3bc_f2ba5d9c PS9, Line 292: $(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) Does this also need to be updated?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS9: Jacob, is it fine, if you push my non-working state?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has uploaded a new patch set (#10) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 52 insertions(+), 47 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/10
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 10:
(1 comment)
File src/arch/arm/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/a8fe9b74_185c0f34 PS9, Line 48: LDFLAGS_bootblock
Do you have an example, how to do that?
The spaces also need to be replaced by a comma:
-LDFLAGS_common := --gc-sections -nostdlib --nmagic -static +LDFLAGS_common := -Wl,--gc-sections,--nmagic -nostdlib -static
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 10:
(1 comment)
Patchset:
PS10: From the build bot (Jenkins):
qemu-q35 only fails with clang, that means built with gcc:
``` CC smm/southbridge/intel/i82801ix/smihandler.o /usr/bin/ld: relocatable linking with relocations from format elf32-i386 (/cb-build/coreboot-gerrit.0/clang/EMULATION_QEMU_X86_Q35/smm/mainboard/emulation/qemu-q35/static.o) to format elf64-x86-64 (/cb-build/coreboot-gerrit.0/clang/EMULATION_QEMU_X86_Q35/smm/smm.o) is not supported clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
With gcc boards failed with:
CC ramstage/mainboard/kontron/ktqm77/acpi_tables.o make[2]: *** No rule to make target '/cb-build/coreboot-gerrit.0/gcc/KONTRON_KTQM77/libgnat-x86_32/libgnat.a', needed by '/cb-build/coreboot-gerrit.0/gcc/KONTRON_KTQM77/ramstage/mainboard/kontron/ktqm77/gma-mainboard.o'. Stop.
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Elyes Haouas has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 10:
(1 comment)
Patchset:
PS10:
From the build bot (Jenkins): […]
maybe replace "--nmagic" with "-nostartfiles" as you want use GCC linker ?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 10:
(1 comment)
Patchset:
PS10:
maybe replace "--nmagic" with "-nostartfiles" as you want use GCC linker ?
As you replied to my comment, is your suggestion to fix the build bot problems, or just in general?
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Elyes Haouas has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 10:
(1 comment)
Patchset:
PS10:
As you replied to my comment, is your suggestion to fix the build bot problems, or just in general?
it would fix the build
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has uploaded a new patch set (#11) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
arch,toolchain,xcompile: Use GCC as linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so they will be passed to the linker.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 52 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/11
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 10:
(1 comment)
File src/lib/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/81b8e7fb_f81ea551 PS10, Line 1: # SPDX-License-Identifier: GPL-2.0-only : : subdirs-y += gnat : : ifeq ($(CONFIG_UBSAN),y) : ramstage-y += ubsan.c : CFLAGS_ramstage += -fsanitize=undefined : endif : : # Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used. No idea, how this happened. Maybe explains the gnat error. Reverted.
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 11:
(2 comments)
Commit Message:
https://review.coreboot.org/c/coreboot/+/40811/comment/0dd73d95_27bd3a1f PS11, Line 7: arch,toolchain,xcompile: Use GCC as linker : : Code generation when using LTO is not done until after linking, so the : compiler must be invoked at all linking stages instead of the linker. : Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so : they will be passed to the linker. GCC is not the only compiler supported by now.
Patchset:
PS11: It looks like clang tries to use /usb/bin/ld by default. It should use something like -fuse-ld=$(LD_common).
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Arthur Heymans, Jacob Garber, Iru Cai.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 11:
(1 comment)
Commit Message:
https://review.coreboot.org/c/coreboot/+/40811/comment/27eb64a6_73fa73f0 PS11, Line 7: arch,toolchain,xcompile: Use GCC as linker : : Code generation when using LTO is not done until after linking, so the : compiler must be invoked at all linking stages instead of the linker. : Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so : they will be passed to the linker.
GCC is not the only compiler supported by now.
Would “Use compiler (GCC, clang) as linker“ work?
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai.
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 11:
(1 comment)
Commit Message:
https://review.coreboot.org/c/coreboot/+/40811/comment/4e6464a3_7a5196d1 PS11, Line 7: arch,toolchain,xcompile: Use GCC as linker : : Code generation when using LTO is not done until after linking, so the : compiler must be invoked at all linking stages instead of the linker. : Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so : they will be passed to the linker.
Would “Use compiler (GCC, clang) as linker“ work?
"Use the compiler fronted as a linker". and then state that both clang and gcc support this in the message to not clutter the title?
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use GCC as linker ......................................................................
Patch Set 11:
(2 comments)
Patchset:
PS10:
it would fix the build
Patch set 11 (reverting removed hunk, and replacing spaces by comma) fixed the GCC build issues. (clang build issue still remains.)
Patchset:
PS11: Using clang it fails with:
/usr/bin/ld: relocatable linking with relocations from format elf32-i386 (/cb-build/coreboot-gerrit.0/clang/AMD_GARDENIA/smm/mainboard/amd/gardenia/static.o) to format elf64-x86-64 (/cb-build/coreboot-gerrit.0/clang/AMD_GARDENIA/smm/smm.o) is not supported clang-15: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [src/cpu/x86/smm/Makefile.inc:18: /cb-build/coreboot-gerrit.0/clang/AMD_GARDENIA/smm/smm.o] Error 1
Arthur suggested to add something like `-march=i386` to the cflags.
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has uploaded a new patch set (#12) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler fronted as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler fronted as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Test: Pass -m32 to compiler frontend
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 55 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/12
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has uploaded a new patch set (#13) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 55 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/13
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has uploaded a new patch set (#14) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 55 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/14
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has uploaded a new patch set (#15) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed, results in
clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
Pass CFLAGS_smm and CFLAGS_smmstub.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 59 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/15
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 15:
(1 comment)
Commit Message:
Robot Comment from checkpatch (run ID jenkins-coreboot-checkpatch-168078): https://review.coreboot.org/c/coreboot/+/40811/comment/e73290f8_aa11ed4f PS15, Line 16: clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument] Possible unwrapped commit description (prefer a maximum 72 chars per line)
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 15:
(1 comment)
Patchset:
PS11:
Using clang it fails with: […]
`make V=1` shows the command and adding `-v` results in:
``` $ clang -v -nostdlib -r -o build/smm/smm.o -Wl,--whole-archive,--start-group build/smm/mainboard/emulation/qemu-q35/static.o build/smm/acpi/acpi_pm.o build/smm/arch/x86/memcpy.o build/smm/arch/x86/memmove_32.o build/smm/arch/x86/memset.o build/smm/arch/x86/mmap_boot.o build/smm/commonlib/bsd/cbfs_mcache.o build/smm/commonlib/bsd/cbfs_private.o build/smm/commonlib/bsd/elog.o build/smm/commonlib/iobuf.o build/smm/commonlib/mem_pool.o build/smm/commonlib/region.o build/smm/console/die.o build/smm/console/post.o build/smm/cpu/x86/pae/pgtbl.o build/smm/cpu/x86/smi_trigger.o build/smm/cpu/x86/smm/save_state.o build/smm/cpu/x86/smm/smm_module_handler.o build/smm/cpu/x86/tsc/delay_tsc.o build/smm/device/device_const.o build/smm/device/pci_ops.o build/smm/drivers/pc80/pc/i8254.o build/smm/drivers/pc80/rtc/mc146818rtc.o build/smm/lib/boot_device.o build/smm/lib/cbfs.o build/smm/lib/crc_byte.o build/smm/lib/delay.o build/smm/lib/fmap.o build/smm/lib/halt.o build/smm/lib/hexdump.o build/smm/lib/memcmp.o build/smm/lib/reset.o build/smm/lib/string.o build/smm/lib/version.o build/smm/mainboard/emulation/qemu-q35/memmap.o build/smm/mainboard/emulation/qemu-q35/smi.o build/smm/southbridge/intel/common/gpio.o build/smm/southbridge/intel/common/pmbase.o build/smm/southbridge/intel/common/pmutil.o build/smm/southbridge/intel/common/smihandler.o build/smm/southbridge/intel/i82801ix/smihandler.o -Wl,--no-whole-archive /usr/lib/gcc/x86_64-linux-gnu/12/32/libgcc.a -Wl,--end-group Debian clang version 14.0.6 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o build/smm/smm.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib -r --whole-archive --start-group build/smm/mainboard/emulation/qemu-q35/static.o build/smm/acpi/acpi_pm.o build/smm/arch/x86/memcpy.o build/smm/arch/x86/memmove_32.o build/smm/arch/x86/memset.o build/smm/arch/x86/mmap_boot.o build/smm/commonlib/bsd/cbfs_mcache.o build/smm/commonlib/bsd/cbfs_private.o build/smm/commonlib/bsd/elog.o build/smm/commonlib/iobuf.o build/smm/commonlib/mem_pool.o build/smm/commonlib/region.o build/smm/console/die.o build/smm/console/post.o build/smm/cpu/x86/pae/pgtbl.o build/smm/cpu/x86/smi_trigger.o build/smm/cpu/x86/smm/save_state.o build/smm/cpu/x86/smm/smm_module_handler.o build/smm/cpu/x86/tsc/delay_tsc.o build/smm/device/device_const.o build/smm/device/pci_ops.o build/smm/drivers/pc80/pc/i8254.o build/smm/drivers/pc80/rtc/mc146818rtc.o build/smm/lib/boot_device.o build/smm/lib/cbfs.o build/smm/lib/crc_byte.o build/smm/lib/delay.o build/smm/lib/fmap.o build/smm/lib/halt.o build/smm/lib/hexdump.o build/smm/lib/memcmp.o build/smm/lib/reset.o build/smm/lib/string.o build/smm/lib/version.o build/smm/mainboard/emulation/qemu-q35/memmap.o build/smm/mainboard/emulation/qemu-q35/smi.o build/smm/southbridge/intel/common/gpio.o build/smm/southbridge/intel/common/pmbase.o build/smm/southbridge/intel/common/pmutil.o build/smm/southbridge/intel/common/smihandler.o build/smm/southbridge/intel/i82801ix/smihandler.o --no-whole-archive /usr/lib/gcc/x86_64-linux-gnu/12/32/libgcc.a --end-group /usr/bin/ld: relocatable linking with relocations from format elf32-i386 (build/smm/mainboard/emulation/qemu-q35/static.o) to format elf64-x86-64 (build/smm/smm.o) is not supported clang: error: linker command failed with exit code 1 (use -v to see invocation) ```
Replacing `-m elf_x86_64` by `-m elf_i386` helps:
``` $ "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_i386 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o build/smm/smm.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib -r --whole-archive --start-group build/smm/mainboard/emulation/qemu-q35/static.o build/smm/acpi/acpi_pm.o build/smm/arch/x86/memcpy.o build/smm/arch/x86/memmove_32.o build/smm/arch/x86/memset.o build/smm/arch/x86/mmap_boot.o build/smm/commonlib/bsd/cbfs_mcache.o build/smm/commonlib/bsd/cbfs_private.o build/smm/commonlib/bsd/elog.o build/smm/commonlib/iobuf.o build/smm/commonlib/mem_pool.o build/smm/commonlib/region.o build/smm/console/die.o build/smm/console/post.o build/smm/cpu/x86/pae/pgtbl.o build/smm/cpu/x86/smi_trigger.o build/smm/cpu/x86/smm/save_state.o build/smm/cpu/x86/smm/smm_module_handler.o build/smm/cpu/x86/tsc/delay_tsc.o build/smm/device/device_const.o build/smm/device/pci_ops.o build/smm/drivers/pc80/pc/i8254.o build/smm/drivers/pc80/rtc/mc146818rtc.o build/smm/lib/boot_device.o build/smm/lib/cbfs.o build/smm/lib/crc_byte.o build/smm/lib/delay.o build/smm/lib/fmap.o build/smm/lib/halt.o build/smm/lib/hexdump.o build/smm/lib/memcmp.o build/smm/lib/reset.o build/smm/lib/string.o build/smm/lib/version.o build/smm/mainboard/emulation/qemu-q35/memmap.o build/smm/mainboard/emulation/qemu-q35/smi.o build/smm/southbridge/intel/common/gpio.o build/smm/southbridge/intel/common/pmbase.o build/smm/southbridge/intel/common/pmutil.o build/smm/southbridge/intel/common/smihandler.o build/smm/southbridge/intel/i82801ix/smihandler.o --no-whole-archive /usr/lib/gcc/x86_64-linux-gnu/12/32/libgcc.a --end-group $ ```
Passing `-m32` to the compiler frontend helps:
``` $ clang -v -m32 -nostdlib -r -o build/smm/smm.o -Wl,--whole-archive,--start-group build/smm/mainboard/emulation/qemu-q35/static.o build/smm/acpi/acpi_pm.o build/smm/arch/x86/memcpy.o build/smm/arch/x86/memmove_32.o build/smm/arch/x86/memset.o build/smm/arch/x86/mmap_boot.o build/smm/commonlib/bsd/cbfs_mcache.o build/smm/commonlib/bsd/cbfs_private.o build/smm/commonlib/bsd/elog.o build/smm/commonlib/iobuf.o build/smm/commonlib/mem_pool.o build/smm/commonlib/region.o build/smm/console/die.o build/smm/console/post.o build/smm/cpu/x86/pae/pgtbl.o build/smm/cpu/x86/smi_trigger.o build/smm/cpu/x86/smm/save_state.o build/smm/cpu/x86/smm/smm_module_handler.o build/smm/cpu/x86/tsc/delay_tsc.o build/smm/device/device_const.o build/smm/device/pci_ops.o build/smm/drivers/pc80/pc/i8254.o build/smm/drivers/pc80/rtc/mc146818rtc.o build/smm/lib/boot_device.o build/smm/lib/cbfs.o build/smm/lib/crc_byte.o build/smm/lib/delay.o build/smm/lib/fmap.o build/smm/lib/halt.o build/smm/lib/hexdump.o build/smm/lib/memcmp.o build/smm/lib/reset.o build/smm/lib/string.o build/smm/lib/version.o build/smm/mainboard/emulation/qemu-q35/memmap.o build/smm/mainboard/emulation/qemu-q35/smi.o build/smm/southbridge/intel/common/gpio.o build/smm/southbridge/intel/common/pmbase.o build/smm/southbridge/intel/common/pmutil.o build/smm/southbridge/intel/common/smihandler.o build/smm/southbridge/intel/i82801ix/smihandler.o -Wl,--no-whole-archive /usr/lib/gcc/x86_64-linux-gnu/12/32/libgcc.a -Wl,--end-group Debian clang version 14.0.6 Target: i386-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: 32;@m32 "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o build/smm/smm.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/32 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib32 -L/lib/../lib32 -L/usr/lib/../lib32 -L/lib -L/usr/lib -r --whole-archive --start-group build/smm/mainboard/emulation/qemu-q35/static.o build/smm/acpi/acpi_pm.o build/smm/arch/x86/memcpy.o build/smm/arch/x86/memmove_32.o build/smm/arch/x86/memset.o build/smm/arch/x86/mmap_boot.o build/smm/commonlib/bsd/cbfs_mcache.o build/smm/commonlib/bsd/cbfs_private.o build/smm/commonlib/bsd/elog.o build/smm/commonlib/iobuf.o build/smm/commonlib/mem_pool.o build/smm/commonlib/region.o build/smm/console/die.o build/smm/console/post.o build/smm/cpu/x86/pae/pgtbl.o build/smm/cpu/x86/smi_trigger.o build/smm/cpu/x86/smm/save_state.o build/smm/cpu/x86/smm/smm_module_handler.o build/smm/cpu/x86/tsc/delay_tsc.o build/smm/device/device_const.o build/smm/device/pci_ops.o build/smm/drivers/pc80/pc/i8254.o build/smm/drivers/pc80/rtc/mc146818rtc.o build/smm/lib/boot_device.o build/smm/lib/cbfs.o build/smm/lib/crc_byte.o build/smm/lib/delay.o build/smm/lib/fmap.o build/smm/lib/halt.o build/smm/lib/hexdump.o build/smm/lib/memcmp.o build/smm/lib/reset.o build/smm/lib/string.o build/smm/lib/version.o build/smm/mainboard/emulation/qemu-q35/memmap.o build/smm/mainboard/emulation/qemu-q35/smi.o build/smm/southbridge/intel/common/gpio.o build/smm/southbridge/intel/common/pmbase.o build/smm/southbridge/intel/common/pmutil.o build/smm/southbridge/intel/common/smihandler.o build/smm/southbridge/intel/i82801ix/smihandler.o --no-whole-archive /usr/lib/gcc/x86_64-linux-gnu/12/32/libgcc.a --end-group $ ```
Also passing `$(CFLAGS_common)` to the SMM targets results in:
clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
and it does not contain `-m32`.
So linking works with the coreboot toolchain, when passing `$(CFLAGS_smm)` and `$(CFLAGS_smmstub)`. Some boards fail to build with clang, as the LLVM linker LLD is not found:
LINK cbfs/fallback/verstage.debug clang-15: error: unable to execute command: Executable "ld.lld" doesn't exist! clang-15: error: ld.lld command failed with exit code 1 (use -v to see invocation) make[2]: *** [src/arch/arm/Makefile.inc:64: /cb-build/coreboot-gerrit.0/clang/GOOGLE_BERKNIP/cbfs/fallback/verstage.debug] Error 1
With the Debian toolchain it links with GCC, but it fails later:
``` $ make V=1 […] clang -pipe -g -nostdinc -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough -Wshadow -Wdate-time -Wtype-limits -Wvla -Wold-style-definition -Wdangling-else -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -fno-pie -Werror -Os -target i386-elf -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -Qunused-arguments -m32 -Wno-unused-variable -Wno-unused-function -Wno-tautological-compare -Wno-shift-overflow -Wno-address-of-packed-member -Wno-initializer-overrides -fbracket-depth=2048 -march=i686 -mno-mmx -Wl,--gc-sections,--nmagic,-nostdlib,-static -Wl,--emit-relocs -z defs -Bsymbolic -T build/rmodules_x86_32/lib/rmodule.ld -Wl,--defsym=__heap_size=0 -o build/smm/smm.elf -Wl,--whole-archive,--start-group build/smm/smm.o -Wl,--end-group /usr/bin/ld: build/smm/smm.o: warning: relocation in read-only section `.rodata.southbridge_smi' /usr/bin/ld: warning: build/smm/smm.elf has a LOAD segment with RWX permissions /usr/bin/ld: warning: creating DT_TEXTREL in a PIE /usr/bin/ld: warning: .note.gnu.build-id section discarded, --build-id ignored x86_64-linux-gnu-nm -n build/smm/smm.elf > build/smm/smm.map build/util/cbfstool/rmodtool -i build/smm/smm.elf -o build/smm/smm.elf.rmod E: Relocations apply to an invalid section: 0 E: Couldn't parse ELF! free(): double free detected in tcache 2 make: *** [src/lib/Makefile.inc:342: build/smm/smm.elf.rmod] Abgebrochen (Speicherauszug erstellt) ```
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 15:
(1 comment)
File src/cpu/x86/smm/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/58e7ae8b_bf435e86 PS15, Line 18: $(CC_smm) $(CFLAGS_smm) -r -o $@ $(COMPILER_RT_FLAGS_smm) -Wl,--whole-archive,--start-group $(filter-out %.ld, $(smm-objs)) -Wl,--no-whole-archive $(COMPILER_RT_smm) -Wl,--end-group Passing `$(CFLAGS_smm)` it links besides twelve board configs:
* clang.GOOGLE_BERKNIP * clang.GOOGLE_DALBOZ * clang.GOOGLE_DIRINBOZ * clang.GOOGLE_EZKINIL * clang.GOOGLE_GUMBOZ * clang.GOOGLE_MORPHIUS * clang.GOOGLE_SHUBOZ * clang.GOOGLE_SKYRIM.NO_VIDEO * clang.GOOGLE_TREMBYLE * clang.GOOGLE_VILBOZ.X86_64 * clang.GOOGLE_VILBOZ * clang.GOOGLE_WOOMAX
They want to use the LLVM linker LLD for some reason:
LINK cbfs/fallback/verstage.debug clang-15: error: unable to execute command: Executable "ld.lld" doesn't exist! clang-15: error: ld.lld command failed with exit code 1 (use -v to see invocation) make[2]: *** [src/arch/arm/Makefile.inc:64: /cb-build/coreboot-gerrit.0/clang/GOOGLE_BERKNIP/cbfs/fallback/verstage.debug] Error 1
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 15:
(1 comment)
File src/cpu/x86/smm/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/0eeaa787_69cca02a PS15, Line 18: $(CC_smm) $(CFLAGS_smm) -r -o $@ $(COMPILER_RT_FLAGS_smm) -Wl,--whole-archive,--start-group $(filter-out %.ld, $(smm-objs)) -Wl,--no-whole-archive $(COMPILER_RT_smm) -Wl,--end-group
Passing `$(CFLAGS_smm)` it links besides twelve board configs: […]
Those are all google/zork boards/variants and *clang.GOOGLE_SKYRIM.NO_VIDEO* is the only google/skyrim board/variant, that fails to build.
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 16:
(1 comment)
Commit Message:
Robot Comment from checkpatch (run ID jenkins-coreboot-checkpatch-168111): https://review.coreboot.org/c/coreboot/+/40811/comment/c5a28193_0724014a PS16, Line 16: clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument] Possible unwrapped commit description (prefer a maximum 72 chars per line)
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 16:
(1 comment)
File src/cpu/x86/smm/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40811/comment/e37edb71_81b06336 PS15, Line 18: $(CC_smm) $(CFLAGS_smm) -r -o $@ $(COMPILER_RT_FLAGS_smm) -Wl,--whole-archive,--start-group $(filter-out %.ld, $(smm-objs)) -Wl,--no-whole-archive $(COMPILER_RT_smm) -Wl,--end-group
Those are all google/zork boards/variants and *clang.GOOGLE_SKYRIM. […]
Martin said, all those failing boards use PSP verstage. For the Skyrim board, it was selected due to a typo in the build configuration file, fixed in Ic41a91e0a6ecd254a86d0872da19a0d4d321b8e3 (configs/google_skyrim.no_video: Fix typo and regenerate) [1].
Now only the google/zork PSP verstage using boards fail.
[1]: https://review.coreboot.org/c/coreboot/+/71840
Attention is currently required from: Raul Rangel, Stefan Reinauer, Julius Werner, Arthur Heymans, Jacob Garber, Iru Cai, Elyes Haouas.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 16:
(2 comments)
Commit Message:
https://review.coreboot.org/c/coreboot/+/40811/comment/9e43b1cb_005acb21 PS11, Line 7: arch,toolchain,xcompile: Use GCC as linker : : Code generation when using LTO is not done until after linking, so the : compiler must be invoked at all linking stages instead of the linker. : Replace $(LD) with GCC, and prefix all linker-specific flags with -Wl so : they will be passed to the linker.
Would “Use compiler (GCC, clang) as linker“ work? […]
Done
Patchset:
PS11:
It looks like clang tries to use /usb/bin/ld by default. […]
This indeed causes the google/zork builds to fail, which need the “ARM linker” from the coreboot toolchain, but use the one from the host system. Adding `-fuse-ld=$(LD_common)` to `LDFLAGS_common` did not help, as `LD_common` seems empty. Any help on this is appreciated.
Attention is currently required from: Raul Rangel, Paul Menzel, Stefan Reinauer, Julius Werner, Jacob Garber, Iru Cai, Elyes Haouas.
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40811 )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
Patch Set 16:
(1 comment)
Patchset:
PS11:
This indeed causes the google/zork builds to fail, which need the “ARM linker” from the coreboot toolchain, but use the one from the host system. Adding `-fuse-ld=$(LD_common)` to `LDFLAGS_common` did not help, as `LD_common` seems empty. Any help on this is appreciated.
use LDFLAGS_verstage?
Attention is currently required from: Iru Cai, Jacob Garber, Julius Werner, Paul Menzel, Raul Rangel.
Elyes Haouas has uploaded a new patch set (#17) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811?usp=email )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed, results in
clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
Pass CFLAGS_smm and CFLAGS_smmstub.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.inc M src/arch/arm/Makefile.inc M src/arch/arm64/Makefile.inc M src/arch/ppc64/Makefile.inc M src/arch/riscv/Makefile.inc M src/arch/x86/Makefile.inc M src/cpu/x86/smm/Makefile.inc M src/lib/Makefile.inc M toolchain.inc M util/xcompile/xcompile 10 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/17
Attention is currently required from: Elyes Haouas, Iru Cai, Julius Werner, Jérémy Compostella, Paul Menzel, Raul Rangel.
Arthur Heymans has uploaded a new patch set (#20) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811?usp=email )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed, results in
clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
Pass CFLAGS_smm and CFLAGS_smmstub.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.mk M src/arch/arm/Makefile.mk M src/arch/arm64/Makefile.mk M src/arch/ppc64/Makefile.mk M src/arch/riscv/Makefile.mk M src/arch/x86/Makefile.mk M src/cpu/x86/smm/Makefile.mk M src/lib/Makefile.mk M toolchain.mk M util/xcompile/xcompile 10 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/20
Attention is currently required from: Iru Cai, Julius Werner, Jérémy Compostella, Paul Menzel, Raul Rangel.
Arthur Heymans has uploaded a new patch set (#21) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811?usp=email )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed, results in
clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
Pass CFLAGS_smm and CFLAGS_smmstub.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.mk M src/arch/arm/Makefile.mk M src/arch/arm64/Makefile.mk M src/arch/ppc64/Makefile.mk M src/arch/riscv/Makefile.mk M src/arch/x86/Makefile.mk M src/cpu/x86/smm/Makefile.mk M src/lib/Makefile.mk M toolchain.mk M util/xcompile/xcompile 10 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/21
Attention is currently required from: Iru Cai, Julius Werner, Jérémy Compostella, Paul Menzel, Raul Rangel.
Elyes Haouas has uploaded a new patch set (#22) to the change originally created by Jacob Garber. ( https://review.coreboot.org/c/coreboot/+/40811?usp=email )
Change subject: arch,toolchain,xcompile: Use the compiler frontend as a linker ......................................................................
arch,toolchain,xcompile: Use the compiler frontend as a linker
Code generation when using LTO is not done until after linking, so the compiler must be invoked at all linking stages instead of the linker. Replace $(LD) with $(CC), and prefix all linker-specific flags with -Wl and replace the spaces by commas so they will be passed to the linker.
Pass CFLAGS_common to SMM targets, so `-m32` gets passed, results in
clang: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
Pass CFLAGS_smm and CFLAGS_smmstub.
Change-Id: Ia551cf84c8f6eb3b010450fc572876a318a257d1 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M Makefile.mk M src/arch/arm/Makefile.mk M src/arch/arm64/Makefile.mk M src/arch/ppc64/Makefile.mk M src/arch/riscv/Makefile.mk M src/arch/x86/Makefile.mk M src/cpu/x86/smm/Makefile.mk M src/lib/Makefile.mk M toolchain.mk M util/xcompile/xcompile 10 files changed, 37 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/40811/22