1// Test bolt instrumentation won't generate a binary with any segment that
2// is writable and executable. Basically we want to put `.bolt.instr.counters`
3// section into its own segment, separated from its surrounding RX sections.
4
5// REQUIRES: system-linux
6
7void foo() {}
8void bar() { foo(); }
9
10// RUN: %clang %cflags -c %s -o %t.o
11// RUN: ld.lld -q -o %t.so %t.o -shared --init=foo --fini=foo
12// RUN: llvm-bolt --instrument %t.so -o %tt.so
13// RUN: llvm-readelf -l %tt.so | FileCheck %s
14// CHECK-NOT: RWE
15// CHECK: {{[0-9]*}} .bolt.instr.counters {{$}}
16

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of bolt/test/avoid-wx-segment.c