In article <[EMAIL PROTECTED]>,
Marco van de Voort <[EMAIL PROTECTED]> wrote:
> 
> I finished the syscalls, so now I moved on the initialisation code.
> 
> To test that I try to create an empty binary, which doesn't link to libc:
> 
> I've put in an hour effort, and wrote the following C file:
> 
> int main (void) {
>  return 0;
> }
> 
> gcc -nostdlib empty.c /usr/lib/crti.o /usr/lib/crt0.o -o empty
> 
> results in:
> 
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x4f): undefined reference to `atexit'
> /usr/lib/crt1.o(.text+0x5c): undefined reference to `atexit'
> /usr/lib/crt1.o(.text+0x6f): undefined reference to `exit'

I suspect that "gcc" isn't the standard FreeBSD C compiler in your
case.  Try "which gcc" and find out.  It works fine for me on both
-stable and -current with "cc":


blake$ cc -v -nostdlib hello.c
Using builtin specs.
gcc version 2.95.2 19991024 (release)
 /usr/libexec/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -Dunix 
-D__FreeBSD__=4 -D__FreeBSD_cc_version=400004 -D__i386__ -D__unix__ -D__FreeBSD__=4 
-D__FreeBSD_cc_version=400004 -D__i386 -D__unix -Acpu(i386) -Amachine(i386) 
-Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 
-D__i386__ -D__ELF__ hello.c /tmp/cciRD216.i
GNU CPP version 2.95.2 19991024 (release) (i386 FreeBSD/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/include/g++
End of omitted list.
 /usr/libexec/cc1 /tmp/cciRD216.i -quiet -dumpbase hello.c -version -o /tmp/ccbyU216.s
GNU C version 2.95.2 19991024 (release) (i386-unknown-freebsd) compiled by GNU C 
version 2.95.2 19991024 (release).
 /usr/libexec/elf/as -v -o /tmp/ccWvs216.o /tmp/ccbyU216.s
GNU assembler version 2.9.1 (i386-unknown-freebsdelf), using BFD version 2.9.1
 /usr/libexec/elf/ld -m elf_i386 -dynamic-linker /usr/libexec/ld-elf.so.1 
-L/usr/libexec/elf -L/usr/libexec -L/usr/lib /tmp/ccWvs216.o
/usr/libexec/elf/ld: warning: cannot find entry symbol _start; defaulting to 08048074
/tmp/ccWvs216.o: In function `main':
/tmp/ccWvs216.o(.text+0xf): undefined reference to `printf'

John
-- 
  John Polstra                                               [EMAIL PROTECTED]
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to