[PATCH] D151308: -fsanitize=function: fix alignment fault on Arm targets.

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 14:10:32 PDT 2023


MaskRay added a comment.

In D151308#4367704 <https://reviews.llvm.org/D151308#4367704>, @peter.smith wrote:

> This looks good to me. Will be worth waiting for a day to give the US time zone time to leave any comments.

Thanks!

> I note that this is also broken in -fsanitize=kcfi [*] (https://reviews.llvm.org/D135411) although fixing that is a separate patch. Would you be able to raise a github issue to cover that?

`-fsanitize=kcfi` only supports aarch64 and x86-64 now. riscv64 is on the plan.

  % fclang -fsanitize=kcfi --traget=armv7-linux-gnueabi -c a.c
  clang: error: unsupported option '--traget=armv7-linux-gnueabi'



================
Comment at: clang/lib/CodeGen/CGExpr.cpp:5381
+        llvm::Value *Mask = llvm::ConstantInt::get(IntPtrTy, ~1);
+        llvm::Value *AlignedCalleeAddress =
+            Builder.CreateAnd(CalleeAddress, Mask);
----------------
For chained operations, it may be cleaner to remove some used-once variables.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151308



More information about the cfe-commits mailing list