How to use -nostdlib?

Peng Yu pengyu.ut@gmail.com
Thu May 14 03:19:00 GMT 2015


I tried the following commands which are supposed to work, but didn't.
Does anybody know what is wrong? Thanks.

https://blogs.oracle.com/ksplice/entry/hello_from_a_libc_free

$ cat test.c
#include <stdio.h>
int main() {
  printf("Hello World\n");
}
$ gcc -nostdlib -o test_nostdlib test.c
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
0000000000400144
/tmp/ccZBi5G9.o: In function `main':
test.c:(.text+0xa): undefined reference to `puts'
collect2: error: ld returned 1 exit status

-- 
Regards,
Peng



More information about the Gcc-help mailing list