Skip to content

Commit

Permalink
Add linker script
Browse files Browse the repository at this point in the history
This makes correct compilation of sectorlisp.bin more of a sure thing.
  • Loading branch information
jart committed Jan 4, 2023
1 parent c425dee commit a159070
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CFLAGS = -w -Os
LDFLAGS = -s
CFLAGS = -w -Os

CLEANFILES = \
lisp \
Expand All @@ -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 changes: 12 additions & 0 deletions sectorlisp.lds
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ENTRY(_start)

SECTIONS {
. = 0;
.text : {
*(.text)
*(.rodata .rodata.*)
}
/DISCARD/ : {
*(.*)
}
}

0 comments on commit a159070

Please sign in to comment.