X-Spam-Check-By: sourceware.org Message-ID: <4424C37A.8050700@byu.net> Date: Fri, 24 Mar 2006 21:13:46 -0700 From: Eric Blake User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: The binary "[.exe" References: <31DDB7BE4BF41D4888D41709C476B6570246AEAE AT NIHCESMLBX5 DOT nih DOT gov> In-Reply-To: <31DDB7BE4BF41D4888D41709C476B6570246AEAE@NIHCESMLBX5.nih.gov> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Buchbinder, Barry (NIH/NIAID) [E] on 3/24/2006 7:59 PM: > > "/bin/[ --help" gives a message while "/bin/test --help" is silent. > (Interestingly, "strings /bin/test.exe" show that "test.exe" contains > the help message.) "[ --version" give the FSF copyright notice while > "strings test.exe" does not find one. And I just traced down this difference. By default, gcc/ld do not strip out unused functions, if those functions appear in the same .o as something else that is in use. test.exe and [.exe are compiled from the same test.c source file (with different #defines to choose which one is being compiled, and therefore which functions are used), but the overall executable links in other .o's. The --help text is part of a method in test.c, so it appears in both executables, even though it is in a dead code path in test.exe; but the --version text is part of a method linked in from a different source file version-etc-fsf.c (shared among all the coreutils), and that .o was not needed to satisfy the linkage of test.exe. Hence test.exe is smaller in size, and has one but not both strings. - -- Life is short - so eat dessert first! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEJMN684KuGfSFAYARAmXrAJ0RKtje5/F5FfVSIhgrN2VxejLTcgCfRici x2VhmZs1zMbkEnyLMNNxwss= =4FwS -----END PGP SIGNATURE----- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/