public inbox for
 help / color / mirror / Atom feed
* re: BFD patch to fix Mungw32 problem
@ 1999-03-11  9:18 Paul Sokolovsky
  1999-03-11 12:50 ` Mikey
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Sokolovsky @ 1999-03-11  9:18 UTC (permalink / raw)
  To: bfd, Mumit Khan


  Recently I proposed patch to workaround mingw32/win95 bug with
producing incorrect dll's. However, that patch broke handling of other
coff formats. New version explicitly applies only to PE images (format

Best regards,

^ permalink raw reply	[flat|nested] 5+ messages in thread
* BFD patch to fix Mungw32 problem
@ 1999-02-23  1:20 Paul Sokolovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Sokolovsky @ 1999-02-23  1:20 UTC (permalink / raw)
  To: bfd


   I was told that this is correct place to submit BFD patches. Here
it is with a bit of motivation.

This is a forwarded message
From: Paul Sokolovsky <>
To: Mumit Khan , DJ Delorie <>, <>
Subject: DLLs built corrupted with mingw32 hunt

===8<==============Original message text===============
Hello Mumit,

      This describes problem concerning building DLLs with mingw32 on
win95, with solution, some kind of.

      Fact: dlls, linked with native mingw32 ld on win95 in most cases
are not relocatable. The problem is in behavior of underlying lseek()
(SetFilePointer() ultimately). It sure not there when cross-compiling,
and I don't believe that NT has it - how could they get C2 for 3.51
with it in?

      External symptom is that referred dlls has garbage at the
sections paddings. I send 2 samples to Mumit if he'd like to take a
look at them. Here's a utility to check relocatabilty by practise:

#include <windows.h>

char tempname[100];

void main(int argc,char *argv[])
  HANDLE h=0,h2=0;
  if (argc!=2) {printf("Usage: check-dll-reloc <dll>\n"); exit(0);}
  if (!h) {printf("Couldn't load image '%s' at all\n",argv[1]); exit(0);}
  printf("Copying to temp '%s'\n",tempname);
  printf("Handles (load addrs) are: %x %x\n",h,h2);
  printf("Image is %srelocatable\n",h2?"":"NOT ");

    The problem itself is due win95 SetFilePointer(), when seeking
past end of file, leaving previous medium contents in areas not
explicitly written, despite POSIX saying they should be zeroed. BFD
likes such seeks, so it goes. In cygwin b20 dll was introduced workaround
for this, so its ld produces correct dll's. It's, however, would be
nice to have mingw32 self-sufficient, so I tried to fix it. I cast
aside making wrapper around lseek by analogy with cygwin because I
neither like that solution nor have idea how to implement it
correctly. Instead I found "bad" places in BFD and did workarounds there.

    Attached is patch as of bfd from cygwin b20. It's somewhat adhoc,
so changes wrapped in #ifdefs.

    With this patch dll's are ok. (If someone has this problems and
wants immediate solution, there's precompiled binary at .
It's however an alpha effort featuring bfd as dll (required) at and another
underlying library). But strip built with patched bfd still wrecks dll
off relocatability, just as cygwin b20 strip does.

Best regards,

===8<===========End of original message text===========

Best regards,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-03-27 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-11  9:18 BFD patch to fix Mungw32 problem Paul Sokolovsky
1999-03-11 12:50 ` Mikey
1999-03-27 16:08 ` BFD patch to fix Mungw32 problem (Better Solution!!) Mikey
1999-03-27 18:37 ` Mikey
  -- strict thread matches above, loose matches on Subject: below --
1999-02-23  1:20 BFD patch to fix Mungw32 problem Paul Sokolovsky

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).