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

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 01:57:36 PST 2017


arichardson added a comment.

In https://reviews.llvm.org/D41046#952044, @ruiu wrote:

> The amount of new code seems a bit overwhelming. I wonder if there's a better and simpler way of doing it. In what condition do sections overlap?
>
> We do have a check if "." doesn't rewind. Doesn't it work as a prevention for section overlapping?


The overlapping that I got happened because we explicitly assign (virtual) address 0x8000 to a section and 0x8200 to another section. 
Also I don't think overlapping load addresses can be fixed by checking for `.` not rewinding.

I can definitely reduce the amount of new code by inlining `struct AddressRange` but I felt that adding it made the code easier to understand.
Most of the new code is comments. I'm not sure I can make it much simpler while checking file offsets as well as load and virtual addresess.
I believe having this check in LLD is not only useful to catch errors in linker scripts but also to ensure that the code assigning addresses and offsets doesn't break accidentally.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41046





More information about the llvm-commits mailing list