[PATCH] D107784: Fix SEH table addresses for Windows

Daniel Paoliello via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 11 12:06:11 PDT 2021


dpaoliello marked an inline comment as done.
dpaoliello added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/WinException.cpp:333
 const MCExpr *WinException::getLabel(const MCSymbol *Label) {
-  if (isAArch64)
-    return MCSymbolRefExpr::create(Label, MCSymbolRefExpr::VK_COFF_IMGREL32,
----------------
rnk wrote:
> I think you've lost this ARM change unintentionally. For AArch64, we don't bias the label forward. However, that seems wrong to me based on MSVC's output:
> https://gcc.godbolt.org/z/3TxMfqoTh
> 
> MSVC inserts a `nop` instruction after the `bl` instruction implementing the call, and if I read the ip2state table correctly, the ip2state entry is the address following the nop instruction. So, I strongly suspect there is a bug here for ARM, but it's an existing problem.
> 
> You can see in the history that this code changed in 2018, we used to have a getLabelPlusOne method, but it was renamed:
> https://reviews.llvm.org/D50166
I've dug into this a bit more: ARM and ARM64 don't need the +1 as the `StateFromIp` function in the VC Runtime adjusts the input address to compensate for call-return-address issue, whereas it does not for AMD64 (probably for legacy reasons).


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

https://reviews.llvm.org/D107784



More information about the llvm-commits mailing list