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

Ying Yi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 13:31:12 PDT 2023


MaggieYi added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticCommonKinds.td:326
 def err_unsupported_abi_for_opt : Error<"'%0' can only be used with the '%1' ABI">;
+def err_unsupported_opt_for_execute_only_target
+    : Error<"unsupported option '%0' for the execute only target '%1'">;
----------------
MaskRay wrote:
> MaggieYi wrote:
> > MaskRay wrote:
> > > We don't need this diagnostic as a common kind (we only use it in driver).
> > > 
> > > I think we can reuse `err_drv_argument_not_allowed_with` . Though for PS5 you will get `... allowed with '-mexecute-only'` even if the user doesn't specify `-mexecute-only`, but I hope it is fine.
> > Since `err_drv_argument_not_allowed_with` is an ARM-only option, We cannot reuse it.
> `err_drv_argument_not_allowed_with` is a generic diagnostic. My point is that we don't need an extra err_unsupported_opt_for_execute_only_target.
Sorry, I mean that `-mexecute-only` is the arm-only option [[https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Options.td#L4202|Options.td#L4202]].

As you suggested that we could use `err_drv_argument_not_allowed_with` by passing `-fsanitize=function` (not `-mexecute-only`) and the target triple. For example, "error: invalid argument '-fsanitize=function' not allowed with 'x86_64-sie-ps5'". I have removed `err_unsupported_opt_for_execute_only_target.`


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

https://reviews.llvm.org/D158614



More information about the cfe-commits mailing list