diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-04-29 14:54:15 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-29 20:26:36 +0200 |
commit | 55ae52fdf81cdcc7d1bf7b883953e2639701d21b (patch) | |
tree | a0ec01f87b49f3261b5fe00344d5cc72615231cc /Kernel/Arch/x86/SafeMem.h | |
parent | b8612590984ee39d519ebf45f80e051b6f0d75bf (diff) | |
download | serenity-55ae52fdf81cdcc7d1bf7b883953e2639701d21b.zip |
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.
Diffstat (limited to 'Kernel/Arch/x86/SafeMem.h')
-rw-r--r-- | Kernel/Arch/x86/SafeMem.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Kernel/Arch/x86/SafeMem.h b/Kernel/Arch/x86/SafeMem.h index 3b984a663e..66d17fb74e 100644 --- a/Kernel/Arch/x86/SafeMem.h +++ b/Kernel/Arch/x86/SafeMem.h @@ -14,14 +14,14 @@ namespace Kernel { struct RegisterState; -[[nodiscard]] bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, void*& fault_at); -[[nodiscard]] ssize_t safe_strnlen(const char* str, size_t max_n, void*& fault_at); -[[nodiscard]] bool safe_memset(void* dest_ptr, int c, size_t n, void*& fault_at); -[[nodiscard]] Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32* var, u32 val); -[[nodiscard]] Optional<u32> safe_atomic_exchange_relaxed(volatile u32* var, u32 val); -[[nodiscard]] Optional<u32> safe_atomic_load_relaxed(volatile u32* var); -[[nodiscard]] bool safe_atomic_store_relaxed(volatile u32* var, u32 val); -[[nodiscard]] Optional<bool> safe_atomic_compare_exchange_relaxed(volatile u32* var, u32& expected, u32 val); +[[nodiscard]] bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, void*& fault_at) __attribute__((used)); +[[nodiscard]] ssize_t safe_strnlen(const char* str, size_t max_n, void*& fault_at) __attribute__((used)); +[[nodiscard]] bool safe_memset(void* dest_ptr, int c, size_t n, void*& fault_at) __attribute__((used)); +[[nodiscard]] Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32* var, u32 val) __attribute__((used)); +[[nodiscard]] Optional<u32> safe_atomic_exchange_relaxed(volatile u32* var, u32 val) __attribute__((used)); +[[nodiscard]] Optional<u32> safe_atomic_load_relaxed(volatile u32* var) __attribute__((used)); +[[nodiscard]] bool safe_atomic_store_relaxed(volatile u32* var, u32 val) __attribute__((used)); +[[nodiscard]] Optional<bool> safe_atomic_compare_exchange_relaxed(volatile u32* var, u32& expected, u32 val) __attribute__((used)); [[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_and_relaxed(volatile u32* var, u32 val) { |