[llvm-bugs] [Bug 34720] New: SJLJ EH broken on x86_64

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 25 13:30:06 PDT 2017


            Bug ID: 34720
           Summary: SJLJ EH broken on x86_64
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: llvm-bugs at lists.llvm.org

While SJLJ EH was implemented for x86 in r271244 (as a fix for PR27749), it was
a bit incomplete (see https://reviews.llvm.org/D38251), and even though the
code hints of supporting x86_64 (with separate codepaths for bits == 64), it
doesn't really work on x86_64. Some x86_64 specific issues are fixed by
https://reviews.llvm.org/D38254, however two issues remain:

The __lsda field gets populated by setting the GCC_except_table* pointer into
the eax register, which truncates the pointer, since it gets matched by
MOV32ri64 for some reason. See line 91 in the diff in
https://reviews.llvm.org/D38254, where the current code generated is this:

 ; CHECK-X64: movl $[[LSDA:GCC_except_table[0-9]+]], %eax

If mov64imm32 is removed from X86InstrCompiler.td, this pointer isn't truncated
any longer.

Secondly, the jmpq call encodes a an address to the jump table as the immediate
offset in the jmpq instruction, with the base register eax used as index in the

If the address to the table doesn't fit in the 32 bit immediate, this fails.
This also is incorrect in case PIC code generation is requested (although that
isn't an issue on windows, but is an issue if you try to manually build an
x86_64 sjlj environment on e.g. linux).

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170925/83bedb7e/attachment.html>

More information about the llvm-bugs mailing list