[PATCH] D41046: [ELF] Make overlapping output sections an error

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 07:56:48 PST 2017


Alexander Richardson <arichardson.kde at gmail.com> writes:

> The reason it was so slow before is that it was comparing every
> section to every one that follows. I added a break in the nested loop
> once it can't be an overlapping section anymore so in almost every
> case (unless we actually have an overlap that nested loop will only
> run once. Removing empty ones also speeds it up quite a lot since if
> they are zero size we would have to keep comparing until the next
> non-zero size section. In this synthetic test case that would mean
> comparing almost all of them. I doubt any real binary would have
> thousands of zero size sections.

I see. I read just your comment when you added the new patch and assumed
the special case for size 0 was all that was changed.

> Should I update the many-alloc-sections.s test case to also check 1
> byte sections instead of only zero size sections to make it a bit more
> interesting?

No, that is fine.

> Furthermore, I could disable the check if there is no custom linker
> script and we can assume that the internal address assignment
> algorithm works as expected. Would that make the patch more
> acceptable?

Maybe. From my point of view it really depends on what the benchmarks
look like. It the new code is fast, and from your description it seems
to be, I would leave it running.

> I'm not sure it makes sense to check for overlapping input sections
> since the offsets should be assigned sensibly there anyway. Also there
> are way more input sections than output sections so adding a check for
> every input section (especially if you compile with
> -ffunction-sections) would add noticeable overhead even if it is just
> a very simple check.

OK. I am fine with adding the check just for output sections.

Taking another look at the patch.

Cheers,
Rafael


More information about the llvm-commits mailing list