Index: lib/Driver/GnuLdDriver.cpp =================================================================== --- lib/Driver/GnuLdDriver.cpp +++ lib/Driver/GnuLdDriver.cpp @@ -267,6 +267,15 @@ } static std::error_code +evaluateLinkerScriptSearchDir(ELFLinkingContext &ctx, + const script::SearchDir *searchDir) +{ + + ctx.addSearchPath(searchDir->getSearchPath()); + return std::error_code(); +} + +static std::error_code evaluateLinkerScript(ELFLinkingContext &ctx, StringRef path, raw_ostream &diag) { // Read the script file from disk and parse. @@ -281,11 +290,17 @@ return LinkerScriptReaderError::parse_error; // Evaluate script commands. - // Currently we only recognize GROUP() command. - for (const script::Command *c : script->_commands) + // Currently we only recognize a subset of the commands: + // - GROUP() + // - SEARCH_DIR() + for (const script::Command *c : script->_commands) { if (auto *group = dyn_cast(c)) if (std::error_code ec = evaluateLinkerScriptGroup(ctx, path, group, diag)) return ec; + if (auto *searchDir = dyn_cast(c)) + if (std::error_code ec = evaluateLinkerScriptSearchDir(ctx, searchDir)) + return ec; + } return std::error_code(); }