[PATCH] D44780: [ELF] - Implement linker script OVERLAYs.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 00:44:42 PDT 2018


grimar added inline comments.


================
Comment at: ELF/ScriptParser.cpp:463
+    if (Prev)
+      OS->LMAExpr = [=] { return Prev->getLMA() + Prev->Size; };
+    else
----------------
ruiu wrote:
> grimar wrote:
> > ruiu wrote:
> > > Can't you use the same `LMAExpr` again?
> > Sorry, I did not understand what was your suggestion about using `LMAExpr` here?
> Maybe it's not just doable, but what I was wondering was whether you could repalce this line with `OS->LMAExpr = LMAExpr` or not.
Like that?

```
OutputSection *OS = readOverlaySectionDescription();
OS->AddrExpr = AddrExpr;
OS->LMAExpr = LMAExpr;
V.push_back(OS);
```

Then no, I can't, because it would cause sections to overlap, for example overlay.test would fail with:
```
error : section .out.big load address range overlaps with .out.small
>
>  >>> .out.big range is [0x4000, 0x4007]
>
>  >>> .out.small range is [0x4000, 0x4003]
>
```

It's happening because we need to assign consecutive addresses, but with the code above we would use the same start LMA
for each output section, what is wrong.


https://reviews.llvm.org/D44780





More information about the llvm-commits mailing list