This is the mail archive of the cygwin-patches@cygwin.com 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]

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


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

Attachment: pseudo-reloc.c
Description: Binary data

Attachment: cygwin-runtime-pseudo-reloc-support-3.diff
Description: Binary data

Attachment: cygwin-runtime-pseudo-reloc-support-3.ChangeLog
Description: Binary data

Attachment: pseudo-reloc-tests.tar.bz2
Description: Binary data


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