[PATCH] D126257: Round up zero-sized symbols to 1 byte in `.debug_aranges`.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 17:32:34 PDT 2022


dblaikie added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:3053-3059
+        // Pretend that zero-sized symbols have length 1. The DWARF specification
+        // requires that entries in this table have nonzero lengths.
+        if (Size == 0) {
+          Expr = MCBinaryExpr::createAdd(Expr,
+                                         MCConstantExpr::create(1, Context),
+                                         Context);
+        }
----------------
dblaikie wrote:
> Does this need to be an MCExpr? Rather than a hardcoded value of `1` (which would seem simpler)?
Like what if this was just:
```
if (Span.End && Size != 0)
```
And let the existing `Size == 0 => Size = 1` handling below take it from there?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126257



More information about the llvm-commits mailing list