CCTLib
Calling-context and data-object attribution library for Intel Pin
rec_stripped.cpp
Go to the documentation of this file.
1 // Same body as fib_deep but built with -s (symbols stripped). Validates
2 // that the classifier works on decoded CALL immediates alone -- it must
3 // NOT depend on RTN_Name/RTN_Size/anything symbol-derived. If a
4 // stripped binary regresses, cctlib collapses only when it can name
5 // the function -- exactly the kind of fragile behavior the design
6 // rejected in favor of exact-address sets.
7 #include <cstdint>
8 #include <cstdio>
9 
10 static volatile int64_t sink;
11 
12 static int64_t fib(int n) {
13  if (n < 2) return n;
14  return fib(n - 1) + fib(n - 2);
15 }
16 
17 int main(int argc, char** argv) {
18  (void)argc; (void)argv;
19  int64_t r = fib(14);
20  sink ^= r;
21  fprintf(stderr, "rec_stripped: fib(14)=%lld sink=%llx\n",
22  (long long)r, (unsigned long long)sink);
23  return r == 377 ? 0 : 1;
24 }
static int64_t fib(int n)
int main(int argc, char **argv)
static volatile int64_t sink