I am building my own 32-bit x86 OS in which I load user programs from ELF files. When compiling the user programs I use -nostdlib
to exclude GLIBC and link my own LIBC instead. The problem is that by doing so, the program compiles without a _start
label, causing the entry
(defined in the ELF header) to point at the first piece of code in the file and not the actual entry of the program.
I am not sure how can I compile without the standard library but still have a valid entry point for the program.
When compiling with the -nostdlib
flag I get:
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008049000
ELF file:
Entry point address: 0x8049000
How can _start
be generated with no stdlib?
Is there a way and should I write it myself and link it at compile time with the user program?
Eylon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.