[PATCH] D40063: Propagate sh_entsize out

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 08:47:06 PST 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar accepted this revision.
> grimar added a comment.
>
> LGTM.
>
>
>
> ================
> Comment at: ELF/SyntheticSections.cpp:2521
> +      // Using Entsize in here also allows us to propagate it to the synthetic
> +      // section.
>        return Sec->Name == OutsecName && Sec->Flags == MS->Flags &&
> ----------------
> In theory I believe there could be equal pieces when we merge string sections with different Entsize.
> But that is probably too synthetic and unexpected case to care about.

I don't think it is possible, but I might be missing something.

If it is not SHF_STRINGS, every piece in one section will have size X
and size Y != X in the other.

If it is SHF_STRINGS, every piece in one section will end with a X sized
null and end with a Y sized null in the other.

> ================
> Comment at: ELF/SyntheticSections.cpp:2531
>        S = Syn;
> +      Syn->Entsize = MS->Entsize;
>      } else {
> ----------------
> That is probably fine for this patch, but I find confusing that we emit SHF_MERGE flag and wrong EntSize to
> regular output. Currently we select max entrysize when adding input sections to output section.
> That does not make much sence I believe.
>
> We probably might want to drop entry size and flag when doing non-relocatable link in followups.

>From an lld organization I think it makes sense for the synthetic section
to have a entsize. What I think is odd is the logic keeping the max for
the output section. It might be best to use 0 if an output section has
input sections of different entsize.

Cheers,
Rafael


More information about the llvm-commits mailing list