[all-commits] [llvm/llvm-project] 8ecce6: Fix SEH table addresses for Windows

Daniel Paoliello via All-commits all-commits at lists.llvm.org
Fri Aug 20 12:33:04 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ecce69594b27674946d5a3ec8724afd65b9c99b
      https://github.com/llvm/llvm-project/commit/8ecce69594b27674946d5a3ec8724afd65b9c99b
  Author: Daniel Paoliello <danpao at microsoft.com>
  Date:   2021-08-20 (Fri, 20 Aug 2021)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/WinException.cpp
    M llvm/lib/CodeGen/AsmPrinter/WinException.h
    M llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll
    M llvm/test/CodeGen/X86/catchret-empty-fallthrough.ll
    M llvm/test/CodeGen/X86/seh-catchpad.ll
    M llvm/test/CodeGen/X86/seh-except-finally.ll
    M llvm/test/CodeGen/X86/seh-finally.ll
    M llvm/test/CodeGen/X86/seh-safe-div.ll

  Log Message:
  -----------
  Fix SEH table addresses for Windows

Issue Details:
The addresses for SEH tables for Windows are incorrect as 1 was unconditionally being added to all addresses. +1 is required for the SEH end address (as it is exclusive), but the SEH start addresses is inclusive and so should be used as-is.

In the IP2State tables, the addresses are +1 for AMD64 to handle the return address for a call being after the actual call instruction but are as-is for ARM and ARM64 as the `StateFromIp` function in the VC runtime automatically takes this into account and adjusts the address that is it looking up.

Fix Details:
* Split the `getLabel` function into two: `getLabel` (used for the SEH start address and ARM+ARM64 IP2State addresses) and `getLabelPlusOne` (for the SEH end address, and AMD64 IP2State addresses).

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D107784




More information about the All-commits mailing list