delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/09/19/08:02:25

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-Footer: bWFpbC5hbHRlbnB0cy5ubA==
From: =?iso-8859-1?Q?Andr=E9_Kwakernaak?= <andre DOT kwakernaak AT altenpts DOT nl>
Subject: gcc invoked from make on cygwin strips symbols from object file
To: cygwin AT cygwin DOT com
Reply-To: andre DOT kwakernaak AT altenpts DOT nl
Message-ID: <20110919120156.3862e95f@mail.altenpts.nl>
Date: Mon, 19 Sep 2011 14:01:56 +0200
X-User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p8JC2JqJ010097

cccHi all,

I'm porting an application from a Linux environment to Cygwin. During this process I encountered the following: it seems that invoking gcc from a Makefile behaves differently over gcc being invoked directly from the command line. When ggc is invoked from within a Makefile, symbols are stripped from the object file. When gcc is invoked with exactly the same arguments, the symbols remain in the object file.

I've made a small test case, narrowing the problem down.

Consider a C file containing the following:
cyg
#include <stdio.h>

void hello()

{

	printf("Hello world\n");

}

and a Makefile:
hello.o:	
	gcc -c hello.c

clean:
	rm -f *.o *.d *.exe

When I run make an object file is build. The output of "nm hello.o" displays:
00000000 b .bss
00000000 d .data
00000000 t .text

If I run "gcc -c hello.c" directly from the command line I get object file for which nm displays:
00000000 b .bss
00000000 d .data
00000000 r .rdata
00000000 t .text
00000000 T _hello
         U _printf

As you can see in the latter case the expected symbols are in the object file. Why are they missing when using the Makefile? I can't get my head around it.

I'm on Cygin 1.7.9, gcc 3.4.4, make 3.81

Any help is greatly appreciated.

André Kwakernaak

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019