diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | src/user/bootstrap/linker.ld | 6 | ||||
-rw-r--r-- | src/user/lib/elfreloc.c | 5 | ||||
l--------- | sysroot/usr/lib/crt0.o | 1 | ||||
l--------- | sysroot/usr/lib/libc.a | 1 | ||||
m--------- | toolchain/gcc | 0 | ||||
-rwxr-xr-x | tools/dep_builders/gcc | 1 |
7 files changed, 9 insertions, 13 deletions
@@ -10,7 +10,7 @@ CFLAGS += -Wall -Wextra -Wold-style-definition -Werror=implicit-function-declara CFLAGS += -Wno-address-of-packed-member -Werror=incompatible-pointer-types KERNEL_CFLAGS = $(CFLAGS) -ffreestanding -mno-sse -mgeneral-regs-only \ - --sysroot=$(shell pwd)/sysroot_alt/ -Isrc/ -Isrc/shared/include/ + --sysroot=$(shell pwd)/sysroot_alt/ -Isrc/ -Isrc/shared/include/ -fno-pie LIBC_CFLAGS = $(CFLAGS) -ffreestanding -Isrc/ USER_CFLAGS = $(CFLAGS) @@ -93,7 +93,7 @@ out/libm.a: out/bootstrap: src/user/bootstrap/linker.ld $(call from_sources, src/user/bootstrap/) out/libc.a @mkdir -p $(@D) - @$(CC) -nostdlib -Wl,-Map=% -T $^ -o $@ + @$(CC) -nostdlib -Wl,-no-pie -Wl,-Map=% -T $^ -o $@ out/fs/boot/init: out/bootstrap out/initrd.tar @mkdir -p $(@D) @@ -109,7 +109,7 @@ out/fs.e2: define userbin_template = out/initrd/bin/amd64/$(1): $(call from_sources, src/user/app/$(1)) out/libc.a @mkdir -p $$(@D) - @$(CC) -nostdlib $$^ -o $$@ + @$(CC) $$^ -o $$@ endef USERBINS := $(shell ls src/user/app) $(foreach bin,$(USERBINS),$(eval $(call userbin_template,$(bin)))) @@ -165,7 +165,7 @@ out/obj/user/lib/vendor/%.c.o: src/user/lib/vendor/%.c out/obj/user/bootstrap/%.c.o: src/user/bootstrap/%.c @mkdir -p $(@D) - @$(CC) $(USER_CFLAGS) -c $^ -o $@ + @$(CC) $(USER_CFLAGS) -fno-pic -c $^ -o $@ out/obj/kernel/arch/amd64/32/%.c.o: src/kernel/arch/amd64/32/%.c @mkdir -p $(@D) diff --git a/src/user/bootstrap/linker.ld b/src/user/bootstrap/linker.ld index 34d8101..5d8abe7 100644 --- a/src/user/bootstrap/linker.ld +++ b/src/user/bootstrap/linker.ld @@ -26,11 +26,7 @@ SECTIONS } .data BLOCK(4K) : ALIGN(4K) { - *(.data) + *(.data*) } _initrd = .; /* is just appended onto the end of the binary */ - - /DISCARD/ : { - *(*.rel.*) - } } diff --git a/src/user/lib/elfreloc.c b/src/user/lib/elfreloc.c index 632f60f..aab2a2a 100644 --- a/src/user/lib/elfreloc.c +++ b/src/user/lib/elfreloc.c @@ -15,10 +15,7 @@ static struct Elf64_Dyn *dyn_gettag(Elf64_Xword tag) { } void elf_selfreloc(void) { - // TODO DT_REL - if (dyn_gettag(DT_PLTGOT) || dyn_gettag(DT_JMPREL)) { - _klogf("elf: unimplemented tag in _DYNAMIC\n"); - } + // TODO DT_REL, DT_JMPREL struct Elf64_Dyn *rela_tag = dyn_gettag(DT_RELA); if (rela_tag) { diff --git a/sysroot/usr/lib/crt0.o b/sysroot/usr/lib/crt0.o new file mode 120000 index 0000000..acea146 --- /dev/null +++ b/sysroot/usr/lib/crt0.o @@ -0,0 +1 @@ +../../../out/obj/user/lib/_start.s.o
\ No newline at end of file diff --git a/sysroot/usr/lib/libc.a b/sysroot/usr/lib/libc.a new file mode 120000 index 0000000..135b015 --- /dev/null +++ b/sysroot/usr/lib/libc.a @@ -0,0 +1 @@ +../../../out/libc.a
\ No newline at end of file diff --git a/toolchain/gcc b/toolchain/gcc -Subproject a508774654ed884b0443c8df069ffb5605cd30b +Subproject 3c3daa3852e35cd006546cb8a250a9c9c3eb3c2 diff --git a/tools/dep_builders/gcc b/tools/dep_builders/gcc index f3e72a0..0a37541 100755 --- a/tools/dep_builders/gcc +++ b/tools/dep_builders/gcc @@ -21,6 +21,7 @@ cd $BUILDDIR --prefix="$PREFIX" \ --with-sysroot="$SYSROOT" \ --enable-languages=c,c++ \ + --enable-default-pie \ --disable-nls \ --disable-gcov \ --disable-werror |