[PATCH] D126010: Make sure the AsmPrinter doesn't emit any zero-sized symbols to `.debug_aranges`.

Patrick Walton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 16:06:18 PDT 2022


pcwalton added a comment.

Well, named zero-sized values are a first-class feature of Rust. You can write code like this:

  pub static FOO: () = ();

Or:

  struct ZeroSized;
  pub static BAR: ZeroSized = ZeroSized;

and calling `mem::size_of::<ZeroSized>()` is guaranteed by the language semantics to evaluate to zero. We want to be able to encode such values in DWARF as well so that printing them in the debugger does something sensible.

Forbidding zero-sized functions makes sense to me, but I'm not sure how we would proceed forbidding zero-sized globals without regressing working functionality.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126010



More information about the llvm-commits mailing list