[PATCH] D148827: -fsanitize=function: support C

Mikael Holmén via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 04:28:45 PDT 2023


uabelho added a comment.

Hi,

A question: it seems like this messes with alignment on functions?
So with input program al.c:

  __attribute__((aligned(64)))
  void alignedfn(void) {
    __asm("nop");
  }
  void alignedfn2(void) {
    __asm("nop");
  }
  int main(void){}

if we compile with -fsanitize=function we get:

  -> clang al.c -o al.o -c -fsanitize=function
  -> nm al.o
  0000000000000008 T alignedfn
  0000000000000018 T alignedfn2
  0000000000000028 T main

So alignedfn and alignedfn2 doesn't seem to be aligned as we said.
Without -fsanitize=function:

  -> clang al.c -o al.o -c 
  -> nm al.o
  0000000000000000 T alignedfn
  0000000000000010 T alignedfn2
  0000000000000020 T main

I guess the data put before the functions get aligned but not the functions themselves. Should I write a ticket about this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148827



More information about the cfe-commits mailing list