This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Add aarch64 syscall optimization support
ClosedPublic

Authored by zatrazz on Aug 19 2015, 10:19 AM.

Details

Summary

This patch adds the inline syscall support for aarch64 instead of relying
on the syscall runtime function. I had to use the macro system instead of
template one (as x86_64 does) because I have hit a issue with GCC where
named register through asm were not used in template instanciation
(and it has shown on both GCC 4.8 and GCC 4.9).

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 32570.Aug 19 2015, 10:19 AM
zatrazz retitled this revision from to [compiler-rt] Add aarch64 syscall optimization support .
zatrazz updated this object.
zatrazz added reviewers: rengolin, kcc, eugenis, dvyukov.
zatrazz added a subscriber: llvm-commits.
samsonov added inline comments.
lib/sanitizer_common/sanitizer_linux.cc
102

Please add this file to lib/sanitizer_common/CMakeLists.txt

lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc
29

Any specific reason for not using u64 for argument types as we do on x86_64?

Thanks for the review, I will repost the patch with the recommend changes.

lib/sanitizer_common/sanitizer_linux.cc
102

I will add it.

lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc
29

Not really, I will change it to u64.

zatrazz updated this revision to Diff 32599.Aug 19 2015, 12:51 PM

Updated patch with recommended changes:

  • Add sanitizer_syscall_linux_aarch64.inc to lib/sanitizer_common/CMakeLists.txt
  • Use u64 on syscall wrappers
rengolin edited edge metadata.Aug 20 2015, 7:23 AM

How did you test this?

lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc
131

Some comments about this would be welcome.

The test is basically run the sanitizers tests and check for regression, since all internal syscalls will use the wrappers instead of normal syscall libc function.

lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc
131

This is the default return code Linux assumes for syscall failures (you can check on libc projects, like glibc and must, that they use the same return check value).

rengolin added inline comments.Aug 20 2015, 10:15 AM
lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc
131

I mean, on the code. :)

rengolin accepted this revision.Aug 20 2015, 11:38 AM
rengolin edited edge metadata.

Just add a brief description before internal_iserror() and LGTM. Thanks!

This revision is now accepted and ready to land.Aug 20 2015, 11:38 AM
samsonov accepted this revision.Aug 20 2015, 11:41 AM
samsonov added a reviewer: samsonov.

LGTM

lib/sanitizer_common/CMakeLists.txt
107

Please sort the file names.

zatrazz closed this revision.Aug 21 2015, 8:02 AM