Index: kernel/arch/abs32le/Makefile.inc
===================================================================
--- kernel/arch/abs32le/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/abs32le/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,5 +27,4 @@
 #
 
-BFD = binary
 
 ifeq ($(COMPILER),gcc_cross)
Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/amd64/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,7 +27,4 @@
 #
 
-BFD_NAME = elf64-x86-64
-BFD_ARCH = i386:x86-64
-BFD = binary
 
 FPU_NO_CFLAGS = -mno-sse -mno-sse2
Index: kernel/arch/amd64/_link.ld.in
===================================================================
--- kernel/arch/amd64/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/amd64/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -33,9 +33,10 @@
 		*(COMMON);      /* global variables */
 
+		/* XXX: bss can't be omitted from the ELF image. */
+		*(.bss);        /* uninitialized static variables */
+
 		. = ALIGN(8);
 		symbol_table = .;
 		*(symtab.*);    /* Symbol table, must be LAST symbol!*/
-
-		*(.bss);        /* uninitialized static variables */
 
 		kdata_end = .;
Index: kernel/arch/arm32/Makefile.inc
===================================================================
--- kernel/arch/arm32/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/arm32/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,7 +27,4 @@
 #
 
-BFD_NAME = elf32-littlearm
-BFD_ARCH = arm
-BFD = binary
 
 ATSIGN = %
Index: kernel/arch/arm32/_link.ld.in
===================================================================
--- kernel/arch/arm32/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/arm32/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -25,4 +25,5 @@
 	. = KERNEL_LOAD_ADDRESS;
 	kernel_load_address = .;
+	. = . + SIZEOF_HEADERS;
 	.text : {
 		ktext_start = .;
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ia32/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,7 +27,4 @@
 #
 
-BFD_NAME = elf32-i386
-BFD_ARCH = i386
-BFD = binary
 
 BITS = 32
Index: kernel/arch/ia32/_link.ld.in
===================================================================
--- kernel/arch/ia32/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ia32/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -31,8 +31,11 @@
 		*(.rodata .rodata.*);   /* string literals */
 		*(COMMON);              /* global variables */
+
+		/* XXX: bss can't be omitted from the ELF image. */
+		*(.bss);                /* uninitialized static variables */
+
 		. = ALIGN(8);
 		symbol_table = .;
 		*(symtab.*);            /* Symbol table, must be LAST symbol! */
-		*(.bss);                /* uninitialized static variables */
 		kdata_end = .;
 	}
Index: kernel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ia64/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,6 +27,4 @@
 #
 
-BFD_NAME = elf64-little
-BFD_ARCH = ia64-elf64
 
 COMMON_CFLAGS += -mconstant-gp -fno-unwind-tables -mfixed-range=f32-f127
@@ -65,10 +63,8 @@
 ifeq ($(MACHINE),ski)
 	ARCH_SOURCES += arch/$(KARCH)/src/drivers/ski.c
-	BFD = binary
 endif
 
 ifeq ($(MACHINE),i460GX)
 	DEFS += -DI460GX
-	BFD = binary
 endif
 
Index: kernel/arch/ia64/_link.ld.in
===================================================================
--- kernel/arch/ia64/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ia64/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -15,5 +15,6 @@
 	kernel_load_address = LOAD_ADDRESS_V;
 
-	.image LOAD_ADDRESS_V: AT (LOAD_ADDRESS_P) {
+	.image (LOAD_ADDRESS_V + SIZEOF_HEADERS): AT (LOAD_ADDRESS_P + SIZEOF_HEADERS) {
+		. = ALIGN(16);
 		ktext_start = .;
 		*(K_TEXT_START);
Index: kernel/arch/mips32/Makefile.inc
===================================================================
--- kernel/arch/mips32/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/mips32/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,6 +27,4 @@
 #
 
-BFD_ARCH = mips
-BFD = binary
 COMMON_CFLAGS += -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mabi=32
 AS_PROLOG = .module softfloat;
@@ -38,15 +36,12 @@
 
 ifeq ($(MACHINE),msim)
-	BFD_NAME = elf32-tradlittlemips
 	ENDIANESS = LE
 	COMMON_CFLAGS += -march=r4000
 endif
 ifeq ($(MACHINE),bmalta)
-	BFD_NAME = elf32-tradbigmips
 	ENDIANESS = BE
 	COMMON_CFLAGS += -D__BE__ -march=4kc
 endif
 ifeq ($(MACHINE),lmalta)
-	BFD_NAME = elf32-tradlittlemips
 	ENDIANESS = LE
 	COMMON_CFLAGS += -march=4kc
Index: kernel/arch/mips32/_link.ld.in
===================================================================
--- kernel/arch/mips32/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/mips32/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -24,4 +24,5 @@
 	. = KERNEL_LOAD_ADDRESS;
 	kernel_load_address = .;
+	. = . + SIZEOF_HEADERS;
 
 	.text : {
Index: kernel/arch/ppc32/Makefile.inc
===================================================================
--- kernel/arch/ppc32/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ppc32/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,7 +27,4 @@
 #
 
-BFD_NAME = elf32-powerpc
-BFD_ARCH = powerpc:common
-BFD = binary
 
 COMMON_CFLAGS += -mcpu=powerpc -msoft-float -m32
Index: kernel/arch/ppc32/_link.ld.in
===================================================================
--- kernel/arch/ppc32/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ppc32/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -20,5 +20,6 @@
 	kernel_load_address = PA2KA(0);
 
-	.unmapped 0: AT (0) {
+	.unmapped (SIZEOF_HEADERS): AT (SIZEOF_HEADERS) {
+		. = ALIGN(0x100);
 		*(K_UNMAPPED_TEXT_START);
 	}
@@ -46,3 +47,7 @@
 		kdata_end = .;
 	}
+
+	/DISCARD/ : {
+		*(*);
+	}
 }
Index: kernel/arch/ppc32/src/exception.S
===================================================================
--- kernel/arch/ppc32/src/exception.S	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/ppc32/src/exception.S	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -126,5 +126,9 @@
 .endm
 
-.org 0x100
+// XXX: K_UNMAPPED_TEXT_START section starts at 0x100,
+// so all the following .org directives are relative to that.
+#define ABSOLUTE(x) ((x) - 0x100)
+
+.org ABSOLUTE(0x100)
 SYMBOL(exc_system_reset)
 	CONTEXT_STORE
@@ -133,5 +137,5 @@
 	b jump_to_kernel
 
-.org 0x200
+.org ABSOLUTE(0x200)
 SYMBOL(exc_machine_check)
 	CONTEXT_STORE
@@ -140,5 +144,5 @@
 	b jump_to_kernel
 
-.org 0x300
+.org ABSOLUTE(0x300)
 SYMBOL(exc_data_storage)
 	CONTEXT_STORE
@@ -147,5 +151,5 @@
 	b jump_to_kernel
 
-.org 0x400
+.org ABSOLUTE(0x400)
 SYMBOL(exc_instruction_storage)
 	CONTEXT_STORE
@@ -154,5 +158,5 @@
 	b jump_to_kernel
 
-.org 0x500
+.org ABSOLUTE(0x500)
 SYMBOL(exc_external)
 	CONTEXT_STORE
@@ -161,5 +165,5 @@
 	b jump_to_kernel
 
-.org 0x600
+.org ABSOLUTE(0x600)
 SYMBOL(exc_alignment)
 	CONTEXT_STORE
@@ -168,5 +172,5 @@
 	b jump_to_kernel
 
-.org 0x700
+.org ABSOLUTE(0x700)
 SYMBOL(exc_program)
 	CONTEXT_STORE
@@ -175,5 +179,5 @@
 	b jump_to_kernel
 
-.org 0x800
+.org ABSOLUTE(0x800)
 SYMBOL(exc_fp_unavailable)
 	CONTEXT_STORE
@@ -182,5 +186,5 @@
 	b jump_to_kernel
 
-.org 0x900
+.org ABSOLUTE(0x900)
 SYMBOL(exc_decrementer)
 	CONTEXT_STORE
@@ -189,5 +193,5 @@
 	b jump_to_kernel
 
-.org 0xa00
+.org ABSOLUTE(0xa00)
 SYMBOL(exc_reserved0)
 	CONTEXT_STORE
@@ -196,5 +200,5 @@
 	b jump_to_kernel
 
-.org 0xb00
+.org ABSOLUTE(0xb00)
 SYMBOL(exc_reserved1)
 	CONTEXT_STORE
@@ -203,5 +207,5 @@
 	b jump_to_kernel
 
-.org 0xc00
+.org ABSOLUTE(0xc00)
 SYMBOL(exc_syscall)
 	CONTEXT_STORE
@@ -209,5 +213,5 @@
 	b jump_to_kernel_syscall
 
-.org 0xd00
+.org ABSOLUTE(0xd00)
 SYMBOL(exc_trace)
 	CONTEXT_STORE
@@ -216,5 +220,5 @@
 	b jump_to_kernel
 
-.org 0x1000
+.org ABSOLUTE(0x1000)
 SYMBOL(exc_itlb_miss)
 	CONTEXT_STORE
@@ -223,5 +227,5 @@
 	b jump_to_kernel
 
-.org 0x1100
+.org ABSOLUTE(0x1100)
 SYMBOL(exc_dtlb_miss_load)
 	CONTEXT_STORE
@@ -230,5 +234,5 @@
 	b jump_to_kernel
 
-.org 0x1200
+.org ABSOLUTE(0x1200)
 SYMBOL(exc_dtlb_miss_store)
 	CONTEXT_STORE
@@ -237,5 +241,5 @@
 	b jump_to_kernel
 
-.org 0x4000
+.org ABSOLUTE(0x4000)
 jump_to_kernel:
 	mfsrr1 r5
@@ -289,2 +293,6 @@
 	addis sp, sp, 0x8000
 	rfi
+
+/* Rest is for stack. */
+
+.org ABSOLUTE(0x8000)
Index: kernel/arch/riscv64/Makefile.inc
===================================================================
--- kernel/arch/riscv64/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/riscv64/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,7 +27,4 @@
 #
 
-BFD_NAME = elf64-littleriscv
-BFD_ARCH = riscv
-BFD = binary
 
 COMMON_CFLAGS += -mcmodel=medany
Index: kernel/arch/riscv64/_link.ld.in
===================================================================
--- kernel/arch/riscv64/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/riscv64/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -16,5 +16,5 @@
 	kernel_load_address = PA2KA(BOOT_OFFSET);
 
-	.image (PA2KA(BOOT_OFFSET)) : AT (0) {
+	.image (PA2KA(BOOT_OFFSET) + SIZEOF_HEADERS) : AT (SIZEOF_HEADERS) {
 		ktext_start = .;
 		*(K_TEXT_START);
Index: kernel/arch/sparc64/Makefile.inc
===================================================================
--- kernel/arch/sparc64/Makefile.inc	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/sparc64/Makefile.inc	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -27,7 +27,4 @@
 #
 
-BFD_NAME = elf64-sparc
-BFD_ARCH = sparc
-BFD = binary
 
 COMMON_CFLAGS += -m64 -mcpu=ultrasparc -mcmodel=medlow -mno-fpu
Index: kernel/arch/sparc64/_link.ld.in
===================================================================
--- kernel/arch/sparc64/_link.ld.in	(revision 566457ad2a776b2ac7fe206894a57dc9805ea7bc)
+++ kernel/arch/sparc64/_link.ld.in	(revision cfdeedc55a55b7c1fc8de8b3faea55104ff3f641)
@@ -12,7 +12,7 @@
 
 SECTIONS {
-	.image VMA: AT (LMA) {
-		kernel_load_address = .;
+	kernel_load_address = VMA;
 
+	.image (VMA + SIZEOF_HEADERS): AT (LMA + SIZEOF_HEADERS) {
 		ktext_start = .;
 		*(K_TEXT_START)
