cpu/x86/smm: Pass smm.ld through src-to-obj

This allows for ccopts symbols and preprocessor to be used inside the
smm.ld linker script.

Change-Id: I4262c09ca52c1fca43c1c115530efe489a722c32
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44321
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2020-08-09 20:18:11 +02:00 committed by Patrick Georgi
parent a9a48b6839
commit f3d65e4998
1 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,7 @@ smm-generic-ccopts += -D__SMM__
smm-c-deps:=$$(OPTION_TABLE_H) smm-c-deps:=$$(OPTION_TABLE_H)
$(obj)/smm/smm.o: $$(smm-objs) $(COMPILER_RT_smm) $(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) --whole-archive --start-group $(filter-out %.ld, $(smm-objs)) --no-whole-archive $(COMPILER_RT_smm) --end-group
# change to the target path because objcopy will use the path name in its # change to the target path because objcopy will use the path name in its
# ELF symbol names. # ELF symbol names.
@ -76,8 +76,10 @@ $(obj)/smm/smm: $(obj)/smm/smm.elf.rmod
else # CONFIG_SMM_TSEG else # CONFIG_SMM_TSEG
$(obj)/smm/smm: $(obj)/smm/smm.o $(src)/cpu/x86/smm/smm.ld smm-y += smm.ld
$(LD_smm) $(LDFLAGS_smm) -o $(obj)/smm/smm.elf -T $(src)/cpu/x86/smm/smm.ld $(obj)/smm/smm.o
$(obj)/smm/smm: $(obj)/smm/smm.o $(call src-to-obj,smm,$(src)/cpu/x86/smm/smm.ld)
$(LD_smm) $(LDFLAGS_smm) -o $(obj)/smm/smm.elf -T $(call src-to-obj,smm,$(src)/cpu/x86/smm/smm.ld) $(obj)/smm/smm.o
$(NM_smm) -n $(obj)/smm/smm.elf | sort > $(obj)/smm/smm.map $(NM_smm) -n $(obj)/smm/smm.elf | sort > $(obj)/smm/smm.map
$(OBJCOPY_smm) -O binary $(obj)/smm/smm.elf $@ $(OBJCOPY_smm) -O binary $(obj)/smm/smm.elf $@