From ff623a90e3ce8cc26c64c391e2cbba406064dfb7 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 11 Apr 2017 18:52:31 +0200 Subject: [PATCH] Use --gc-sections to remove unused program sections --- Makefile | 2 +- src/arch/x86_64/linker.ld | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3621f03..cda8749 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ $(iso): $(kernel) $(grub_cfg) @rm -r build/isofiles $(kernel): kernel $(rust_os) $(assembly_object_files) $(linker_script) - @ld -n -T $(linker_script) -o $(kernel) \ + @ld -n --gc-sections -T $(linker_script) -o $(kernel) \ $(assembly_object_files) $(rust_os) kernel: diff --git a/src/arch/x86_64/linker.ld b/src/arch/x86_64/linker.ld index 5d788f1..2542055 100644 --- a/src/arch/x86_64/linker.ld +++ b/src/arch/x86_64/linker.ld @@ -6,7 +6,7 @@ SECTIONS { .boot : { /* ensure that the multiboot header is at the beginning */ - *(.multiboot_header) + KEEP(*(.multiboot_header)) } .text :