Use gcc -x assembler-with-cpp instead of gcc -E --traditional

This patch makes it so we use "gcc -x assembler-with-cpp" to build our
.S files, instead of translating them to .s files and assembling
directly.  This allows us to use header files and simple symbolic
arithmetic more conveniently in .S files, and at the same time reduces
the number of temporary files created when building.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2022-03-30 14:58:49 -04:00 committed by Sam Demeulemeester
parent 59a0996070
commit f96c5b5093
2 changed files with 8 additions and 13 deletions

View File

@ -75,16 +75,14 @@ all: memtest.bin memtest.efi
-include $(subst .o,.d,$(TST_OBJS))
-include $(subst .o,.d,$(APP_OBJS))
boot/%.o: boot/%.s
$(AS) $< -o $@
boot/startup.s: ../boot/startup32.S ../boot/boot.h
boot/startup.o: ../boot/startup32.S ../boot/boot.h
@mkdir -p boot
$(CC) -m32 -E -traditional -I../boot -o $@ $<
$(CC) -m32 -x assembler-with-cpp -c -I../boot -o $@ $<
boot/%.s: ../boot/%.S ../boot/boot.h
boot/%.o: ../boot/%.S ../boot/boot.h
@mkdir -p boot
$(CC) -m32 -E -traditional -I../boot -o $@ $<
$(CC) -m32 -x assembler-with-cpp -c -I../boot -o $@ $<
boot/efisetup.o: ../boot/efisetup.c
@mkdir -p boot

View File

@ -74,16 +74,13 @@ all: memtest.bin memtest.efi
-include $(subst .o,.d,$(TST_OBJS))
-include $(subst .o,.d,$(APP_OBJS))
boot/%.o: boot/%.s
$(AS) $< -o $@
boot/startup.s: ../boot/startup64.S ../boot/boot.h
boot/startup.o: ../boot/startup64.S ../boot/boot.h
@mkdir -p boot
$(CC) -E -traditional -I../boot -o $@ $<
$(CC) -x assembler-with-cpp -c -I../boot -o $@ $<
boot/%.s: ../boot/%.S ../boot/boot.h
boot/%.o: ../boot/%.S ../boot/boot.h
@mkdir -p boot
$(CC) -E -traditional -I../boot -o $@ $<
$(CC) -x assembler-with-cpp -c -I../boot -o $@ $<
boot/efisetup.o: ../boot/efisetup.c
@mkdir -p boot