[PATCH] D61095: [AArch64][Windows] Compute function length correctly in unwind tables.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 14:59:14 PDT 2019


efriedma created this revision.
efriedma added reviewers: rnk, mstorsjo, ssijaric.
Herald added subscribers: kristof.beyls, javed.absar.
Herald added a project: LLVM.

The primary fix here is to WinException.cpp: we need to exclude jump tables when computing the length of a function, or else we fail to correctly compute the length.  (We can only compute the number of bytes consumed by certain assembler directives after the entire file is parsed. ".p2align" is one of those directives, and is used by jump table generation.)

The secondary fix, to MCWin64EH, is to make sure we don't silently miscompile if we hit a similar situation in the future.

It's possible we could extend ARM64EmitUnwindInfo to emit the length of the function using a relocation that would be resolved later in the assembler, instead of trying to resolve it immediately; this would make alignment directives work correctly. I haven't pursued that approach because I'm not sure how complicated it would be. (We would need to estimate the length somehow to implement unwind data splitting).

Hopefully fixes https://bugs.llvm.org/show_bug.cgi?id=41581 .


Repository:
  rL LLVM

https://reviews.llvm.org/D61095

Files:
  lib/CodeGen/AsmPrinter/WinException.cpp
  lib/CodeGen/AsmPrinter/WinException.h
  lib/MC/MCWin64EH.cpp
  test/CodeGen/AArch64/win64-jumptable.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61095.196523.patch
Type: text/x-patch
Size: 4999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190424/c46c8ae0/attachment.bin>


More information about the llvm-commits mailing list