public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: egor duda <deo@logos-m.ru>
To: Charles Wilson <cwilson@ece.gatech.edu>
Cc: cygwin@cygwin.com
Subject: Re: binutils with Egor's patch [was: Re: [ANNOUNCEMENT] New package: guile-1.5.6-3]
Date: Thu, 11 Jul 2002 04:03:00 -0000	[thread overview]
Message-ID: <164320736084.20020711112726@logos-m.ru> (raw)
In-Reply-To: <3D2D079C.9040705@ece.gatech.edu>

Hi!

CW> Charles Wilson wrote:

>> Christopher Faylor wrote:
>>> Should I make a "test" version of binutils available with Egor's patch?
>>>
>>> Oh wait.  It needs a new version of cygwin1.dll first.  I guess we have
>>> to release it as 1) cygwin and 2) binutils.
>>
>> Err, not really.
>> 
>> I can test his patched binutils under stock 1.3.12-2. That is, I can 
>> build a library with struct FOO_struct my_array[].  I can successfully 
>> build a client that accesses my_array[3].bob, and the runtime 
>> pseudo-relocation works just fine.
>> 
>> As long as my client doesn't fork().
>> 
>> The reason for the cygwin patches, is so that the above works after a 
>> fork(), because the runtime pseudo-relocs have to be redone in the 
>> child.  I think.
>> 
>> So, the worst that could happen if you release a patched binutils but 
>> not cygwin, is that
>>   1) IF some one exercised this feature
>>   2) and they fork()
>>   3) then it will break.
>> But all existing working code will continue to work -- since with 
>> existing binutils we can't even LINK code that might exercise the feature.

Absolutely right.

>> So, worst case: some new code (that currently doesn't work) might
>> continue to not work -- except right now it's a build error; it'll 
>> become a runtime error (but only in fork()ed children).
>> 
>> Right, Egor?
>> 
>> Anyway, I think you should go ahead with a test release of binutils 
>> *before* a new cygwin release.

Ok, i'll try to clarify. The plan i suppose we should follow is.

0) Wait for all legal paperwork to be done.
1) Release patched binutils.
  By default they are not using pseudo-relocations, so everything
should work as before.
2) Wait for some time until dust settles.
3) Patch cygwin and mingw runtimes to add 'relocator' function.
  I'll look if it's possible to move all initialization stuff to
cygwin1.dll, as Chris suggested, so crt0.o is not changed.
4) Repeat step 2. :)
5) Start to update packages which want to use this feature.
6) Repeat step 2. :)
7) Patch binutils to make --enable-runtime-pseudo-reloc default.

We can also swap steps 1 and 3, i.e. release patched cygwin and/or
mingw first. This will require a tiny patch to binutils so that ld's
linker script define __RUNTIME_PSEUDO_RELOC_LIST__ and
__RUNTIME_PSEUDO_RELOC_LIST_END__ as, say, zeroes, or any other equal
addresses. In this case call to relocator will do nothing until we
release fully-patched binutils and someone uses pseudo relocations.

Now about that fork() stuff:

My test example has 2 'branches'. First one is for testing with
updated runtimes which support pseudo relocations, and second one,
which uses "manual" relocation code by implementing relocator inside
of application code calling it in the first line of 'main()'.
Chuck is right that every instance of program which uses pseudo
relocations (including forked child) should be fixed up at startup.
Actually, one can add call to _pei386_runtime_relocator in every place
in program where fork () returns 0, and manual relocation will work
fine there. You can try this:

--- crtest.c    Thu Jul 11 11:12:36 2002
+++ crtest.c.new        Thu Jul 11 11:11:51 2002
@@ -50,5 +50,5 @@ main ()
                              &__RUNTIME_PSEUDO_RELOC_LIST_END__);
 #endif
-#if defined(RUNTIME_PSEUDO_RELOC_SUPPORT) && defined(HAVE_FORK)
+#if defined(HAVE_FORK)
   switch (pid = fork ())
     {
@@ -57,4 +57,8 @@ main ()
       break;
     case 0:
+#if !defined(RUNTIME_PSEUDO_RELOC_SUPPORT)
+      _pei386_runtime_relocator (&__RUNTIME_PSEUDO_RELOC_LIST__,
+                                 &__RUNTIME_PSEUDO_RELOC_LIST_END__);
+#endif
       printf ("child: ");
       print_data ();

But adding "manual" relocator is supposed to to be done for testing
purposes only. Polluting package sources with such stuff is probably
not what we want.

Egor.            mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

      parent reply	other threads:[~2002-07-11  7:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fzystrvz.fsf@peder.flower>
2002-07-10 14:25 ` [ANNOUNCEMENT] New package: guile-1.5.6-3 Steven O'Brien
2002-07-10 14:42   ` Charles Wilson
2002-07-10 21:19     ` Christopher Faylor
2002-07-10 22:27       ` Charles Wilson
2002-07-11  0:28         ` binutils with Egor's patch [was: Re: [ANNOUNCEMENT] New package: guile-1.5.6-3] Charles Wilson
2002-07-11  2:41           ` Christopher Faylor
2002-07-11  4:03           ` egor duda [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164320736084.20020711112726@logos-m.ru \
    --to=deo@logos-m.ru \
    --cc=cwilson@ece.gatech.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).