diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-09-05 16:08:13 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-17 17:09:58 +0100 |
commit | a8fefd89cd2af168a2d70e24c8e0a58924394777 (patch) | |
tree | dbabae5725be669435ff44f018b8f084c51b7c60 | |
parent | 1faffc2192dab088e815f2a930993ce207e7b887 (diff) | |
download | serenity-a8fefd89cd2af168a2d70e24c8e0a58924394777.zip |
Everywhere: Make some symbols `__attribute__((used))` for LTO
With these changes, the userland builds correctly with Clang's ThinLTO
enabled.
-rw-r--r-- | Kernel/Prekernel/init.cpp | 2 | ||||
-rw-r--r-- | Kernel/init.cpp | 2 | ||||
-rw-r--r-- | Userland/DynamicLoader/main.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibC/crt0.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibC/ssp.cpp | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/Prekernel/init.cpp b/Kernel/Prekernel/init.cpp index a4e9dc7fbc..4a186c3fa7 100644 --- a/Kernel/Prekernel/init.cpp +++ b/Kernel/Prekernel/init.cpp @@ -16,7 +16,7 @@ // Defined in the linker script extern size_t __stack_chk_guard; -size_t __stack_chk_guard; +size_t __stack_chk_guard __attribute__((used)); extern "C" [[noreturn]] void __stack_chk_fail(); extern "C" u8 start_of_prekernel_image[]; diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 0de7d195e2..902da903b4 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -69,7 +69,7 @@ extern ctor_func_t start_ctors[]; extern ctor_func_t end_ctors[]; extern size_t __stack_chk_guard; -READONLY_AFTER_INIT size_t __stack_chk_guard; +READONLY_AFTER_INIT size_t __stack_chk_guard __attribute__((used)); extern "C" u8 start_of_safemem_text[]; extern "C" u8 end_of_safemem_text[]; diff --git a/Userland/DynamicLoader/main.cpp b/Userland/DynamicLoader/main.cpp index cae531a67e..b6f792b509 100644 --- a/Userland/DynamicLoader/main.cpp +++ b/Userland/DynamicLoader/main.cpp @@ -57,8 +57,8 @@ this helper program directly. extern "C" { // The compiler expects a previous declaration -void _start(int, char**, char**); -void _entry(int, char**, char**); +void _start(int, char**, char**) __attribute__((used)); +void _entry(int, char**, char**) __attribute__((used)); NAKED void _start(int, char**, char**) { diff --git a/Userland/Libraries/LibC/crt0.cpp b/Userland/Libraries/LibC/crt0.cpp index 00c900e43c..ae2b96d443 100644 --- a/Userland/Libraries/LibC/crt0.cpp +++ b/Userland/Libraries/LibC/crt0.cpp @@ -19,8 +19,8 @@ extern size_t __stack_chk_guard; int main(int, char**, char**); // Tell the compiler that this may be called from somewhere else. -int _entry(int argc, char** argv, char** env); -void _start(int, char**, char**); +int _entry(int argc, char** argv, char** env) __attribute__((used)); +void _start(int, char**, char**) __attribute__((used)); NAKED void _start(int, char**, char**) { diff --git a/Userland/Libraries/LibC/ssp.cpp b/Userland/Libraries/LibC/ssp.cpp index 434cde286d..7660151d1b 100644 --- a/Userland/Libraries/LibC/ssp.cpp +++ b/Userland/Libraries/LibC/ssp.cpp @@ -18,7 +18,7 @@ extern "C" { extern size_t __stack_chk_guard; -size_t __stack_chk_guard = (size_t)0xc6c7c8c9; +__attribute__((used)) size_t __stack_chk_guard = (size_t)0xc6c7c8c9; __attribute__((noreturn)) void __stack_chk_fail() { |