Hi This is [intentionally] broken C++ ABI, that was catering for a tool problem that existed in a very old Darwin toolchain.
I checked that the issue is not present after Darwin7 (using default Xcode tools). Of course, more modern tools are probably required to build trunk GCC for Darwin7, but somehow I doubt anyone has time to try that… anyway, this is long-standing breakage on all open branches. NOTE: re comment #18 in the PR, rs6000/darwin7.h is included after the generic header darwin.h, and thus it is sufficient to cover the case there. OK for trunk? open branches? Iain gcc/ * gcc/config/darwin.h (TARGET_WEAK_NOT_IN_ARCHIVE_TOC): Set to 0. Update comment. * gcc/config/rs6000/darwin7.h (TARGET_WEAK_NOT_IN_ARCHIVE_TOC): New. diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 87f610259c..974eb9fbf6 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -511,10 +511,9 @@ extern GTY(()) int darwin_ms_struct; links to, so there's no need for weak-ness for that. */ #define GTHREAD_USE_WEAK 0 -/* The Darwin linker doesn't want coalesced symbols to appear in - a static archive's table of contents. */ +/* Modern Darwin toolchains export weak symbols from archive TOCs. */ #undef TARGET_WEAK_NOT_IN_ARCHIVE_TOC -#define TARGET_WEAK_NOT_IN_ARCHIVE_TOC 1 +#define TARGET_WEAK_NOT_IN_ARCHIVE_TOC 0 /* On Darwin, we don't (at the time of writing) have linkonce sections with names, so it's safe to make the class data not comdat. */ diff --git a/gcc/config/rs6000/darwin7.h b/gcc/config/rs6000/darwin7.h index d35b65d699..85ea18e53e 100644 --- a/gcc/config/rs6000/darwin7.h +++ b/gcc/config/rs6000/darwin7.h @@ -28,5 +28,10 @@ along with GCC; see the file COPYING3. If not see %:version-compare(!< 10.3 mmacosx-version-min= -lmx)\ -lSystem}" +/* This generation of tools (specifically the archive tool) did not + export weak symbols from the TOC. */ +#undef TARGET_WEAK_NOT_IN_ARCHIVE_TOC +#define TARGET_WEAK_NOT_IN_ARCHIVE_TOC 1 + #undef DEF_MIN_OSX_VERSION #define DEF_MIN_OSX_VERSION "10.3.9" -- 2.17.1