[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

as & ld equivalents of gcc



Can someone save me some time by giving me the proper options for using gcc -S to generate an absolutely minimal assembler output & listing; then as & ld that will result in a proper compile for a simple "hello world" program?

I am getting problems with this in cygwin. A simple gcc of the hello.cc works fine, but then:
gcc -S -nostartfiles -static -fverbose-asm hello.cc
(to get the absolutely minimal assembler, lacking even the crt0 startup code.)
as -ahlms=hello.s.lst -o hello.o hello.s
(to get the object code file. Now I get my problem ... Here are two tries)

$ ld hello.o
ld: warning: cannot find entry symbol _mainCRTStartup; defaulting to 00401000
hello.o(.text+0x17):hello.cc: undefined reference to `__main'
hello.o(.text+0x24):hello.cc: undefined reference to `printf'

$ ld -o ihello.o.lst -lc /lib/crt0.o hello.o
/lib/crt0.o(.text+0x39):crt0.c: undefined reference to `cygwin_crt0'
hello.o(.text+0x17):hello.cc: undefined reference to `__main'
hello.o(.text+0x24):hello.cc: undefined reference to `printf'

So, how do I get these to resolve?

Regards,

D. James



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp



Reply to: