ld non-relocatable
Charles Wilson
cwilson@ece.gatech.edu
Mon Jul 23 14:22:00 GMT 2001
Robert Collins wrote:
> Concept-patch. It removes the .reloc section quite happily.
>
> I don't know whether this will produce faster code - as all the relocation
> logic is presumably still in the machinecode. However, it should guarantee
> fork() :].
>
> Charles - care to add this to your testing pile? The new
> parameter --no-relocate needs to be added to the cygwin .dll link line (for
> somewhat obvious reasons :]).
>
No good. The --no-relocate switch has exactly the same effect as
'objcopy -R .reloc': they both strip ONLY the relocation info and not
the debugging stuff. However, when you do that, and try to run an
executable, you get the following popup:
The application or DLL <path to dll> is not a valid Windows image.
Please check this against your installation diskette.
There seems to be some tie between the debug info and the reloc stuff --
you need both or neither, it seems. Since 'strip -g' will remove the
debugging info (but not symbols nor reloc), it is interesting that the
following works:
original cygz.dll (contains symbols, debugging info, and .reloc)
strip -g cygz.dll (removes ONLY debugging info)
objcopy -R .reloc cygz.dll (removes ONLY .reloc info)
executables still work.
original cygz.dll (contains symbols, debuggin info, and .reloc)
strip -R .reloc cygz.dll (removes symbols, AND debugging info, AND .reloc)
executables still work.
original cygz.dll (contains symbols, debuggin info, and .reloc)
objcopy -R .reloc cygz.dll (removes ONLY .reloc info)
executables break
strip -g cygz.dll (removes ONLY debug info; symbols are still there)
executables work
Note that these behaviors are the same if you start with a
--no-relocations dll:
cygz.dll (+symbols, +debuggin, but --no-relocations flag was used)
executables break
strip -g cygz.dll (removes ONLY debug info; symbols are still there)
executables work
I think -- and this is just a guess -- that somehow the debugging info
is tied in to the relocations. In the same way that there is no point to
stripping symbols from a dll but leaving the debug info. That is, using
strip you can, with standard options (-g, -S, etc):
remove symbols and debug info
remove just debug info
but can't
remove just symbols and leave debug info
In this example, it makes sense -- what goes is the debug info if the
symbol table is missing? It can't be used.
I wonder if the .reloc stuff is similar...no, that can't be true, based
on my earlier experiments with MSVC/link's /fixed switch. The DLL's
generated that way HAVE symbols. HAVE debug info. DON'T have relocs.
But executables work.
Hmmm...
BTW, all tests above were performed with --disable-auto-imports. One
thing at a time.
--Chuck
More information about the Cygwin-apps
mailing list