I am trying to test out whether the flag -fsanitize-address-outline-instrumentation
works for the LLVM Clang compiler.
Ubuntu clang version 15.0.7
I have created an exemplary program:
main.c
#include "stdio.h"
static inline void printFunc(void)
{
printf("Test string rn");
}
int main(void)
{
printFunc();
return 0;
}
I wanted to verify whether the printFunc
would be inlined or not, depeneding on whether the -fsanitize-address-outline-instrumentation
compilation flag is added. When I try to compile the file, the compiler returns during compilation:
lukasz@lp:/tmp/test$ clang main.c -o main -fsanitize-address-outline-instrumentation
clang: warning: argument unused during compilation: '-fsanitize-address-outline-instrumentation' [-Wunused-command-line-argument]
I cannot figure out why is the parameter ignored.
2
Answers
The reason it was not working is because I did not add the
-fsanitize=address
as well. So when compiled with-fsanitize=address -fsanitize-address-outline-instrumentation
it works- the generated binary has different size.However, the produced binary is actually bigger than before. So I am not sure this solves the issue.
The proper way for disabling inlining is to use the
-fno-inline-functions
. But for the inlining to even work in the first place, optimization has to be used, i.e.-O2
or-Oz
.