[PATCH] D14916: ELF2: LinkerScript: lookup absolute paths under sysroot

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 10:17:14 PST 2015


ruiu added inline comments.

================
Comment at: ELF/Driver.h:59
@@ -59,1 +58,3 @@
+void readLinkerScript(llvm::BumpPtrAllocator *A, MemoryBufferRef MB,
+                      StringRef Path);
 
----------------
Can you use MemoryBufferRef::getBufferIdentifier() instead of Path?

================
Comment at: ELF/LinkerScript.cpp:31
@@ -30,3 +30,3 @@
 public:
-  LinkerScript(BumpPtrAllocator *A, StringRef S)
-      : Saver(*A), Tokens(tokenize(S)) {}
+  LinkerScript(BumpPtrAllocator *A, StringRef S, bool IsUnderSysroot)
+      : Saver(*A), Tokens(tokenize(S)), IsUnderSysroot(IsUnderSysroot) {}
----------------
"bool B" for consistency.

================
Comment at: ELF/LinkerScript.cpp:167
@@ +166,3 @@
+      SmallString<128> SysrootedPath;
+      if (sys::fs::exists((Config->Sysroot + S).toStringRef(SysrootedPath)))
+        S = Saver.save(SysrootedPath.str());
----------------
Can you separate this into two lines?

  SmallString<128> Path;
  (Config->Sysroot + S).toStringRef(Path);
  if (sys::fs::exists(Path))
    S = Path;

================
Comment at: ELF/LinkerScript.cpp:306-307
@@ +305,4 @@
+      if (sys::fs::equivalent(Config->Sysroot, Path)) {
+        IsUnderSysroot = true;
+        break;
+      }
----------------
  LinkerScript(A, MB.getBuffer(), true).run();
  return;

================
Comment at: ELF/LinkerScript.cpp:309
@@ -296,1 +308,3 @@
+      }
+  LinkerScript(A, MB.getBuffer(), IsUnderSysroot).run();
 }
----------------
  LinkerScript(A, MB.getBuffer(), false).run();


Repository:
  rL LLVM

http://reviews.llvm.org/D14916





More information about the llvm-commits mailing list