https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67172
Bug ID: 67172 Summary: [5/6 regression] i686-w64-mingw32 dwarf2 bootstrap fails with undefined reference to __EH_FRAME_BEGIN__ Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: breedlove.matt at gmail dot com CC: alexpux at gmail dot com, ktietz70 at googlemail dot com, mingw.android at gmail dot com Target Milestone: --- Host: i686-w64-mingw32 Target: i686-w64-mingw32 Build: i686-w64-mingw32 Created attachment 36161 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36161&action=edit Build notes, save-temps, object files GCC 5/6 branches fail to bootstrap starting with the beginning of GCC 5 releases configured as: ./configure \ --prefix=/mingw32 --with-local-prefix=/mingw32/local \ --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 \ --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include \ --libexecdir=/mingw32/lib \ --with-gxx-include-dir=/mingw32/include/c++/6.0.0 \ --enable-bootstrap \ --with-arch=i686 --with-tune=generic \ --enable-languages=c,lto,c++ \ --enable-shared --enable-static \ --enable-threads=posix \ --enable-libatomic --enable-graphite --enable-fully-dynamic-string \ --enable-libstdcxx-time=yes \ --disable-libstdcxx-pch --disable-libstdcxx-debug \ --enable-version-specific-runtime-libs \ --disable-isl-version-check \ --enable-lto --enable-libgomp --enable-checking=release \ --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers \ --with-libiconv --with-system-zlib \ --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 \ --with-gnu-as --with-gnu-ld \ --disable-sjlj-exceptions --with-dwarf2 Problem discussed here: http://sourceforge.net/p/msys2/mailman/msys2-users/thread/c48f5a81-8875-4b57-8668-d1d737c8a...@gmail.com/ The following patch reverts behavior to pre-5.0 behavior and allows building and is in active use in msys2: diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c index c737620..e5ab209 100644 --- a/libgcc/libgcc2.c +++ b/libgcc/libgcc2.c @@ -2211,7 +2211,7 @@ TRANSFER_FROM_TRAMPOLINE /* Some ELF crosses use crtstuff.c to provide __CTOR_LIST__, but use this code to run constructors. In that case, we need to handle EH here, too. */ -#ifdef __LIBGCC_EH_FRAME_SECTION_NAME__ +#ifdef EH_FRAME_SECTION_NAME #include "unwind-dw2-fde.h" extern unsigned char __EH_FRAME_BEGIN__[]; #endif @@ -2231,7 +2231,7 @@ __do_global_dtors (void) (*(p-1)) (); } #endif -#if defined (__LIBGCC_EH_FRAME_SECTION_NAME__) && !defined (HAS_INIT_SECTION) +#if defined (EH_FRAME_SECTION_NAME) && !defined (HAS_INIT_SECTION) { static int completed = 0; if (! completed) @@ -2250,7 +2250,7 @@ __do_global_dtors (void) void __do_global_ctors (void) { -#ifdef __LIBGCC_EH_FRAME_SECTION_NAME__ +#ifdef EH_FRAME_SECTION_NAME { static struct object object; __register_frame_info (__EH_FRAME_BEGIN__, &object); I've attached the build logs, -save-temps=obj output, and some additional notes. If you can't find what you need in that file, I've put what couldn't fit or probably isn't really wanted below: https://drive.google.com/file/d/0B6Y2OcAf3yVKWTRaaWxtSEJjMGM/view?usp=sharing