[lld] r310995 - [ELF] - Ignore -plugin-opt=-function-sections/-plugin-opt=-data-sections. NFC.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 01:09:05 PDT 2017


On Wed, Aug 16, 2017 at 12:25 AM, George Rimar via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: grimar
> Date: Wed Aug 16 00:25:09 2017
> New Revision: 310995
>
> URL: http://llvm.org/viewvc/llvm-project?rev=310995&view=rev
> Log:
> [ELF] - Ignore -plugin-opt=-function-sections/-plugin-opt=-data-sections. NFC.
>
> Clang passes this options to linker. We should ignore them,
> anyways they are always enabled by default atm.
>
> Fixes https://bugs.llvm.org/show_bug.cgi?id=34200.
>
> Modified:
>     lld/trunk/ELF/Driver.cpp
>
> Modified: lld/trunk/ELF/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=310995&r1=310994&r2=310995&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Driver.cpp (original)
> +++ lld/trunk/ELF/Driver.cpp Wed Aug 16 00:25:09 2017
> @@ -716,7 +716,8 @@ void LinkerDriver::readConfigs(opt::Inpu
>        Config->ThinLTOJobs = parseInt(S.substr(5), Arg);
>      else if (!S.startswith("/") && !S.startswith("-fresolution=") &&
>               !S.startswith("-pass-through=") && !S.startswith("mcpu=") &&
> -             !S.startswith("thinlto"))
> +             !S.startswith("thinlto") && !S.startswith("-function-sections") &&
> +             !S.startswith("-data-sections"))
>        error(Arg->getSpelling() + ": unknown option: " + S);
>    }
>

This is not quite right. `-function-sections` and `-data-sections` are
exact options so you should use equality and not `startsWith()`. Also,
this lacks a test. I'm going to commit a fix for both.

Thanks,

--
Davide


More information about the llvm-commits mailing list