[PATCH] D23063: [ELF] - Linkerscript: implemented SUBALIGN() command.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 13:32:08 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:287
@@ +286,3 @@
+
+      uint32_t Subalign = Cmd->SubalignExpr ? Cmd->SubalignExpr(0) : -1;
+      for (InputSectionBase<ELFT> *Sec : V) {
----------------
Alignment can never be 0 (in LLD we canonicalize 1 as 0). So how about setting Sublign to 0 if SubalignExpr is absent?

================
Comment at: ELF/LinkerScript.cpp:289
@@ +288,3 @@
+      for (InputSectionBase<ELFT> *Sec : V) {
+        if (Cmd->SubalignExpr)
+          Sec->Alignment = Subalign;
----------------
Then you can do

  if (Subalign)
    Sec->Alignment = Subalign;


https://reviews.llvm.org/D23063





More information about the llvm-commits mailing list