diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2015-03-30 13:40:29 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-30 20:41:20 +0200 |
commit | 6b65f0d8bd04041c24c1e9da8199c6e484192b5f (patch) | |
tree | 11807a79df3150a5192534a387bef026fa246842 /src | |
parent | 10f86b0bd8c294870dd3026d1dd55835303c416f (diff) | |
download | coreboot-6b65f0d8bd04041c24c1e9da8199c6e484192b5f.tar.xz |
mips: Simplify architecture specific Makefile.inc
The mips Makefile was inherited from x86 and so included lots
of stuff that is necessary on x86 but nowhere else.
That cruft is now gone.
It also adopts the non-x86 approach of handling linker scripts,
hardcoding an include to ldoptions there, instead of manual
concatenation (of just one file plus options).
This is inspired by the commit listed below, but rewritten to match
upstream, and split in smaller pieces to keep intent clear.
Change-Id: Ibf0c7096f9425572d8f83837aa6a253fd91e212c
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Based-On-Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b
Based-On-Signed-off-by: Julius Werner <jwerner@chromium.org>
Based-On-Reviewed-on: https://chromium-review.googlesource.com/219170
Reviewed-on: http://review.coreboot.org/9163
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/mips/Makefile.inc | 63 | ||||
-rw-r--r-- | src/arch/mips/bootblock.ld | 1 | ||||
-rw-r--r-- | src/arch/mips/ramstage.ld | 1 | ||||
-rw-r--r-- | src/arch/mips/romstage.ld | 1 |
4 files changed, 11 insertions, 55 deletions
diff --git a/src/arch/mips/Makefile.inc b/src/arch/mips/Makefile.inc index 42c3007754..9636333e39 100644 --- a/src/arch/mips/Makefile.inc +++ b/src/arch/mips/Makefile.inc @@ -35,6 +35,8 @@ endif ifeq ($(CONFIG_ARCH_BOOTBLOCK_MIPS),y) bootblock-y += boot.c +bootblock-y += bootblock.S +bootblock-y += bootblock_simple.c bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += early_console.c bootblock-y += stages.c bootblock-y += timer.c @@ -44,44 +46,15 @@ bootblock-y += ../../lib/memset.c bootblock_lds = $(src)/arch/mips/bootblock.ld -bootblock_inc += $(src)/arch/mips/bootblock.S -bootblock_inc += $(objgenerated)/bootblock.inc - # Much of the assembly code is generated by the compiler, and may contain # terms which the preprocessor will happily go on to replace. For example # "mips" would be replaced with "1". Clear all the built in definitions to # prevent that. bootblock-S-ccopts += -undef -$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions - @printf " GEN $(subst $(obj)/,,$(@))\n" - printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@ - -$(objgenerated)/bootblock_inc.S: $$(bootblock_inc) - @printf " GEN $(subst $(obj)/,,$(@))\n" - printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@ - -$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_bootblock) $(bootblock-S-ccopts) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm - -$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_bootblock) $(bootblock-S-ccopts) -MMD -x assembler-with-cpp -E \ - -I$(src)/include -I$(src)/arch/mips/include -I$(obj) \ - -include $(obj)/build.h -include $(obj)/config.h -I. \ - -I$(src) $< -o $@ - -$(objgenerated)/bootblock.inc: $(src)/arch/mips/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(bootblock_custom) $(obj)/config.h - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_bootblock) $(bootblock-c-ccopts) $(CFLAGS_bootblock) -MM \ - -MT$(objgenerated)/bootblock.inc \ - $< > $(objgenerated)/bootblock.inc.d - $(CC_bootblock) $(bootblock-c-ccopts) -c -S $(CFLAGS_bootblock) -I. $< -o $@ - -$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld $$(bootblock-objs) $(obj)/config.h +$(objcbfs)/bootblock.debug: $(src)/arch/mips/bootblock.ld $$(bootblock-objs) $(obj)/config.h $(obj)/ldoptions @printf " LINK $(subst $(obj)/,,$(@))\n" - $(CC_bootblock) $(CFLAGS_bootblock) -nostdlib -Wl,--gc-sections -nostartfiles -include $(obj)/config.h -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld -Wl,--start-group $(objgenerated)/bootblock.o $(bootblock-objs) -Wl,--end-group + $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) -T $(src)/arch/mips/bootblock.ld --start-group $(bootblock-objs) --end-group endif # CONFIG_ARCH_BOOTBLOCK_MIPS @@ -99,17 +72,9 @@ romstage-y += ../../lib/memcpy.c romstage-y += ../../lib/memmove.c romstage-y += ../../lib/memset.c -romstage-lds = $(src)/arch/mips/romstage.ld - -$(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld +$(objcbfs)/romstage.debug: $$(romstage-objs) $(src)/arch/mips/romstage.ld $(obj)/ldoptions @printf " LINK $(subst $(obj)/,,$(@))\n" - $(CC_romstage) -nostdlib -Wl,--gc-sections -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage.ld -Wl,--start-group $(romstage-objs) -Wl,--end-group - -$(objgenerated)/romstage.ld: $$(romstage-lds) $(obj)/ldoptions - @printf " GEN $(subst $(obj)/,,$(@))\n" - rm -f $@ - printf '$(foreach ldscript,ldoptions $(romstage-lds),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp - mv $@.tmp $@ + $(LD_romstage) --gc-sections -static -o $@ -L$(obj) -T $(src)/arch/mips/romstage.ld --start-group $(romstage-objs) --end-group endif # CONFIG_ARCH_ROMSTAGE_MIPS @@ -129,20 +94,8 @@ ramstage-y += ../../lib/memmove.c ramstage-y += ../../lib/memset.c ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) -ramstage-lds = $(src)/arch/mips/ramstage.ld - -$(objgenerated)/ramstage.ld: $$(ramstage-lds) $(obj)/ldoptions - @printf " GEN $(subst $(obj)/,,$(@))\n" - rm -f $@ - printf '$(foreach ldscript,ldoptions $(ramstage-lds),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp - mv $@.tmp $@ - -$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(objgenerated)/ramstage.ld - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_ramstage) -nostdlib -Wl,--gc-sections -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/ramstage.ld $< - -$(objgenerated)/ramstage.o: $$(ramstage-objs) +$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/mips/ramstage.ld $(obj)/ldoptions @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -r -o $@ -Wl,--start-group $(ramstage-objs) -Wl,--end-group + $(LD_ramstage) --gc-sections -static -o $@ -L$(obj) -T $(src)/arch/mips/ramstage.ld --start-group $(ramstage-objs) --end-group endif # CONFIG_ARCH_RAMSTAGE_MIPS diff --git a/src/arch/mips/bootblock.ld b/src/arch/mips/bootblock.ld index 3721f85641..8e1b1e353e 100644 --- a/src/arch/mips/bootblock.ld +++ b/src/arch/mips/bootblock.ld @@ -20,6 +20,7 @@ */ OUTPUT_ARCH(mips) +INCLUDE ldoptions ENTRY(_start) diff --git a/src/arch/mips/ramstage.ld b/src/arch/mips/ramstage.ld index 405244446f..cba90eb597 100644 --- a/src/arch/mips/ramstage.ld +++ b/src/arch/mips/ramstage.ld @@ -24,6 +24,7 @@ */ OUTPUT_ARCH(mips) +INCLUDE ldoptions ENTRY(stage_entry) diff --git a/src/arch/mips/romstage.ld b/src/arch/mips/romstage.ld index 8964285230..f776bc8bb1 100644 --- a/src/arch/mips/romstage.ld +++ b/src/arch/mips/romstage.ld @@ -20,6 +20,7 @@ */ OUTPUT_ARCH(mips) +INCLUDE ldoptions ENTRY(stage_entry) |