PE destructors create crashes in binutils itself

"Jason A. Donenfeld" <[email protected]>
Newsgroups gmane.comp.gnu.binutils,gmane.comp.gnu.mingw.user
Message-ID <CAHmME9rwPEd9j3-2QtrusaN4RjJvjXiZ8dY7HDaRTSoKSm+KJw@mail.gmail.com>
Hey Nick,

In b0daac83, you fixed static constructors and destructors on
PE/mingw. This means that in 2.30, destructors are broken, and in
>=2.31, they're fixed. It turns out that binutils itself (ld.exe,
windres.exe, etc) crashes if linked by a binutils >=2.31. Runtime
execution works fine, but just before exiting, the program crashes and
triggers the various Windows crash detector things and exits with a
non-zero exit code.

I built a binutils 2.32 with this ugly patch --
https://xn--4db.cc/kCwLtevQ/diff . It basically re-breaks 2.32's
destructor by restoring the incorrect 2.30 behavior. (I probably could
have just deleted the destructor section from that file and
accomplished the same.) I can confirm that this "works", and using it
to build a PE binutils results in one that doesn't crash at exit for
the various utilities. Obviously this isn't a proper fix, though.

Do you have any ideas why the destructor logic in binutils itself
would be crashing on mingw/windows/PE? This is something we're running
into with the toolchains over on musl.cc.

Thanks,
Jason
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.