mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
207ea5f2e4
The golang support creates 2 new data segments, one of them contains relocations in PIC binaries, so the section must have writable rights. Currently BOLT creates only one new segment that contains new sections with RX rights, now also create RW segment if there are any new writable sections were allocated during BOLT binary processing. Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei Differential Revision: https://reviews.llvm.org/D143390
22 lines
613 B
C
22 lines
613 B
C
// This test checks that reorder-data pass puts new hot .data section
|
|
// to the writable segment.
|
|
|
|
// RUN: %clang %cflags -O3 -nostdlib -Wl,-q %s -o %t.exe
|
|
// RUN: llvm-bolt %t.exe -o %t.bolt --reorder-data=".data" \
|
|
// RUN: -data %S/Inputs/reorder-data-writable-ptload.fdata
|
|
// RUN: llvm-readelf -SlW %t.bolt | FileCheck %s
|
|
|
|
// CHECK: .bolt.org.data
|
|
// CHECK: {{.*}} .data PROGBITS [[#%x,ADDR:]] [[#%x,OFF:]]
|
|
// CHECK: LOAD 0x{{.*}}[[#OFF]] 0x{{.*}}[[#ADDR]] {{.*}} RW
|
|
|
|
volatile int cold1 = 42;
|
|
volatile int hot1 = 42;
|
|
volatile int cold2 = 42;
|
|
volatile int cold3 = 42;
|
|
|
|
void _start() {
|
|
hot1++;
|
|
_start();
|
|
}
|