From 115f4ff541839f7a97f9413e1ac3ff7695c24c9e Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 1 Aug 2020 15:59:39 +0200 Subject: Switched to PIE flat binaries --- apps/link.ld | 34 ++++++++++++++++++++++------------ apps/test.c | 4 ++-- 2 files changed, 24 insertions(+), 14 deletions(-) (limited to 'apps') diff --git a/apps/link.ld b/apps/link.ld index ee41578..14fe1e3 100644 --- a/apps/link.ld +++ b/apps/link.ld @@ -1,24 +1,34 @@ -ENTRY(main) +OUTPUT_FORMAT("elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(start) + SECTIONS { - .text 0x40000000: - { - code = .; _code = .; __code = .; + . = 0x00000000; + + .text : { *(.text) } - .data ALIGN(0x400000): - { - data = .; _data = .; __data = .; - *(.data) + .rodata : { *(.rodata) } - .bss ALIGN(0x400000): - { - bss = .; _bss = .; __bss = .; + . = ALIGN(4096); + + .data : { + *(.data) + } + + . = ALIGN(4096); + + .bss : { *(.bss) } - end = .; _end = .; __end = .; + . = ALIGN(4096); + + _GLOBAL_OFFSET_TABLE_ = .; + + . = ALIGN(4096); } diff --git a/apps/test.c b/apps/test.c index f9e40cb..592f35b 100644 --- a/apps/test.c +++ b/apps/test.c @@ -81,8 +81,8 @@ void serial_print(const char *data) serial_put(data[i]); } -void main() +void start() { serial_install(); - serial_print("WELCOME TO USERSPACE"); + serial_print("Follow the white rabbit."); } -- cgit v1.2.3