sos-os / kernel

The Stupid Operating System
Apache License 2.0
264 stars 16 forks source link

Stripping debug symbols from the kernel binary makes it bigger #45

Open hawkw opened 8 years ago

hawkw commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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