mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-27 10:00:24 +00:00
DynamicLoader: Ensure that optimizer won't interfere with early init
This commit is contained in:
parent
01f1d2daaa
commit
19206f75ee
Notes:
sideshowbarker
2024-07-17 11:29:41 +09:00
Author: https://github.com/DanShaders Commit: https://github.com/SerenityOS/serenity/commit/19206f75ee Pull-request: https://github.com/SerenityOS/serenity/pull/24105 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/trflynn89
1 changed files with 12 additions and 0 deletions
|
@ -103,6 +103,11 @@ static ErrorOr<int> open_executable(char const* path)
|
|||
return checked_fd;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void optimizer_fence()
|
||||
{
|
||||
asm("" ::: "memory");
|
||||
}
|
||||
|
||||
void _entry(int argc, char** argv, char** envp)
|
||||
{
|
||||
char** env;
|
||||
|
@ -121,8 +126,15 @@ void _entry(int argc, char** argv, char** envp)
|
|||
}
|
||||
VERIFY(at_random_found);
|
||||
|
||||
// Make sure compiler won't move any functions calls above __stack_chk_guard initialization even
|
||||
// if their definitions somehow become available.
|
||||
optimizer_fence();
|
||||
|
||||
perform_self_relocations(auxvp);
|
||||
|
||||
// Similarly, make sure no non-offset-agnostic language features are used above this point.
|
||||
optimizer_fence();
|
||||
|
||||
// Initialize the copy of libc included statically in Loader.so,
|
||||
// initialization of the dynamic libc.so is done by the DynamicLinker
|
||||
__libc_init();
|
||||
|
|
Loading…
Reference in a new issue