Precise OSXCross check a little more to avoid false positives

This commit is contained in:
Thomas Pöchtrager 2020-03-22 12:47:33 +01:00
parent 6c40ead59d
commit 49b8b65f3d

View File

@ -5144,7 +5144,13 @@ void OutputFile::addDyldInfo(ld::Internal& state, ld::Internal::FinalSection* s
// Have direct reference to weak-global. This should be an indrect reference
const char* demangledName = strdup(_options.demangleSymbol(atom->name()));
// ld64-port: [OSXCROSS] Silence 'operator new[]' warning when linking GCC libsdtc++ statically
if (!getenv("OSXCROSS") || strncmp(atom->name(), "__Zna", 5)) {
const char* fileName = strrchr(target->safeFilePath(), '/');
if ( !fileName )
fileName = target->safeFilePath();
else
fileName++; // '/'
if ( !getenv("OSXCROSS_GCC_LIBSTDCXX") || strncmp(atom->name(), "__Zna", 5) || strcmp(fileName, "libstdc++.a(new_opvnt.o)") ) {
// ld64-port end
warning("direct access in function '%s' from file '%s' to global weak symbol '%s' from file '%s' means the weak symbol cannot be overridden at runtime. "
"This was likely caused by different translation units being compiled with different visibility settings.",
demangledName, atom->safeFilePath(), _options.demangleSymbol(target->name()), target->safeFilePath());