--enable-runtime-pseudo-reloc support in cygwin, take 3.

egor duda deo@logos-m.ru
Mon Dec 2 02:31:00 GMT 2002


Hi!

Tuesday, 19 November, 2002 egor duda deo@logos-m.ru wrote:

ed> Tuesday, 19 November, 2002 Christopher Faylor cygwin@cygwin.com wrote:

CF>> I've made a new version of binutils available for download.  This is
CF>> just a refresh from sources.redhat.com.  A notable change is the
CF>> addition of Egor Duda's --enable-runtime-pseudo-reloc option which
CF>> allows almost transparent linking of dll's without the need of a def
CF>> file.  However, this option requires functionality in the cygwin DLL
CF>> which is not yet present.  Stay tuned.

ed> Ok, it's time to revive a discussion about implementation of
ed> pseudo-relocations in runtime. So far, there were 3 propositions:

ed> 1. Implement everything in application (in crt0.o)
ed> Benefits: Will work with any version of cygwin1.dll. All problems with
ed> lack of support from runtime are detected during application linking.
ed> (Possibly) common code with mingw.
ed> Drawbacks: Will require rebuilding application in case we'll want
ed> change something.

ed> 2. Implement everything in cygwin1.dll. In this case application is
ed> about to have an external reference to _pei386_runtime_relocator.
ed> Benefits: Easy to change relocation semantics without relinking
ed> application.
ed> Drawbacks: GUI window popping up when "new" application is loaded with
ed> "old" runtime. Lack of support is detected only at application
ed> startup.

ed> 3. Implement actual relocation in dll, and call it from crt0 via
ed> cygwin_internal(). Check dll api version and print error message if
ed> runtime is too old.
ed> Benefits: Easy to change relocation semantics without relinking
ed> application.
ed> Drawbacks: Lack of support is detected only at application
ed> startup.
ed> Question: How can one distinguish console application from GUI one?
ed> What is the best wording for the error message?

ed> My own preference list (from most preferable to least preferable) is:
ed> 1st, then 3rd, then 2nd.

Ok, here's the patch to implement #1 (i.e. link all pseudo-reloc-
related code statically to the binary).

2002-12-02  Egor Duda <deo@logos-m.ru>

        * cygwin/lib/pseudo-reloc.c: New file.
        * cygwin/cygwin.sc: Add symbols to handle runtime pseudo-relocs.
        * cygwin/lib/_cygwin_crt0_common.cc: Perform pseudo-relocs during
        initialization of cygwin binary (.exe or .dll).

Also attached are the tests to check if everything works for application
importing data from dll and for dll importing data from other dll.

Egor.            mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pseudo-reloc.c
Type: application/octet-stream
Size: 936 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20021202/69518de6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-runtime-pseudo-reloc-support-3.diff
Type: application/octet-stream
Size: 1366 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20021202/69518de6/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-runtime-pseudo-reloc-support-3.ChangeLog
Type: application/octet-stream
Size: 262 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20021202/69518de6/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pseudo-reloc-tests.tar.bz2
Type: application/octet-stream
Size: 1924 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20021202/69518de6/attachment-0003.obj>


More information about the Cygwin-patches mailing list