This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The binary "[.exe"


-----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@byu.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/


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