www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/21/08:51:36

From: Jindrich Kubec <kubecj AT asw DOT cz>
Newsgroups: comp.os.msdos.djgpp
Subject: Skipping unused code while linking
Date: Thu, 21 Dec 2000 14:35:35 +0100
Organization: Video On Line
Lines: 39
Message-ID: <3A420727.B5569CF5@asw.cz>
NNTP-Posting-Host: lion.asw.cz
Mime-Version: 1.0
X-Trace: news.vol.cz 977405741 78968 195.250.145.21 (21 Dec 2000 13:35:41 GMT)
X-Complaints-To: sysadmin AT vol DOT cz
NNTP-Posting-Date: 21 Dec 2000 13:35:41 GMT
X-Mailer: Mozilla 4.51 [en] (Win95; U)
X-Accept-Language: cs,en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello!

I have two modules:
a.cpp:
char* a();

int main(int argc, char* argv[])
{
	a();
	return 0;
}

b.cpp:
char* a()
{
	char* c = "fn_a";
	c++;
	return c;
}

char* b()
{
	char* c = "fn_b";
	c++;
	return c;
}

When compiled with DJGPP, the executable consists of all the three
functions, even when 'b' is unused.
Under MSVC it consists only of 'main' and 'a' functions. If I got it
right, they are producing one .text sections for each function while
compiling and the linker uses only 'needed' sections.

Is this possible with DJGPP (or with any other DOS/W32 GCC based
compiler?)

-- 
Jindroush <kubecj AT asw DOT cz>
See http://www.asw.cz/~kubecj for Atari 8bit utils!

- Raw text -


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