[PATCH] D33145: Clear output section from linker script command when it's removed.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 21:56:28 PDT 2017


Dmitry Mikulin via Phabricator <reviews at reviews.llvm.org> writes:

> Index: ELF/LinkerScript.cpp
> ===================================================================
> --- ELF/LinkerScript.cpp
> +++ ELF/LinkerScript.cpp
> @@ -687,22 +687,20 @@
>    // '.' is assigned to, but creating these section should not have any bad
>    // consequeces and gives us a section to put the symbol in.
>    uint64_t Flags = SHF_ALLOC;
> -  uint32_t Type = SHT_PROGBITS;
>  
>    for (int I = 0, E = Opt.Commands.size(); I != E; ++I) {
>      auto *Cmd = dyn_cast<OutputSectionCommand>(Opt.Commands[I]);
>      if (!Cmd)
>        continue;
>      if (OutputSection *Sec = Cmd->Sec) {
>        Flags = Sec->Flags;
> -      Type = Sec->Type;
>        continue;
>      }
>  
>      if (isAllSectionDescription(*Cmd))
>        continue;
>  
> -    auto *OutSec = make<OutputSection>(Cmd->Name, Type, Flags);
> +    auto *OutSec = make<OutputSection>(Cmd->Name, SHT_PROGBITS, Flags);
>      OutSec->SectionIndex = I;
>      OutputSections->push_back(OutSec);
>      Cmd->Sec = OutSec;

I think that the change to LinkerScript.cpp is all that you need, no?

With that the created sections are never SHT_REL or SHT_RELA.

Cheers,
Rafael


More information about the llvm-commits mailing list