This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Fix build error with current LoongArch Clang
ClosedPublic

Authored by tangyouling on Nov 1 2022, 12:10 AM.

Details

Summary

Fix the following build failures:

In file included from /home/loongson/llvm-work/llvm-project/compiler-rt/lib/sanitizer_common/sanit>
llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc:27:23: error>
  register u64 a7 asm("a7") = nr;
                      ^
llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc:28:23: error>
  register u64 a0 asm("a0");                      ^

The non-prefix $ syntax in inline assembly is not supported in clang
yet (it is supported by gcc), add prefix $ to solve the problem.

Diff Detail

Event Timeline

tangyouling created this revision.Nov 1 2022, 12:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 12:10 AM
tangyouling requested review of this revision.Nov 1 2022, 12:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 12:10 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
tangyouling added a reviewer: Restricted Project.Nov 1 2022, 12:14 AM
SixWeining accepted this revision.Nov 1 2022, 2:10 AM

LGTM based on the background in D136436.

This revision is now accepted and ready to land.Nov 1 2022, 2:10 AM
xry111 added a comment.Nov 1 2022, 4:54 AM

LGTM. But I'd wait for the other's opinion before giving a formal approve.

xen0n accepted this revision.Nov 1 2022, 5:17 AM

I can confirm this doesn't affect functionality and is only for toolchain compatibility purposes.

xry111 accepted this revision.Nov 1 2022, 5:23 AM
xen0n retitled this revision from [sanitizer] Fix build errors in sanitizer_syscall_linux_loongarch64.inc to [sanitizer] Fix build error with current LoongArch Clang.Nov 1 2022, 5:24 AM
This revision was automatically updated to reflect the committed changes.