[PATCH] D13232: ELF2: Add basic linker script support.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 20:14:37 PDT 2015


rafael added inline comments.

================
Comment at: ELF/DriverUtils.cpp:202
@@ +201,3 @@
+// Returns true if Path seems to be a linker script.
+bool isLinkerScript(llvm::StringRef Path) {
+  // Because the linker script is just a text file that has no magic bytes,
----------------
This opens a file, mmaps it, calls identify_magic and then drops everything and returns a bool :-(

Could this be reorganized into something like

addInptsForArg(StringRef Arg) {
  open file
  check type
   if (archiver or elf) {
      add it.
      return;
  }
  parse linker script. 
}

That way we only open, mmap and identify each file once.


http://reviews.llvm.org/D13232





More information about the llvm-commits mailing list