brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 2ebadfe Raw
41 lines · cpp
1// REQUIRES: system-linux2 3/*4 * Check that llvm-bolt uses reserved space in a binary for allocating5 * new sections.6 */7 8// RUN: %clangxx %s -o %t.exe -Wl,-q9// RUN: llvm-bolt %t.exe -o %t.bolt.exe 2>&1 | FileCheck %s10// RUN: %t.bolt.exe11 12// CHECK: BOLT-INFO: using reserved space13 14/*15 * Check that llvm-bolt detects a condition when the reserved space is16 * not enough for allocating new sections.17 */18 19// RUN: %clangxx %s -o %t.tiny.exe -Wl,--no-eh-frame-hdr -Wl,-q -DTINY20// RUN: not llvm-bolt %t.tiny.exe -o %t.tiny.bolt.exe 2>&1 | \21// RUN:   FileCheck %s --check-prefix=CHECK-TINY22 23// CHECK-TINY: BOLT-ERROR: reserved space (1 byte) is smaller than required24 25#ifdef TINY26#define RSIZE "1"27#else28#define RSIZE "8192 * 1024"29#endif30 31asm(".pushsection .text \n\32       .globl __bolt_reserved_start \n\33       .type __bolt_reserved_start, @object \n\34       __bolt_reserved_start: \n\35       .space " RSIZE " \n\36       .globl __bolt_reserved_end \n\37       __bolt_reserved_end: \n\38     .popsection");39 40int main() { return 0; }41