[lld] r293276 - [ELF] Bypass section type check
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 27 12:23:19 PST 2017
Evgeny Leviant <eleviant at accesssoftek.com> writes:
> 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.
>
We do have to consider the various cases. I don't want to simply delete
the check and I would really like to avoid having different code path
for linker scripts unless we really don't need to.
The various types you listed could be handled with something like
const unsigned CanBeMergedToProgbits[] = {
SHT_NOBITS, /* OK, just gets allocated*/
SHT_INIT_ARRAY,
SHT_FINI_ARRAY,
SHT_PREINIT_ARRAY, /* these are not special for the dynamic linker*/
};
if (one section is progbits and another is in CanBeMergedToProgbits)
set the output type to progbits.
And all the types in the white list should be tested.
Cheers,
Rafael
More information about the llvm-commits
mailing list