https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67172

--- Comment #5 from Matt Breedlove <breedlove.matt at gmail dot com> ---
On previous builds, you could have DWARF2_UNWIND_INFO be defined and have
EH_FRAME_SECTION_NAME undefined within libgcc2.c (the section name was still
defined within cygming-crtbegin.c - crtbegin.o).  When compiling,
EH_FRAME_SECTION_NAME ends up defined while building libgcc's crtbegin.o while
it was undefined during libgcc2.c preventing that extern from being emitted.

Now, it is instead tied to __LIBGCC_EH_FRAME_SECTION_NAME__ which is primarily
tied to DWARF2_UNWIND_INFO and part of a large amount of definitions common to
both cygwin and mingw most of which I don't know the significance of.  Using
the new builtin causes the definition to be synchronized between crtbegin and
libgcc2.c which not emits an undefined extern which fails to link.

It's not a question of whether it should be reverted or not (the patch merely
returned to prior behavior until a proper fix), but rather where and how it has
to be changed.  You can't simply undefine it within a target-section because
defaults.h gets pulled into c-cppbuiltin.c right beforehand which then
redefines it.  There are also blocks which use DWARF2_UNWIND_INFO as a check
before attempting to use it which would break those as well.  I'm still waiting
for input from Kai or someone more familiar with how the target should be
configured.  You're right though; some sort of change needs to happen there,
but I don't know enough about the target's dwarf2 implementation to say what
especially when other parts of the code rely on the set of definitions that
make-up the following block of code in defaults.h that both decides to define
it first or ultimately redefines it if we were to undefine it along the way.

/* If we have named sections, and we're using crtstuff to run ctors,
   use them for registering eh frame information.  */
#if defined (TARGET_ASM_NAMED_SECTION) && DWARF2_UNWIND_INFO \
    && !defined (EH_FRAME_IN_DATA_SECTION)
#ifndef EH_FRAME_SECTION_NAME
#define EH_FRAME_SECTION_NAME ".eh_frame"
#endif
#endif

Reply via email to