Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <718D38CAB6E0D011B2C90060970C28A57E1AB8@exchangeserver.pixelpower.com> From: David Korn To: "'Mohammad Saleem'" Cc: crossgcc AT sources DOT redhat DOT com, cygwin AT cygwin DOT com Subject: RE: linking application with a library Date: Mon, 19 Nov 2001 12:00:34 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" -----Original Message----- >From: Mohammad Saleem [mailto:mosa AT enea DOT se] >Sent: 18 November 2001 11:46 Hiya Mohammad, I can see a couple of things here: >Even with link I tried with a flag --gc-sections D'oh, yes, sorry, I should have mentioned that one. >test.srec: $(OBJ) appcon.o > $(LD) --gc-sections $(LDFLAGS) $^ mylib.a $(LIBS) -o $@ But you are linking mylib.a as if it were an object file! I think it needs to be supplied with a -l flag to be treated as a library, does it not ? Try renaming mylib.a to libmylib.a (ld requires the name to be in the format libXXXX.a and then you use -lXXXX), and then try using the ld line in the makefile like > $(LD) --gc-sections $(LDFLAGS) $^ -lmylib -L. $(LIBS) -o $@ - ie we tell it that we want the library mylib, it knows then to look for 'libmylib.a', and the -L. tells it that the lib may be found in the current directory. >******************************************** >compiling appcon.c >h8300-hitachi-hms-ld: warning: no memory region specified for section `. >_init' >h8300-hitachi-hms-ld: warning: no memory region specified for section >`.configu' >h8300-hitachi-hms-ld: warning: no memory region specified for section >`.timerIn' >************************************************* This may reflect a problem with the srec format limiting the length of section name strings, but see if it goes away when you try the new flags. DaveK -- Burn your ID card! http://www.optional-identity.org.uk/ Help support the campaign, copy this into your .sig! ********************************************************************** 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 ********************************************************************** -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/