[PATCH] D158614: [UBSan] Disable the function sanitizer on an execute-only target.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 18:54:02 PDT 2023


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: clang/lib/Basic/Sanitizers.cpp:126
+  // execute-only output (no data access to code sections).
+  if (const llvm::opt::Arg *A =
+          Args.getLastArg(clang::driver::options::OPT_mexecute_only,
----------------
MaskRay wrote:
> The idiom is `hasFlag(clang::driver::options::OPT_mexecute_only, clang::driver::options::OPT_mno_execute_only, false)`
`return Args.hasFlag(clang::driver::options::OPT_mexecute_only ...`


================
Comment at: clang/test/Driver/fsanitize.c:986
+// CHECK-UBSAN-FUNCTION-DAG: error: invalid argument '-fsanitize=function' not allowed with {{('x86_64-sie-ps5'|'armv6t2-unknown-unknown-eabi')}}
+// CHECK-UBSAN-UNDEFINED-NOT: error: invalid argument '-fsanitize=function' not allowed with {{('x86_64-sie-ps5'|'armv6t2-unknown-unknown-eabi')}}
+// CHECK-UBSAN-UNDEFINED: "-fsanitize={{((alignment|array-bounds|bool|builtin|enum|float-cast-overflow|integer-divide-by-zero|nonnull-attribute|null|pointer-overflow|return|returns-nonnull-attribute|shift-base|shift-exponent|signed-integer-overflow|unreachable|vla-bound),?){17}"}}
----------------
Delete this `-NOT`. `%clang` returning 0 implies that there is no error.


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

https://reviews.llvm.org/D158614



More information about the llvm-commits mailing list