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

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 20:32:00 PDT 2015


ikudrin added a subscriber: ikudrin.

================
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,
----------------
rafael wrote:
> 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.
What if we remove intermediate containers like Inputs or InputFiles and just put all files into SymbolTable directly? Anyway, I'm going to suggest this change in my next patch for support --[no-]whole-archive.


http://reviews.llvm.org/D13232





More information about the llvm-commits mailing list