Prechádzať zdrojové kódy

Add linker script

This makes correct compilation of sectorlisp.bin more of a sure thing.
Justine Tunney 2 rokov pred
rodič
commit
a15907031b
2 zmenil súbory, kde vykonal 15 pridanie a 4 odobranie
  1. 3 4
      Makefile
  2. 12 0
      sectorlisp.lds

+ 3 - 4
Makefile

@@ -1,5 +1,4 @@
-CFLAGS  = -w -Os
-LDFLAGS = -s
+CFLAGS = -w -Os
 
 CLEANFILES =				\
 	lisp				\
@@ -24,8 +23,8 @@ bestline.o: bestline.c bestline.h
 sectorlisp.o: sectorlisp.S
 	$(AS) -g -o $@ $<
 
-sectorlisp.bin.dbg: sectorlisp.o
-	$(LD) -oformat:binary -Ttext=0x0000 -o $@ $<
+sectorlisp.bin.dbg: sectorlisp.o sectorlisp.lds
+	$(LD) -T sectorlisp.lds -o $@ $<
 
 sectorlisp.bin: sectorlisp.bin.dbg
 	objcopy -S -O binary sectorlisp.bin.dbg sectorlisp.bin

+ 12 - 0
sectorlisp.lds

@@ -0,0 +1,12 @@
+ENTRY(_start)
+
+SECTIONS {
+  . = 0;
+  .text : {
+    *(.text)
+    *(.rodata .rodata.*)
+  }
+  /DISCARD/ : {
+    *(.*)
+  }
+}