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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 20:23:38 PDT 2015


On Tue, Sep 29, 2015 at 8:14 PM, Rafael Ávila de Espíndola <
rafael.espindola at gmail.com> wrote:

> 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 :-(
>

Opening file a few times is probably not too that bad unless you are using
peculiar file system or anti-virus software or whatever. But yeah, I
actually felt the same when I was writing this code. I'll try to fix that.


> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150929/a37da461/attachment.html>


More information about the llvm-commits mailing list