This is the mail archive of the
mailing list for the Cygwin project.
Re: The binary "[.exe"
-----BEGIN PGP SIGNED MESSAGE-----
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 email@example.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v184.108.40.206 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html