I am not sure if this is only for CONFIG_ANY_TOOLCHAIN=y, but builds are not working again for me.
This time I don't think it is some addition I am missing:
The first problem seems to be that the wrong libgcc.a is found. I think toolchain.inc is missing flags:
LIBGCC_FILE_NAME_$(1) = $(wildcard $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-libgcc-file-name))
Next, it would appear that the smm stage is still using 64-bit code:
/usr/bin/ld: Relocatable linking with relocations from format elf32-i386 (build/arch/x86/lib/memcpy.smm.o) to format elf64-x86-64 (build/cpu/x86/smm/smm.o) is not supported
Looks like in src/cpu/x86/smm/Makefile.inc the CC_smm is not correct.
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm) $(CC_smm) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group
Cheers, Sean
It looks like there are numerous places where LDFLAGS instead of CCFLAGS_xxxx or not provided:
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 6c7008c..09e76ea 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -324,7 +324,7 @@ $(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/x86/ramstage.l ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) $(LD_ramstage) -m elf_i386 -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld else - $(CC_ramstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/ramstage.ld $< + $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/x86/ramstage.ld $< endif
endif diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc index bc6a116..b27fac0 100644 --- a/src/cpu/x86/Makefile.inc +++ b/src/cpu/x86/Makefile.inc @@ -16,7 +16,7 @@ endif rmodules-$(CONFIG_PARALLEL_MP) += sipi_vector.S
$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules.o - $(CC_ramstage) $(LDFLAGS) -nostdlib -r -o $@ $^ + $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -r -o $@ $^
$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_ELF:.elf=.o), 0))
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc index cec738a..b3bae29 100644 --- a/src/cpu/x86/smm/Makefile.inc +++ b/src/cpu/x86/smm/Makefile.inc @@ -36,7 +36,7 @@ ramstage-srcs += $(obj)/cpu/x86/smm/smmstub # SMM Stub Module. The stub is used as a trampoline for relocation and normal # SMM handling. $(obj)/cpu/x86/smm/smmstub.o: $$(smmstub-objs) - $(CC_smmstub) $(LDFLAGS) -nostdlib -r -o $@ $^ + $(CC_smmstub) $(CFLAGS_smmstub) -nostdlib -r -o $@ $^
# Link the SMM stub module with a 0-byte heap. $(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smmstub.elf, $(obj)/cpu/x86/smm/smmstub.o, 0)) @@ -51,7 +51,7 @@ $(obj)/cpu/x86/smm/smmstub.ramstage.o: $(obj)/cpu/x86/smm/smmstub # C-based SMM handler.
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm) - $(CC_smm) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group + $(CC_smm) $(CFLAGS_smm) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group
$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smm.elf, $(obj)/cpu/x86/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE))) @@ -73,18 +73,18 @@ endif # Use TSEG specific entry point and linker script ifeq ($(CONFIG_SMM_TSEG),y) smm-y += smmhandler_tseg.S -SMM_LDFLAGS := $(LDFLAGS) -pie +SMM_LDFLAGS := $(LDFLAGS_smm) -pie SMM_LDSCRIPT := smm_tseg.ld else smm-y += smmhandler.S -SMM_LDFLAGS := $(LDFLAGFS) +SMM_LDFLAGS := $(LDFLAGS_smm) SMM_LDSCRIPT := smm.ld endif
smm-y += smihandler.c
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm) - $(CC_smm) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group + $(CC_smm) $(CFLAGS_smm) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group
$(obj)/cpu/x86/smm/smm_wrap: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/$(SMM_LDSCRIPT) $(obj)/ldoptions $(CC_smm) $(SMM_LDFLAGS) -nostdlib -nostartfiles -static -o $(obj)/cpu/x86/smm/smm.elf -T $(src)/cpu/x86/smm/$(SMM_LDSCRIPT) $(obj)/cpu/x86/smm/smm.o
On 05/19/2014 09:51 AM, Sean McNeil wrote:
I am not sure if this is only for CONFIG_ANY_TOOLCHAIN=y, but builds are not working again for me.
This time I don't think it is some addition I am missing:
The first problem seems to be that the wrong libgcc.a is found. I think toolchain.inc is missing flags:
LIBGCC_FILE_NAME_$(1) = $(wildcard $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-libgcc-file-name))
Next, it would appear that the smm stage is still using 64-bit code:
/usr/bin/ld: Relocatable linking with relocations from format elf32-i386 (build/arch/x86/lib/memcpy.smm.o) to format elf64-x86-64 (build/cpu/x86/smm/smm.o) is not supported
Looks like in src/cpu/x86/smm/Makefile.inc the CC_smm is not correct.
$(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME_smm) $(CC_smm) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME_smm) -Wl,--end-group
Cheers, Sean
Hi Sean,
Thank you for the report!
Am 19.05.2014 04:51, schrieb Sean McNeil:
I am not sure if this is only for CONFIG_ANY_TOOLCHAIN=y, but builds are not working again for me.
This time I don't think it is some addition I am missing:
I missed that I don't have multilib issues (ie. compiler needing -m32) because I build with our i386-elf toolchain.
I fixed them, cleaned things up some more and tested the build with my multilib host compiler. See http://review.coreboot.org/#/c/5789/
Regards, Patrick