1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:28:11 +00:00

Kernel: Enable building the kernel with -flto

GCC with -flto is more aggressive when it comes to inlining and
discarding functions which is why we must mark some of the functions
as NEVER_INLINE (because they contain asm labels which would be
duplicated in the object files if the compiler decides to inline
the function elsewhere) and __attribute__((used)) for others so
that GCC doesn't discard them.
This commit is contained in:
Gunnar Beutner 2021-04-29 14:54:15 +02:00 committed by Andreas Kling
parent b861259098
commit 55ae52fdf8
9 changed files with 57 additions and 57 deletions

View file

@ -71,7 +71,7 @@ extern "C" u8* end_of_safemem_text;
extern "C" u8* start_of_safemem_atomic_text;
extern "C" u8* end_of_safemem_atomic_text;
extern "C" FlatPtr end_of_kernel_image;
extern "C" u8* end_of_kernel_image;
multiboot_module_entry_t multiboot_copy_boot_modules_array[16];
size_t multiboot_copy_boot_modules_count;
@ -85,7 +85,7 @@ static void setup_serial_debug();
// boot.S expects these functions to exactly have the following signatures.
// We declare them here to ensure their signatures don't accidentally change.
extern "C" void init_finished(u32 cpu);
extern "C" void init_finished(u32 cpu) __attribute__((used));
extern "C" [[noreturn]] void init_ap(u32 cpu, Processor* processor_info);
extern "C" [[noreturn]] void init();