This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: about gcc & ld
- To: 'Yu Tang' <carino at mail dot ustc dot edu dot cn>, gcc at gcc dot gnu dot org
- Subject: RE: about gcc & ld
- From: David Korn <dkorn at pixelpower dot com>
- Date: Tue, 9 Jan 2001 12:14:26 -0000
>Hi, I get my problem when I am study about ELF.
>here is a simple c program:
>---------------------------
>/* haha.c */
>#include "stdio.h"
>int main()
>{
> printf("haha\n");
>}//main
>---------------------------
>I compiled it as following steps
>#gcc -c haha.c
>#ld haha.o /usr/lib/crt0.o /usr/lib/crti.o /usr/XXX/crtbegin.o
>/usr/XXX/crtend.o -lc -o hahald
>
>And It can't work. :( [but when use #gcc haha.c -o hahagcc]
>and hahagcc works.
So try:
#gcc haha.c -o hahagcc -v
The -v flag makes gcc print out the details of the command line it passes
to all the sub-programs it invokes, including the linker. By comparing the
command line that gcc generates for ld to the one you use yourself, you'll
soon figure out the difference..
cheers,
DaveK
--
The Boulder Pledge: "Under no circumstances will I ever purchase anything
offered to me as the result of an unsolicited email message. Nor will I
forward chain letters, petitions, mass mailings, or virus warnings to large
numbers of others. This is my contribution to the survival of the online
community."
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************