Allow to disable tapi (SDK tbd stub library helper) for bootstrapping. --- ld64-530/src/ld/InputFiles.cpp 2020-11-23 13:30:38.000000000 -0600 +++ ld64-530/src/ld/InputFiles.cpp.notapi 2020-11-23 13:45:34.000000000 -0600 @@ -380,10 +380,12 @@ if ( dylibResult != NULL ) { return dylibResult; } +#ifdef TAPI dylibResult = textstub::dylib::parse(p, len, info.path, info.modTime, _options, info.ordinal, info.options.fBundleLoader, indirectDylib); if ( dylibResult != NULL ) { return dylibResult; } +#endif break; case Options::kStaticExecutable: case Options::kDyld: --- ld64-530/src/ld/Options.cpp 2020-11-23 13:30:38.000000000 -0600 +++ ld64-530/src/ld/Options.cpp.notapi 2020-11-23 13:44:59.000000000 -0600 @@ -34,7 +34,9 @@ #include #include #include +#ifdef TAPI #include +#endif #include #include @@ -937,6 +939,7 @@ bool Options::findFile(const std::string &path, const std::vector &tbdExtensions, FileInfo& result) const { FileInfo tbdInfo; +#ifdef TAPI for ( const auto &ext : tbdExtensions ) { auto newPath = replace_extension(path, ext); bool found = tbdInfo.checkFileExists(*this, newPath.c_str()); @@ -945,6 +948,7 @@ if ( found ) break; } +#endif FileInfo dylibInfo; { @@ -957,6 +961,7 @@ if ( tbdInfo.missing() != dylibInfo.missing() ) { result = tbdInfo.missing() ? dylibInfo : tbdInfo; } +#ifdef TAPI // There are both - a text-based stub file and a dynamic library file. else if ( !tbdInfo.missing() && !dylibInfo.missing() ) { // Check if we should prefer the text-based stub file (env var). @@ -978,6 +983,7 @@ warning("text-based stub file %s and library file %s are out of sync. Falling back to library file for linking.", tbdInfo.path, dylibInfo.path); result = dylibInfo; } +#endif } else { return false; } @@ -4135,7 +4141,9 @@ fprintf(stderr, "LTO support using: %s (static support for %d, runtime is %d)\n", ltoVers, lto::static_api_version(), lto::runtime_api_version()); #endif +#ifdef TAPI fprintf(stderr, "TAPI support using: %s\n", tapi::Version::getFullVersionAsString().c_str()); +#endif exit(0); } } --- ld64-530/src/ld/Options.h 2019-06-14 21:33:16.000000000 -0500 +++ ld64-530/src/ld/Options.h.notapi 2020-11-23 21:24:06.000000000 -0600 @@ -28,7 +28,9 @@ #include #include +#ifdef TAPI #include +#endif #include #include