aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-05-23 18:21:18 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-05-23 18:21:18 -0400
commit1445843b99f68998892302a011bec30b5c3b28fe (patch)
tree5e2b7b808fe02466dfaafd43f3defac47db4a3ad /Makefile
parentb1a0d3a2ee7dce27066b742444634bdf7ecbef7a (diff)
downloadseabios-1445843b99f68998892302a011bec30b5c3b28fe.tar.gz
Eliminate "_code32_" prefix on 32bit symbols referenced from 16bit code.
Use linking magic to eliminate the need for the _code32_ prefix.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 11 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 56d0a5b6..3a4a1e93 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-# Legacy Bios build system
+# SeaBIOS build system
#
-# Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+# Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU LGPLv3 license.
@@ -111,16 +111,18 @@ $(OUT)romlayout.lds: $(OUT)romlayout16.o
@echo " Building layout information $@"
$(Q)$(OBJDUMP) -h $< | ./tools/layoutrom.py $@
-$(OUT)rombios16.lds: $(OUT)romlayout.lds
+$(OUT)layout16.lds: $(OUT)romlayout.lds
-$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.o $(OUT)rombios16.lds
- @echo " Linking (16bit) $@"
- $(Q)$(OBJCOPY) --prefix-symbols=_code32_ $(OUT)rom32.o $(OUT)rom32.rename.o
- $(Q)$(LD) -T $(OUT)rombios16.lds -R $(OUT)rom32.rename.o $< -o $@
+$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.o $(OUT)layout16.lds
+ @echo " Linking (no relocs) $@"
+ $(Q)$(LD) -r -T $(OUT)layout16.lds $< -o $@
-$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios.lds
+$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios16.lds $(OUT)rombios.lds
@echo " Linking $@"
- $(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.o $(OUT)rom32.o -o $@
+ $(Q)$(LD) -T $(OUT)rombios16.lds $(OUT)rom16.o -R $(OUT)rom32.o -o $(OUT)rom16.final.o
+ $(Q)$(STRIP) $(OUT)rom16.final.o
+ $(Q)$(OBJCOPY) --extract-symbol --adjust-vma 0xf0000 $(OUT)rom16.o $(OUT)rom16.moved.o
+ $(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.final.o $(OUT)rom32.o -R $(OUT)rom16.moved.o -o $@
$(OUT)bios.bin.elf: $(OUT)rom.o
@echo " Prepping $@"