summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-11-25 18:51:54 +0000
committerRui Ueyama <ruiu@google.com>2016-11-25 18:51:54 +0000
commit22375f2406156aeb4d8c20b253f367f7417fe57e (patch)
treeeb5682d3b514a6d1bb02bec7799f2f5ff4c28040
parentda06bfb7945afd242276f409368c52da683f5e9b (diff)
downloadbcm5719-llvm-22375f2406156aeb4d8c20b253f367f7417fe57e.tar.gz
bcm5719-llvm-22375f2406156aeb4d8c20b253f367f7417fe57e.zip
Remove a parameter from ScriptParser.
llvm-svn: 287944
-rw-r--r--lld/ELF/LinkerScript.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index add5b38fa63..51efa2e6ab2 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -81,6 +81,15 @@ template <class ELFT> static void addSynthetic(SymbolAssignment *Cmd) {
Cmd->Expression(0) - Sec->Addr;
}
+static bool isUnderSysroot(StringRef Path) {
+ if (Config->Sysroot == "")
+ return false;
+ for (; !Path.empty(); Path = sys::path::parent_path(Path))
+ if (sys::fs::equivalent(Config->Sysroot, Path))
+ return true;
+ return false;
+}
+
template <class ELFT> static void addSymbol(SymbolAssignment *Cmd) {
if (Cmd->Expression.IsAbsolute())
addRegular<ELFT>(Cmd);
@@ -953,8 +962,9 @@ class elf::ScriptParser final : public ScriptParserBase {
typedef void (ScriptParser::*Handler)();
public:
- ScriptParser(MemoryBufferRef MB, bool B)
- : ScriptParserBase(MB), IsUnderSysroot(B) {}
+ ScriptParser(MemoryBufferRef MB)
+ : ScriptParserBase(MB),
+ IsUnderSysroot(isUnderSysroot(MB.getBufferIdentifier())) {}
void readLinkerScript();
void readVersionScript();
@@ -1907,22 +1917,12 @@ std::vector<SymbolVersion> ScriptParser::readVersionExtern() {
return Ret;
}
-static bool isUnderSysroot(StringRef Path) {
- if (Config->Sysroot == "")
- return false;
- for (; !Path.empty(); Path = sys::path::parent_path(Path))
- if (sys::fs::equivalent(Config->Sysroot, Path))
- return true;
- return false;
-}
-
void elf::readLinkerScript(MemoryBufferRef MB) {
- StringRef Path = MB.getBufferIdentifier();
- ScriptParser(MB, isUnderSysroot(Path)).readLinkerScript();
+ ScriptParser(MB).readLinkerScript();
}
void elf::readVersionScript(MemoryBufferRef MB) {
- ScriptParser(MB, false).readVersionScript();
+ ScriptParser(MB).readVersionScript();
}
template class elf::LinkerScript<ELF32LE>;
OpenPOWER on IntegriCloud