[lld] r293276 - [ELF] Bypass section type check

Evgeny Leviant via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 12:03:18 PST 2017


I might have missed something, here is what was in your original e-mail:

> Please add a case similar to how we handle nobits/progbits with a comment. We
> should avoid having different behavior with or without linker scripts.

Does this mean that you want to add a check for SHT_INIT_ARRAY, just like this is done with SHT_NOBITS/SHT_PROGBITS 
in the original code. If this is what you meant (and I understand you correctly this time) it doesn't sound reasonable to me, 
because:

1) Besides SHT_INIT_ARRAY, there is also SHT_FINI_ARRAY and SHT_PREINIT_ARRAY
2) Given (1) you'll have to deal with lot of combinations of section types and somehow figure out when you should emit error or pass it through.

IMHO, it sounds more reasonable to eliminate this check at all then.
If I still don't get the idea, can you please elaborate? Thanks.
________________________________________
От: Rafael Avila de Espindola <rafael.espindola at gmail.com>
Отправлено: 27 января 2017 г. 21:45
Кому: Evgeny Leviant; llvm-commits at lists.llvm.org
Тема: Re: [lld] r293276 - [ELF] Bypass section type check

Eugene Leviant via llvm-commits <llvm-commits at lists.llvm.org> writes:

> Author: evgeny777
> Date: Fri Jan 27 05:01:43 2017
> New Revision: 293276
>
> URL: http://llvm.org/viewvc/llvm-project?rev=293276&view=rev
> Log:
> [ELF] Bypass section type check
>
> Differential revision: https://reviews.llvm.org/D28761
>
> Added:
>     lld/trunk/test/ELF/linkerscript/section-types.s
> Modified:
>     lld/trunk/ELF/LinkerScript.cpp
>     lld/trunk/ELF/OutputSections.cpp
>     lld/trunk/ELF/OutputSections.h
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/LinkerScript.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=293276&r1=293275&r2=293276&view=diff
> ==============================================================================
> --- lld/trunk/ELF/LinkerScript.cpp (original)
> +++ lld/trunk/ELF/LinkerScript.cpp Fri Jan 27 05:01:43 2017
> @@ -288,7 +288,7 @@ void LinkerScript<ELFT>::addSection(Outp
>                                      StringRef Name) {
>    OutputSectionBase *OutSec;
>    bool IsNew;
> -  std::tie(OutSec, IsNew) = Factory.create(Sec, Name);
> +  std::tie(OutSec, IsNew) = Factory.create(Sec, Name, true);
>    if (IsNew)
>      OutputSections->push_back(OutSec);
>    OutSec->addSection(Sec);
>
> Modified: lld/trunk/ELF/OutputSections.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=293276&r1=293275&r2=293276&view=diff
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.cpp (original)
> +++ lld/trunk/ELF/OutputSections.cpp Fri Jan 27 05:01:43 2017
> @@ -631,9 +631,9 @@ template <class ELFT> OutputSectionFacto
>  template <class ELFT>
>  std::pair<OutputSectionBase *, bool>
>  OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C,
> -                                   StringRef OutsecName) {
> +                                   StringRef OutsecName, bool IsScripted) {

I specifically asked for you to *not* add linker script specific
logic. Please revert.

Cheers,
Rafael


More information about the llvm-commits mailing list