[PATCH] D38846: [ELF] - Linkerscript: fix issue with SUBALIGN.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 08:22:31 PDT 2017


grimar added inline comments.


================
Comment at: ELF/LinkerScript.cpp:405-406
       if (Sec->SubalignExpr) {
-        uint32_t Subalign = Sec->SubalignExpr().getValue();
+        uint32_t Subalign =
+            std::max((uint64_t)1, Sec->SubalignExpr().getValue());
         for (InputSectionBase *S : V)
----------------
ruiu wrote:
> You should report an error if Subalign is not a power of two.
Why ? We do not do that at other places. Isn't it the same as you wrote earlier
"you can do wrong things using linker scripts, and I don't want to focus too much on some arbitrary corner case." ?
Btw, 0 is not power of 2.


https://reviews.llvm.org/D38846





More information about the llvm-commits mailing list