kernel icon indicating copy to clipboard operation
kernel copied to clipboard

Stripping debug symbols from the kernel binary makes it bigger

Open hawkw opened this issue 9 years ago • 2 comments

When the kernel binary is compiled with debug symbols, stripping them out actually makes the resultant binary bigger, rather than smaller:

-rwxr-xr-x   1 eliza  staff  4323440  6 Oct 11:19 sos_kernel
-rwxr-xr-x   1 eliza  staff  1262672  6 Oct 11:19 sos_kernel.debug
-rwxr-xr-x   1 eliza  staff  1328208  6 Oct 11:19 sos_kernel_full

Both @twisted-pear and I have literally no idea why this is happening. I suspect some kind of black magic.

hawkw avatar Oct 06 '16 15:10 hawkw

If I use x86_64-elf-objcopy -O binary sos_kernel_full sos_kernel to make a flat binary, the resultant binary file is much smaller, but the boot loader expects it to be an ELF and it breaks the boot process...

hawkw avatar Oct 06 '16 15:10 hawkw

Meanwhile, using x86_64-elf-objcopy --strip-debug also makes the kernel about 3 megs bigger...

hawkw avatar Oct 06 '16 15:10 hawkw