[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
Mon May 23 10:49:03 PDT 2022


pcwalton added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:3052-3054
-        if (Size == 0)
-          Size = 1;
-
----------------
dblaikie wrote:
> This might actually be a more suitable direction for zero-length entries.
> 
> Otherwise: What's a consumer going to do if they query for the address and it's not in aranges? (They then need to scan all the DWARF to find the zero-length entry at that address, losing the benefit of aranges?)
> 
> (also: what are you using aranges for? They've been off-by-default in Clang for many years now & I don't know of any particular value they have compared to using the ranges on the CUs in .debug_info directly (well, LLVM's aranges include data/non-code symbols, but GCC's don't, so it's hard for a consumer to rely on that extra data anyway) - I hope one day we can remove the support entirely)
> This might actually be a more suitable direction for zero-length entries.
> 
> Otherwise: What's a consumer going to do if they query for the address and it's not in aranges? (They then need to scan all the DWARF to find the zero-length entry at that address, losing the benefit of aranges?)
> 
> (also: what are you using aranges for? They've been off-by-default in Clang for many years now & I don't know of any particular value they have compared to using the ranges on the CUs in .debug_info directly (well, LLVM's aranges include data/non-code symbols, but GCC's don't, so it's hard for a consumer to rely on that extra data anyway) - I hope one day we can remove the support entirely)

We actually aren't using them for anything. The problem is that some tools don't cope well with invalid `.debug_aranges` tables with premature terminators, so we have to emit *something* valid. It doesn't matter what it is.


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