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

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 01:15:08 PDT 2023


simon_tatham added a comment.

> `-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'

Sorry to contradict, but that error message only indicates that you misspelled `--target`! With Peter's test source file, these two commands generate different object files, and as Peter says, the `-fsanitize=kcfi` one includes a load from offset −4 relative to a potentially odd-valued function pointer:

  clang -O1                 --target=armv7-linux-gnueabi -c a.c   # generates a bare BX r0
  clang -O1 -fsanitize=kcfi --target=armv7-linux-gnueabi -c a.c   # generates the code shown in Peter's example above


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