Skip to content

Commit a8d86cc

Browse files
Hendiadyoin1gunnarbeutner
authored andcommitted
DynamicLoader+LibC: Make _start a naked function
1 parent 112c7f9 commit a8d86cc

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Userland/DynamicLoader/main.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ this helper program directly.
9494
extern "C" {
9595

9696
// The compiler expects a previous declaration
97+
void _start(int, char**, char**);
9798
void _entry(int, char**, char**);
9899

99-
asm(
100-
".globl _start\n"
101-
"_start:\n"
102-
"push $0\n"
103-
"jmp _entry@plt\n");
100+
NAKED void _start(int, char**, char**)
101+
{
102+
asm(
103+
"push $0\n"
104+
"jmp _entry@plt\n");
105+
}
104106

105107
void _entry(int argc, char** argv, char** envp)
106108
{

Userland/Libraries/LibC/crt0.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ int main(int, char**, char**);
2020

2121
// Tell the compiler that this may be called from somewhere else.
2222
int _entry(int argc, char** argv, char** env);
23+
void _start(int, char**, char**);
2324

24-
asm(
25-
".globl _start\n"
26-
"_start:\n"
27-
"push $0\n"
28-
"jmp _entry@plt\n");
25+
NAKED void _start(int, char**, char**)
26+
{
27+
asm(
28+
"push $0\n"
29+
"jmp _entry@plt\n");
30+
}
2931

3032
int _entry(int argc, char** argv, char** env)
3133
{

0 commit comments

Comments
 (0)