@@ -1642,14 +1642,16 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
1642
1642
CmdArgs.push_back (" -lSystem" );
1643
1643
1644
1644
// Select the dynamic runtime library and the target specific static library.
1645
- if (isTargetIOSBased ()) {
1646
- // If we are compiling as iOS / simulator, don't attempt to link libgcc_s.1,
1647
- // it never went into the SDK.
1648
- // Linking against libgcc_s.1 isn't needed for iOS 5.0+
1649
- if (isIPhoneOSVersionLT (5 , 0 ) && !isTargetIOSSimulator () &&
1650
- getTriple ().getArch () != llvm::Triple::aarch64)
1651
- CmdArgs.push_back (" -lgcc_s.1" );
1652
- }
1645
+ // Some old Darwin versions put builtins, libunwind, and some other stuff in
1646
+ // libgcc_s.1.dylib. MacOS X 10.6 and iOS 5 moved those functions to
1647
+ // libSystem, and made libgcc_s.1.dylib a stub. We never link libgcc_s when
1648
+ // building for aarch64 or iOS simulator, since libgcc_s was made obsolete
1649
+ // before either existed.
1650
+ if (getTriple ().getArch () != llvm::Triple::aarch64 &&
1651
+ ((isTargetIOSBased () && isIPhoneOSVersionLT (5 , 0 ) &&
1652
+ !isTargetIOSSimulator ()) ||
1653
+ (isTargetMacOSBased () && isMacosxVersionLT (10 , 6 ))))
1654
+ CmdArgs.push_back (" -lgcc_s.1" );
1653
1655
AddLinkRuntimeLib (Args, CmdArgs, " builtins" );
1654
1656
}
1655
1657
0 commit comments