Updated linker file to linker script
The linker script can now dynamically use variables such as PAGE_OFFSET. Updated Makefile to process linker.lds.S
This commit is contained in:
parent
60c857324f
commit
1fc49a33df
7
Makefile
7
Makefile
|
@ -67,7 +67,7 @@ CRTENDOBJ := $(shell $(C) $(CFLAGS) -print-file-name=crtend.o)
|
|||
CRTBEGIN := $(GLOBALARCHDIR)/crti.o $(CRTBEGINOBJ)
|
||||
CRTEND := $(CRTENDOBJ) $(GLOBALARCHDIR)/crtn.o
|
||||
|
||||
MAKEOBJS := $(GLOBALARCHDIR)/crti.o $(GLOBALARCHDIR)/crtn.o $(SRCDIR)/linker.ld $(OBJECTS) $(ASOBJECTS)
|
||||
MAKEOBJS := $(GLOBALARCHDIR)/crti.o $(GLOBALARCHDIR)/crtn.o $(BUILDDIR)/linker.lds $(OBJECTS) $(ASOBJECTS)
|
||||
|
||||
#Order the objects to prevent weird gcc bugs with global constructors
|
||||
MAINOBJS := $(CRTBEGIN) $(OBJECTS) $(ASOBJECTS) $(CRTEND)
|
||||
|
@ -82,11 +82,14 @@ bin/ZoarialBareOS.iso: bin/ZoarialBareOS.bin bin/grub.cfg
|
|||
|
||||
bin/ZoarialBareOS.bin: $(MAKEOBJS)
|
||||
@echo " Linking... $(MAINOBJS)"
|
||||
$(C) -T $(SRCDIR)/linker.ld $(MAINOBJS) -o $@ -ffreestanding -O2 -nostdlib -lgcc
|
||||
$(C) -T build/linker.lds $(MAINOBJS) -o $@ -ffreestanding -O2 -nostdlib -lgcc
|
||||
|
||||
bin/grub.cfg: $(SRCDIR)/grub.cfg
|
||||
cp $(SRCDIR)/grub.cfg bin/grub.cfg
|
||||
|
||||
$(BUILDDIR)/linker.lds: $(SRCDIR)/linker.lds.S
|
||||
$(C) $(CFLAGS) $(INC) -E -P -o $@ -x c-header $^
|
||||
|
||||
#Include dependencies which are created
|
||||
#-include $(DEPENDENCIES:)
|
||||
include $(wildcard $(DEPENDENCIES))
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#define PAGE_OFFSET 0xC0000000
|
|
@ -1,3 +1,5 @@
|
|||
#include <arch/i686/memory.h>
|
||||
|
||||
/* The bootloader will look at this image and start execution at the symbol
|
||||
designated as the entry point. */
|
||||
ENTRY(_start)
|
||||
|
@ -25,7 +27,7 @@ SECTIONS
|
|||
*(.paging.setup.text)
|
||||
}
|
||||
|
||||
. += 0xC0000000;
|
||||
. += PAGE_OFFSET;
|
||||
|
||||
.text ALIGN(4K) : AT (ADDR (.text) - 0xC0000000)
|
||||
{
|
Loading…
Reference in New Issue