This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: about gcc & ld



>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
**********************************************************************

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]