This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PE destructors create crashes in binutils itself
- From: "Jason A. Donenfeld" <Jason at zx2c4 dot com>
- To: binutils at sourceware dot org, Nick Clifton <nickc at redhat dot com>
- Cc: mingw-users at lists dot osdn dot me, Zach van Rijn <me at zv dot io>
- Date: Sun, 2 Jun 2019 12:54:30 +0200
- Subject: PE destructors create crashes in binutils itself
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