diff --git a/Makefile b/Makefile index 0bac1460..1650f297 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ $(iso): $(kernel) @rm -r build/isofiles $(kernel): cargo $(rust_os) $(assembly_object_files) $(linker_script) - @ld -n -T $(linker_script) -o $(kernel) $(assembly_object_files) $(rust_os) + @ld -n --gc-sections -T $(linker_script) -o $(kernel) $(assembly_object_files) $(rust_os) cargo: @cargo build diff --git a/src/arch/x86_64/linker.ld b/src/arch/x86_64/linker.ld index 4aea8987..8334f3d3 100644 --- a/src/arch/x86_64/linker.ld +++ b/src/arch/x86_64/linker.ld @@ -22,7 +22,7 @@ SECTIONS { .boot : { /* ensure that the multiboot header is at the beginning */ - *(.multiboot) + KEEP(*(.multiboot)) } .text :