From: Ben Pfaff Date: Tue, 31 Aug 2004 03:23:39 +0000 (+0000) Subject: Use Linux kernel trick of giving an .lds file a .S extension to get it X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4199abedf1dbf20ebd5abe9cebca55d40e9103f0;p=pintos-anon Use Linux kernel trick of giving an .lds file a .S extension to get it preprocessed. --- diff --git a/src/Makefile.inc b/src/Makefile.inc index 7561dff..c4027b5 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -3,7 +3,6 @@ SHELL = /bin/sh CC = gcc -CPP = $(CC) -E VPATH := $(TOP_SRCDIR)/threads VPATH := $(VPATH):$(TOP_SRCDIR)/devices @@ -12,7 +11,7 @@ VPATH := $(VPATH):$(TOP_SRCDIR)/filesys VPATH := $(VPATH):$(TOP_SRCDIR)/userprog WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -CFLAGS = -g -O3 -MMD $(WARNINGS) $(INCLUDES) $(DEFINES) +CFLAGS = -g -O3 -MMD -msoft-float $(WARNINGS) $(INCLUDES) $(DEFINES) ASFLAGS = -Wa,--gstabs+ $(INCLUDES) $(DEFINES) # Core kernel. @@ -58,11 +57,11 @@ all: diskimage.bin intr-stubs.S: $(TOP_SRCDIR)/threads/intr-stubs.pl $< > $@ -kernel.lds: $(TOP_SRCDIR)/threads/kernel.lds.in $(TOP_SRCDIR)/threads/loader.h +kernel.lds.s: $(TOP_SRCDIR)/threads/kernel.lds.S $(TOP_SRCDIR)/threads/loader.h $(CPP) -x assembler-with-cpp -P $< -o $@ -kernel.o: $(OBJECTS) kernel.lds - ld -T kernel.lds -o $@ $(OBJECTS) `$(CC) -print-libgcc-file-name` +kernel.o: $(OBJECTS) kernel.lds.s + ld -T kernel.lds.s -o $@ $(OBJECTS) `$(CC) -print-libgcc-file-name` kernel.bin: kernel.o objcopy -O binary -R .note -R .comment -S $< $@.tmp @@ -77,6 +76,6 @@ diskimage.bin: loader.bin kernel.bin clean: rm -f *.o *.d *.bin - rm -f kernel.bin.data kernel.bin.pad intr-stubs.S kernel.lds + rm -f kernel.bin.data kernel.bin.pad intr-stubs.S kernel.lds.s -include *.d diff --git a/src/threads/kernel.lds.S b/src/threads/kernel.lds.S new file mode 100644 index 0000000..b5426e0 --- /dev/null +++ b/src/threads/kernel.lds.S @@ -0,0 +1,21 @@ +#include "loader.h" + +OUTPUT_FORMAT("elf32-i386") +OUTPUT_ARCH("i386") +ENTRY(start) +SECTIONS +{ + . = LOADER_PHYS_BASE + LOADER_KERN_BASE; + + _start = .; + + .text : { *(.text) } = 0x9090 + .rodata : { *(.rodata) *(.rodata.*) } + .data : { *(.data) } + + _start_bss = .; + .bss : { *(.bss) } + _end_bss = .; + + _end = .; +} diff --git a/src/threads/kernel.lds.in b/src/threads/kernel.lds.in deleted file mode 100644 index fb76cac..0000000 --- a/src/threads/kernel.lds.in +++ /dev/null @@ -1,23 +0,0 @@ -#include "loader.h" - -OUTPUT_FORMAT("elf32-i386") -OUTPUT_ARCH("i386") -ENTRY(start) -SECTIONS -{ - . = LOADER_PHYS_BASE + LOADER_KERN_BASE; - - _start = .; - - .text : { *(.text) } = 0x9090 - - .rodata : { *(.rodata) *(.rodata.*) } - - .data : { *(.data) } - - _start_bss = .; - .bss : { *(.bss) } - _end_bss = .; - - _end = .; -} diff --git a/src/userprog/build/.cvsignore b/src/userprog/build/.cvsignore index b64d546..c3a246a 100644 --- a/src/userprog/build/.cvsignore +++ b/src/userprog/build/.cvsignore @@ -2,6 +2,6 @@ diskimage.bin loader.bin kernel.bin -kernel.bin.data -kernel.bin.pad +kernel.bin.tmp intr-stubs.S +kernel.lds.s