summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/boot/sys/boot/i386/loader/Makefile3
-rw-r--r--usr/src/boot/sys/boot/i386/loader/ldscript.i38651
-rw-r--r--usr/src/boot/sys/boot/i386/loader/main.c4
3 files changed, 55 insertions, 3 deletions
diff --git a/usr/src/boot/sys/boot/i386/loader/Makefile b/usr/src/boot/sys/boot/i386/loader/Makefile
index ab866d6338..e41fab4189 100644
--- a/usr/src/boot/sys/boot/i386/loader/Makefile
+++ b/usr/src/boot/sys/boot/i386/loader/Makefile
@@ -84,7 +84,8 @@ CPPFLAGS += -I.
CLEANFILES= vers.c $(LOADER) $(LOADER).sym $(LOADER).bin loader.help
CLEANFILES += $(FONT).c
-LDFLAGS= -static -Ttext 0x0
+LDSCRIPT= ldscript.i386
+LDFLAGS= -static -T $(LDSCRIPT) -N --gc-sections
# i386 standalone support library
CPPFLAGS += -I.. -I../../../../lib/libstand
diff --git a/usr/src/boot/sys/boot/i386/loader/ldscript.i386 b/usr/src/boot/sys/boot/i386/loader/ldscript.i386
new file mode 100644
index 0000000000..88b0c22db1
--- /dev/null
+++ b/usr/src/boot/sys/boot/i386/loader/ldscript.i386
@@ -0,0 +1,51 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+/*
+ * Copyright 2019 Toomas Soome <tsoome@me.com>
+ */
+
+OUTPUT_FORMAT("elf32-i386-sol2", "elf32-i386-sol2", "elf32-i386-sol2")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x0;
+ .text . :
+ {
+ *(.text .text.*)
+ *(.plt)
+ }
+ .data :
+ {
+ *(.rodata .rodata.*)
+ *(.rodata1)
+ *(.data .data.*)
+ *(.got.plt .got)
+ __start_set_Xcommand_set = .;
+ *(set_Xcommand_set)
+ __stop_set_Xcommand_set = .;
+ __start_set_Xficl_compile_set = .;
+ *(set_Xficl_compile_set)
+ __stop_set_Xficl_compile_set = .;
+ _edata = .;
+ }
+
+ .bss :
+ {
+ __bss_start = . ;
+ *(.bss .bss.*)
+ *(COMMON)
+ }
+ .edata :
+ {
+ _end = . ;
+ }
+}
diff --git a/usr/src/boot/sys/boot/i386/loader/main.c b/usr/src/boot/sys/boot/i386/loader/main.c
index 6f96c6a757..7bd5373976 100644
--- a/usr/src/boot/sys/boot/i386/loader/main.c
+++ b/usr/src/boot/sys/boot/i386/loader/main.c
@@ -69,7 +69,7 @@ void exit(int code);
static void i386_zfs_probe(void);
/* XXX debugging */
-extern char end[];
+extern char _end[];
static void *heap_top;
static void *heap_bottom;
@@ -101,7 +101,7 @@ main(void)
memtop_copyin = high_heap_base;
} else {
heap_top = (void *)PTOV(bios_basemem);
- heap_bottom = (void *)end;
+ heap_bottom = (void *)_end;
}
setheap(heap_bottom, heap_top);