[PATCH] D67152: Align output segments correctly

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 05:40:53 PDT 2019


MaskRay added inline comments.


================
Comment at: lld/ELF/Writer.cpp:2276
+    uint64_t alignment =
+        std::max<uint64_t>(os->ptLoad->p_align, config->maxPageSize);
     return alignTo(off, alignment, os->addr);
----------------
peter.smith wrote:
> Just a thought, could this be reduced to os->ptLoad->p_align? I think config->maxPageSize would already be reflected in ptLoad->p_align. I'll have a check.
It can't. p_align can be smaller than maxPageSize at this point.
I think this can be reduced if we move the code below

```
// setPhdrs
    if (p->p_type == PT_LOAD) {
      p->p_align = std::max<uint64_t>(p->p_align, config->maxPageSize);
```

to the constructor of PhdrEntry.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67152/new/

https://reviews.llvm.org/D67152





More information about the llvm-commits mailing list