[PATCH] D37488: [scudo] getauxval alternative for Android

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 13:59:00 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/scudo/scudo_utils.cpp:124
+# else
+uptr getHWCap() {
+  uptr F = internal_open("/proc/self/auxv", O_RDONLY);
----------------
Since you are emulating getauxval anyway, wouldn't it be more logical to do just that, define getauxval up there:

  // getauxval() was introduced with API level 18 on Android.
  # if SANITIZER_ANDROID && __ANDROID_API__ < 18
  #  include <fcntl.h>
  uptr getauxval(uptr type) {
     ...
  }
  # else
  #  include <sys/auxv.h>
  # endif

and then just use it?

  uptr HWCap = getauxval(AT_HWCAP);


https://reviews.llvm.org/D37488





More information about the llvm-commits mailing list