APIs referenced by global function pointer are not detected
Given a source file funptr.c
#include <stdio.h>
#include <string.h>
// Demonstrate that functions called via a function pointer are detected
// Property: strcmp and puts are present in the output
typedef int (*SW)(const char *);
typedef int (*CW)(const char *, const char *);
CW global_ptr = strcmp;
int main(int argc, const char *argv[]) {
SW ptr = puts;
int res = 0;
ptr("Hello World!");
res = global_ptr("Hello Universe!", argv[0]);
return res;
}
Running
# gcc -fplugin=fusa.so -c -o /dev/null -fplugin-arg-fusa-dump-apis=./ funptr.c
cc1: note: [FuSa] Symbol database created at: ./qualify_b848cb94c6a38ea37148c463dd4ba451a54d8c34a857af6abdb6230084e65a06.json
While puts
API is detected, strcmp
is not detected.
# cat qualify_b848cb94c6a38ea37148c463dd4ba451a54d8c34a857af6abdb6230084e65a06.json
{
"symbols":[
{
"name":"puts",
"file":"/usr/include/stdio.h",
"file-sha256":"2f9b1bd49f5c077435dbcd5c60495b8e26f1f6f16eee9302f02544885c9b2c7a",
"class_hierarchy":null,
"namespace_hierarchy":null
}
],
"version":1
}