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

            Bug ID: 45826
           Summary: using arm thumb register r7 in inline asm with -pg
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

With clang-8 or higher, I get errors about using the frame pointer register
(r7) when building the Linux kernel in thumb mode with "ftrace" enabled, which
passes '-pg', e.g.:

    arch/arm/probes/kprobes/actions-thumb.c:449:3: error: inline asm clobber
list contains reserved registers: R7 [-Werror,-Winline-asm]
                    "msr    cpsr_fs, %[oldcpsr]     \n\t"
    arch/arm/probes/kprobes/actions-thumb.c:449:3: note: Reserved registers on
the clobber list may not be preserved across the asm statement, and clobbering
them may lead to undefined behaviour.

See https://godbolt.org/z/6aVF_5 for a minmal example, also
$ echo 'void f(void) { asm("mov r7, #0" ::: "r7"); }' | clang-10
--target=arm-linux-gnueabi -O2 -funwind-tables -mthumb -pg -S -xc -
<stdin>:1:20: warning: inline asm clobber list contains reserved registers: R7
[-Winline-asm]

gcc produces the same error when I pass "-fno-omit-frame-pointer" or "-O0".

Both clang and gcc produce an error when combining "-pg" with
"-fomit-frame-pointer".

However, gcc can compile the example and the kernel source files with "-mthumb
-O2 -pg" as long as neither "-fomit-frame-pointer" nor
"-fno-omit-frame-pointer" is used.

I don't actually know which behavior is correct here, but I assume that either
clang or gcc does something wrong here. Opening the bug against clang for now
as it caused the symptom of the broken kernel configuration.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to