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

DynamicLoader+LibC: Make _start a naked function

This commit is contained in:
Hendiadyoin1 2021-07-11 15:57:56 +02:00 committed by Gunnar Beutner
parent 112c7f9a5b
commit a8d86cc533
2 changed files with 14 additions and 10 deletions

View file

@ -94,13 +94,15 @@ this helper program directly.
extern "C" { extern "C" {
// The compiler expects a previous declaration // The compiler expects a previous declaration
void _start(int, char**, char**);
void _entry(int, char**, char**); void _entry(int, char**, char**);
asm( NAKED void _start(int, char**, char**)
".globl _start\n" {
"_start:\n" asm(
"push $0\n" "push $0\n"
"jmp _entry@plt\n"); "jmp _entry@plt\n");
}
void _entry(int argc, char** argv, char** envp) void _entry(int argc, char** argv, char** envp)
{ {

View file

@ -20,12 +20,14 @@ int main(int, char**, char**);
// Tell the compiler that this may be called from somewhere else. // Tell the compiler that this may be called from somewhere else.
int _entry(int argc, char** argv, char** env); int _entry(int argc, char** argv, char** env);
void _start(int, char**, char**);
asm( NAKED void _start(int, char**, char**)
".globl _start\n" {
"_start:\n" asm(
"push $0\n" "push $0\n"
"jmp _entry@plt\n"); "jmp _entry@plt\n");
}
int _entry(int argc, char** argv, char** env) int _entry(int argc, char** argv, char** env)
{ {