[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

Mathieu Desnoyers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 14:37:39 PDT 2019


compudj added a comment.

Hi,

First, thanks for working on this. I am the author of the "rseq" system call in the Linux kernel, and the user-space code required to interact with that system call requires asm goto. I therefore look forward to getting asm goto support in clang.

I tried this patch on top of current clang on the following Linux kernel rseq selftests, and it fails to build. Hopefully this feedback can help you improve the current implementation.

The kernel rseq selftests can be found at:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/rseq

from the kernel source tree (on x86-64):

make headers_install
cd tools/testing/selftests/rseq
make CC=/path/to/clang

build output:

/home/efficios/git/llvm-project/build/bin/clang -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ -shared -fPIC rseq.c -lpthread -o /home/efficios/git/linux/tools/testing/selftests/rseq/librseq.so
/home/efficios/git/llvm-project/build/bin/clang -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ basic_test.c -lpthread -lrseq -o /home/efficios/git/linux/tools/testing/selftests/rseq/basic_test
/home/efficios/git/llvm-project/build/bin/clang -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ basic_percpu_ops_test.c -lpthread -lrseq -o /home/efficios/git/linux/tools/testing/selftests/rseq/basic_percpu_ops_test
In file included from basic_percpu_ops_test.c:12:
In file included from ./rseq.h:71:
./rseq-x86.h:90:26: error: expected a symbol reference

  "cmpq %[v], %[expect]\n\t"
                         ^

<inline asm>:13:8: note: instantiated into assembly here

  jnz ""
        ^

In file included from basic_percpu_ops_test.c:12:
In file included from ./rseq.h:71:
./rseq-x86.h:102:3: error: expected a symbol reference

  RSEQ_ASM_DEFINE_ABORT(4, "", abort)
  ^

./rseq-x86.h:67:25: note: expanded from macro 'RSEQ_ASM_DEFINE_ABORT'

  __rseq_str(label) ":\n\t"                               \
                        ^

<inline asm>:20:8: note: instantiated into assembly here

  jmp ""
        ^

In file included from basic_percpu_ops_test.c:12:
In file included from ./rseq.h:71:
./rseq-x86.h:148:30: error: expected a symbol reference

  "cmpq %%rbx, %[expectnot]\n\t"
                             ^

<inline asm>:14:7: note: instantiated into assembly here

  je ""
       ^

In file included from basic_percpu_ops_test.c:12:
In file included from ./rseq.h:71:
./rseq-x86.h:164:3: error: expected a symbol reference

  RSEQ_ASM_DEFINE_ABORT(4, "", abort)
  ^

./rseq-x86.h:67:25: note: expanded from macro 'RSEQ_ASM_DEFINE_ABORT'

  __rseq_str(label) ":\n\t"                               \
                        ^

<inline asm>:24:8: note: instantiated into assembly here

  jmp ""
        ^

4 errors generated.
Makefile:22: recipe for target '/home/efficios/git/linux/tools/testing/selftests/rseq/basic_percpu_ops_test' failed
make: *** [/home/efficios/git/linux/tools/testing/selftests/rseq/basic_percpu_ops_test] Error 1


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571





More information about the cfe-commits mailing list