aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2016-01-23 01:24:33 +0100
committerNico Huber <nico.h@gmx.de>2016-01-28 00:31:32 +0100
commit98fc426a98db7e4dd5fea334edec720721d2a89c (patch)
tree16a143c645ccf8bdc13ef38ef700bcc8ae101199
parent81b09f40087d1a00afe30e379d2e8460203b1c5c (diff)
Move object files to $(obj)/<class>/
Instead of tagging object files with .<class>, move them to a <class> directory below $(obj)/. This way we can keep a 1:1 mapping between source- and object-file names. The 1:1 mapping is a prerequisite for Ada, where the compiler refuses any other object-file name. Tested by verifying that the resulting coreboot.rom files didn't change for all of Jenkins' abuild configurations. Change-Id: Idb7a8abec4ea0a37021d9fc24cc8583c4d3bf67c Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/13181 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
-rw-r--r--Makefile8
-rw-r--r--Makefile.inc16
-rw-r--r--src/arch/x86/car.ld4
-rw-r--r--src/cpu/x86/Makefile.inc4
-rw-r--r--src/cpu/x86/smm/Makefile.inc32
-rw-r--r--src/include/memlayout.h8
6 files changed, 34 insertions, 38 deletions
diff --git a/Makefile b/Makefile
index 3652559595..a464345810 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,13 @@ add-special-class= \
# Only .c and .S get converted to .o, other files (like .ld) keep their name.
# $1 stage name
# $2 file path (list)
-src-to-obj=$(foreach file,$(2),$(subst .$(1),,$(basename $(patsubst src/%,$(obj)/%,$(file)))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file)))))
+src-to-obj=\
+ $(patsubst $(obj)/%,$(obj)/$(1)/%,\
+ $(patsubst $(obj)/$(1)/%,$(obj)/%,\
+ $(patsubst src/%,$(obj)/%,\
+ $(patsubst %.c,%.o,\
+ $(patsubst %.S,%.o,\
+ $(subst .$(1),,$(2)))))))
# Clean -y variables, include Makefile.inc
# Add paths to files in X-y to X-srcs
diff --git a/Makefile.inc b/Makefile.inc
index 86ccc31ed9..583e59add8 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -415,18 +415,6 @@ ramstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
romstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
verstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
-$(obj)/%.ramstage.o $(abspath $(obj))/%.ramstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_ramstage) -MMD $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) $(ramstage-c-ccopts) -c -o $@ $<
-
-$(obj)/%.romstage.o $(abspath $(obj))/%.romstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_romstage) -MMD $(CFLAGS_romstage) $(CPPFLAGS_romstage) $(romstage-c-ccopts) -c -o $@ $<
-
-$(obj)/%.bootblock.o $(abspath $(obj))/%.bootblock.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_bootblock) -MMD $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) $(bootblock-c-ccopts) -c -o $@ $<
-
$(objgenerated)/libverstage.a: $$(libverstage-objs)
rm -f $@
$(AR_libverstage) rcsT $@ $^
@@ -437,8 +425,8 @@ clean-abuild:
rm -rf coreboot-builds
clean-for-update-target:
- rm -f $(obj)/ramstage* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a
- rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.*
+ rm -f $(obj)/ramstage?* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a
+ rm -rf $(obj)/bootblock?* $(obj)/romstage?* $(obj)/location.*
rm -f $(obj)/option_table.* $(obj)/crt0.S $(obj)/ldscript
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index e5669dc051..191dcaf2aa 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -55,8 +55,8 @@
. = 0xffffff00;
.illegal_globals . : {
- *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/buildOpts.romstage.o" "*/agesawrapper.romstage.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data)
- *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/buildOpts.romstage.o" "*/agesawrapper.romstage.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*)
+ *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data)
+ *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*)
*(.bss)
*(.bss.*)
*(.sbss)
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index ae81ab4f1c..0efbdd7553 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -6,6 +6,8 @@ subdirs-$(CONFIG_PARALLEL_MP) += name
ramstage-$(CONFIG_PARALLEL_MP) += mp_init.c
ramstage-$(CONFIG_MIRROR_PAYLOAD_TO_RAM_BEFORE_LOADING) += mirror_payload.c
+additional-dirs += $(obj)/cpu/x86
+
SIPI_ELF=$(obj)/cpu/x86/sipi_vector.elf
SIPI_RMOD=$(SIPI_ELF).rmod
SIPI_BIN=$(SIPI_ELF:.elf=)
@@ -30,4 +32,4 @@ $(SIPI_BIN): $(SIPI_RMOD)
$(call src-to-obj,ramstage,$(SIPI_BIN).manual): $(SIPI_BIN)
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
- cd $(dir $@); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) $(target-objcopy) $(notdir $@)
+ cd $(dir $<); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc
index 46abd05ced..c912a8f271 100644
--- a/src/cpu/x86/smm/Makefile.inc
+++ b/src/cpu/x86/smm/Makefile.inc
@@ -27,14 +27,14 @@ smmstub-generic-ccopts += -D__SMM__
smm-generic-ccopts += -D__SMM__
smm-c-deps:=$$(OPTION_TABLE_H)
-$(obj)/cpu/x86/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
# change to the target path because objcopy will use the path name in its
# ELF symbol names.
-$(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smm.manual): $(obj)/cpu/x86/smm/smm
+$(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smm.manual): $(obj)/smm/smm
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
- cd $(dir $@); $(OBJCOPY_smm) -I binary $(notdir $<) $(target-objcopy) $(notdir $@)
+ cd $(dir $<); $(OBJCOPY_smm) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
ifeq ($(CONFIG_SMM_TSEG),y)
@@ -49,40 +49,40 @@ ramstage-srcs += $(obj)/cpu/x86/smm/smmstub.manual
# SMM Stub Module. The stub is used as a trampoline for relocation and normal
# SMM handling.
-$(obj)/cpu/x86/smm/smmstub.o: $$(smmstub-objs)
+$(obj)/smmstub/smmstub.o: $$(smmstub-objs)
$(CC_smmstub) $(CFLAGS_smmstub) -nostdlib -r -o $@ $^
# Link the SMM stub module with a 0-byte heap.
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smmstub.elf, $(obj)/cpu/x86/smm/smmstub.o, 0,x86_32))
+$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o, 0,x86_32))
else
-$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smmstub.elf, $(obj)/cpu/x86/smm/smmstub.o, 0,x86_64))
+$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o, 0,x86_64))
endif
-$(obj)/cpu/x86/smm/smmstub: $(obj)/cpu/x86/smm/smmstub.elf.rmod
+$(obj)/smmstub/smmstub: $(obj)/smmstub/smmstub.elf.rmod
$(OBJCOPY_smmstub) -O binary $< $@
-$(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smmstub.manual): $(obj)/cpu/x86/smm/smmstub
+$(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smmstub.manual): $(obj)/smmstub/smmstub
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
- cd $(dir $@); $(OBJCOPY_smmstub) -I binary $(notdir $<) $(target-objcopy) $(notdir $@)
+ cd $(dir $<); $(OBJCOPY_smmstub) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
# C-based SMM handler.
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smm.elf, $(obj)/cpu/x86/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_32))
+$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_32))
else
-$(eval $(call rmodule_link,$(obj)/cpu/x86/smm/smm.elf, $(obj)/cpu/x86/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_64))
+$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_64))
endif
-$(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.elf.rmod
+$(obj)/smm/smm: $(obj)/smm/smm.elf.rmod
$(OBJCOPY_smm) -O binary $< $@
else # CONFIG_SMM_TSEG
-$(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/smm.ld
- $(LD_smm) $(LDFLAGS_smm) -o $(obj)/cpu/x86/smm/smm.elf -T $(src)/cpu/x86/smm/smm.ld $(obj)/cpu/x86/smm/smm.o
- $(NM_smm) -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map
- $(OBJCOPY_smm) -O binary $(obj)/cpu/x86/smm/smm.elf $@
+$(obj)/smm/smm: $(obj)/smm/smm.o $(src)/cpu/x86/smm/smm.ld
+ $(LD_smm) $(LDFLAGS_smm) -o $(obj)/smm/smm.elf -T $(src)/cpu/x86/smm/smm.ld $(obj)/smm/smm.o
+ $(NM_smm) -n $(obj)/smm/smm.elf | sort > $(obj)/smm/smm.map
+ $(OBJCOPY_smm) -O binary $(obj)/smm/smm.elf $@
ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
ramstage-srcs += $(obj)/cpu/x86/smm/smm.manual
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index 42d56082fa..e62782aacd 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -106,7 +106,7 @@
SET_COUNTER(bootblock, addr) \
_ = ASSERT(_eprogram - _program <= sz, \
STR(Bootblock exceeded its allotted size! (sz))); \
- INCLUDE "lib/program.bootblock.ld"
+ INCLUDE "bootblock/lib/program.ld"
#else
#define BOOTBLOCK(addr, sz) \
SET_COUNTER(bootblock, addr) \
@@ -118,7 +118,7 @@
SET_COUNTER(romstage, addr) \
_ = ASSERT(_eprogram - _program <= sz, \
STR(Romstage exceeded its allotted size! (sz))); \
- INCLUDE "lib/program.romstage.ld"
+ INCLUDE "romstage/lib/program.ld"
#else
#define ROMSTAGE(addr, sz) \
SET_COUNTER(romstage, addr) \
@@ -130,7 +130,7 @@
SET_COUNTER(ramstage, addr) \
_ = ASSERT(_eprogram - _program <= sz, \
STR(Ramstage exceeded its allotted size! (sz))); \
- INCLUDE "lib/program.ramstage.ld"
+ INCLUDE "ramstage/lib/program.ld"
#else
#define RAMSTAGE(addr, sz) \
SET_COUNTER(ramstage, addr) \
@@ -149,7 +149,7 @@
SET_COUNTER(verstage, addr) \
_ = ASSERT(_eprogram - _program <= sz, \
STR(Verstage exceeded its allotted size! (sz))); \
- INCLUDE "lib/program.verstage.ld"
+ INCLUDE "verstage/lib/program.ld"
#define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) VERSTAGE(addr, size)
#else