http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58710
Bug ID: 58710
Summary: HAVE_GETIPINFO is incorrectly set on Mac OS X 10.4
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: misty at brew dot sh
_Unwind_GetIPInfo isn't available on Mac OS X 10.4 and older. GCC checks for
this specific case in several places to ensure it isn't used inappropriately,
but there seem to be a few issues that cause it to be used anyway. See #56811
for an example of this.
When checking for whether to use the system unwind, configure scripts
specifically check for Darwin 8 and older (see, for example, libbacktrace's
configure at L11629-11648); when Darwin 8 is encountered it explicitly sets
have_unwind_getipinfo to 0 to ensure it won't be used. However, the same
configure script also later does an independent check to see if
_Unwind_GetIPInfo is available, and this is erroneously reporting that it's
available. As a result several libraries, like libbacktrace, try to use
_UnwindGetIPInfo and the build fails at the link stage.
When I took a look at the config.log, it seems it's compiling using `-c`, so
the linker is inhibited:
configure:11652: checking for _Unwind_GetIPInfo
configure:11667: /usr/local/bin/gcc-4.4 -c -g
-Werror-implicit-function-declaration conftest.c >&5
configure:11667: $? = 0
configure:11674: result: yes
However, the specific problem on OS X 10.4 is that _Unwind_GetIPInfo isn't
exported - and so the test would only fail if the linker was invoked.
I've noticed that a few sections of GCC, such as raise-gcc.c, appear to expect
that they'll get an incorrect configure value and redefine it themselves:
#ifdef __APPLE__
/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
#undef HAVE_GETIPINFO
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
#define HAVE_GETIPINFO 1
#endif
#endif
However, this isn't done consistently, which is why other places (like
_Unwind_GetIPInfo) still try to use it.