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"

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   
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

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