1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:22:07 +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

@ -13,7 +13,7 @@
namespace Kernel {
extern "C" void syscall_handler(TrapFrame*);
extern "C" void syscall_handler(TrapFrame*) __attribute__((used));
extern "C" void syscall_asm_entry();
// clang-format off
@ -129,7 +129,7 @@ KResultOr<FlatPtr> handle(RegisterState& regs, FlatPtr function, FlatPtr arg1, F
}
void syscall_handler(TrapFrame* trap)
NEVER_INLINE void syscall_handler(TrapFrame* trap)
{
auto& regs = *trap->regs;
auto current_thread = Thread::current();