[PATCH] D28561: [ELF] - Move the addition of synthetics from addPredefinedSections()

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 07:47:17 PST 2017


George Rimar <grimar at accesssoftek.com> writes:
> Honestly I did not check what gold/bfd do. I can check if you want.
> Specification says: "If the file has no section name string table, this member holds the value SHN_UNDEF" (https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-43405.html),
> and this testcase was failing because of readobj error for me.

And I think the file we are producing is invalid. It is fine to not have
a section string table, but then the sections should not have a name
(the value should be 0).

> Since readelf works fine, there was a choice either to remove that testcase or fix.
> I supposed that it is probably cleaner to support it than to report special errors, since fix looks conformant to specification and short.

I think the options are:
* Fix this to produce a valid output (no section name)
* report error.

Given how unlikely this is to show up for real, I would say we should
do whichever is simpler.

> Actually I am ok to error out this instead, but something like
> if (isDiscarded(".shstrtab"))
>   report_error()
> is not shorter or simpler it seems.

Can you check In<ELFT>::ShStrTab->OutSec?

Cheers,
Rafael


More information about the llvm-commits mailing list