[llvm-bugs] [Bug 49004] New: [PPC] Lowering of llvm.init_trampoline problem with libgcc

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 2 14:19:06 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49004

            Bug ID: 49004
           Summary: [PPC] Lowering of llvm.init_trampoline problem with
                    libgcc
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: v.churavy at gmail.com
                CC: llvm-bugs at lists.llvm.org, nemanja.i.ibm at gmail.com

@llvm.init_trampoline on PPC lowers [1] to a call to `__trampoline_setup` which
IIUC is either defined in libgcc [2] or compiler-rt [3]. As far as I can tell
`compiler-rt` doesn't implement it for powerpc64le, and libgcc has a bug in the
assembly where it checks that the passed `trampoline size` (size of the
allocated buffer) is **smaller** than the required/computed by the linker
`trampoline size`. `r8` contains the  trampoline size as calculated by the
linker, and `r4` contains the trampoline size passed in from the outside. LLVM
will always pass 48 as a value on ppc64le, whereas the calculated trampoline
size could vary and on the systems I have access to is `32`.

`libgcc` then does a:

if (r4 < r8)
  abort();

[1]
https://github.com/llvm/llvm-project/blob/ffc3e800c65ee58166255ff897f8b7e6d850ddda/llvm/lib/Target/PowerPC/PPCISelLowering.cpp#L3485
[2]
https://github.com/gcc-mirror/gcc/blob/02551aa99960ff6b0d9a44d234b8f6c9b230788c/libgcc/config/rs6000/tramp.S#L150
[3]
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/trampoline_setup.c

I haven't been able to fill a bug against libgcc since account registration is
restricted.

-- 
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/20210202/0def4128/attachment-0001.html>


More information about the llvm-bugs mailing list