[PATCH] D132994: [RISC-V][HWASAN] Don't explicitly load GOT entry to call hwasan mismatch routine

Alexey Baturo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 12 23:38:59 PST 2022


smd added a comment.

In D132994#3911904 <https://reviews.llvm.org/D132994#3911904>, @luismarques wrote:

> As far as I can tell from looking at the relevant psABI discussions and GNU patches, this overall approach is OK.
>
> Thinking about the specifics of the patch, what happens if you separately compile and assemble this? Does it lose the `STO_RISCV_VARIANT_CC`?

Hi Luis,

Sorry for the delayed reply.
Regarding your question from what I can tell STO_RISCV_VARIANT_CC is present in the object file if it's compiled separately, the flag is present on the symbol:

  clang -fsanitize=hwaddress -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions global.c -c -o /tmp/globals.o
  ...
  llvm-readobj -a /tmp/globals.o
  ...
    Symbol {
      Name: __hwasan_tag_mismatch_v2 (650)
      Value: 0x0
      Size: 0
      Binding: Global (0x1)
      Type: None (0x0)
      Other [ (0x80)
        STO_RISCV_VARIANT_CC (0x80)
      ]
      Section: Undefined (0x0)
    }

And I expect it's also supported by the linkers by quickly looking into existing patches.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132994



More information about the llvm-commits mailing list