[llvm-bugs] [Bug 43128] New: rbp being used as a scratch register

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 27 14:21:59 PDT 2019


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

            Bug ID: 43128
           Summary: rbp being used as a scratch register
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: ndesaulniers at google.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
            Blocks: 4068

Created attachment 22435
  --> https://bugs.llvm.org/attachment.cgi?id=22435&action=edit
x.c

>From this discussion on LKML: https://lkml.org/lkml/2019/8/27/837

it seems that clang-9 and newer are using %rbp as a scratch register in leaf
functions (regardless of -fomit-frame-pointer/-fno-omit-frame-pointer).

A custom object file validator in the kernel is warning that due to this
codegen, it may not be able to unwind correctly through leaf functions.

A test case from Arnd is attached.

$ clang -c x.c -O2 -fomit-frame-pointer
$ llvm-objdump -d x.o | grep -e rbp -e ebp -e bp -e bpl
       0: 55                            pushq   %rbp
      60: 0f b6 ef                      movzbl  %bh, %ebp
      68: 33 1c aa                      xorl    (%rdx,%rbp,4), %ebx
      73: 0f b6 ef                      movzbl  %bh, %ebp
      79: 33 1c aa                      xorl    (%rdx,%rbp,4), %ebx
      95: 5d                            popq    %rbp


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=4068
[Bug 4068] [Meta] Compiling the Linux kernel with clang
-- 
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/20190827/a059a825/attachment.html>


More information about the llvm-bugs mailing list