}
else {
// existing not-weak, new is not-weak
- if ( ignoreDuplicates ) {
+ if ( newAtom.section().type() == ld::Section::typeMachHeader ) {
+ warning("ignoring override of built-in symbol %s from %s", newAtom.name(), existingAtom->file()->path());
+ useNew = true;
+ }
+ else if ( existingAtom->section().type() == ld::Section::typeMachHeader ) {
+ warning("ignoring override of built-in symbol %s from %s", newAtom.name(), newAtom.file()->path());
useNew = false;
- static bool fullWarning = false;
- if ( ! fullWarning ) {
- warning("-dead_strip with lazy loaded static (library) archives "
- "has resulted in a duplicate symbol. You can change your "
- "source code to rename symbols to avoid the collision. "
- "This will be an error in a future linker.");
- fullWarning = true;
- }
- warning("duplicate symbol %s originally in %s now lazily loaded from %s",
- SymbolTable::demangle(name), existingAtom->file()->path(), newAtom.file()->path());
- }
+ }
else {
- throwf("duplicate symbol %s in %s and %s",
- SymbolTable::demangle(name), newAtom.file()->path(), existingAtom->file()->path());
+ if ( ignoreDuplicates ) {
+ useNew = false;
+ static bool fullWarning = false;
+ if ( ! fullWarning ) {
+ warning("-dead_strip with lazy loaded static (library) archives "
+ "has resulted in a duplicate symbol. You can change your "
+ "source code to rename symbols to avoid the collision. "
+ "This will be an error in a future linker.");
+ fullWarning = true;
+ }
+ warning("duplicate symbol %s originally in %s now lazily loaded from %s",
+ SymbolTable::demangle(name), existingAtom->file()->path(), newAtom.file()->path());
+ }
+ else {
+ throwf("duplicate symbol %s in %s and %s",
+ SymbolTable::demangle(name), newAtom.file()->path(), existingAtom->file()->path());
+ }
}
}
}
switch ( newAtom.definition() ) {
case ld::Atom::definitionRegular:
// replace existing tentative atom with regular one
- checkVisibilityMismatch = true;
- if ( newAtom.size() < existingAtom->size() ) {
- warning("for symbol %s tentative definition of size %llu from %s is "
- "being replaced by a real definition of size %llu from %s",
- newAtom.name(), existingAtom->size(), existingAtom->file()->path(),
- newAtom.size(), newAtom.file()->path());
+ if ( newAtom.section().type() == ld::Section::typeMachHeader ) {
+ // silently replace tentative __dso_handle with real linker created symbol
+ useNew = true;
+ }
+ else if ( existingAtom->section().type() == ld::Section::typeMachHeader ) {
+ // silently replace tentative __dso_handle with real linker created symbol
+ useNew = false;
}
- if ( newAtom.section().type() == ld::Section::typeCode ) {
- warning("for symbol %s tentative (data) defintion from %s is "
- "being replaced by code from %s", newAtom.name(), existingAtom->file()->path(),
- newAtom.file()->path());
+ else {
+ checkVisibilityMismatch = true;
+ if ( newAtom.size() < existingAtom->size() ) {
+ warning("for symbol %s tentative definition of size %llu from %s is "
+ "being replaced by a real definition of size %llu from %s",
+ newAtom.name(), existingAtom->size(), existingAtom->file()->path(),
+ newAtom.size(), newAtom.file()->path());
+ }
+ if ( newAtom.section().type() == ld::Section::typeCode ) {
+ warning("for symbol %s tentative (data) defintion from %s is "
+ "being replaced by code from %s", newAtom.name(), existingAtom->file()->path(),
+ newAtom.file()->path());
+ }
}
break;
case ld::Atom::definitionTentative: