
1. With a Clang that doesn't default to GNU extensions they need to be enabled explicitly. 2. The X86 directory lit config sets it already, there's no reason for this test to do it by itself. 3. The C frontend executable will fail if there's for example a Clang resource file for the C++ mode that sets C++-specific options: ``` + /home/tambre/dev/llvm/build/bin/clang --target=x86_64-unknown-linux-gnu -fPIE -fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -pie -fPIC -shared /home/tambre/dev/llvm/bolt/test/R_ABS.pic.lld.cpp -o /home/tambre/dev/llvm/build/tools/bolt/test/Output/R_ABS.pic.lld.cpp.tmp.so -Wl,-q -fuse-ld=lld clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] error: invalid argument '-std=c23' not allowed with 'C++' ```
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
// REQUIRES: system-linux
|
|
|
|
/*
|
|
* Check that llvm-bolt uses reserved space in a binary for allocating
|
|
* new sections.
|
|
*/
|
|
|
|
// RUN: %clangxx %s -o %t.exe -Wl,-q
|
|
// RUN: llvm-bolt %t.exe -o %t.bolt.exe 2>&1 | FileCheck %s
|
|
// RUN: %t.bolt.exe
|
|
|
|
// CHECK: BOLT-INFO: using reserved space
|
|
|
|
/*
|
|
* Check that llvm-bolt detects a condition when the reserved space is
|
|
* not enough for allocating new sections.
|
|
*/
|
|
|
|
// RUN: %clangxx %s -o %t.tiny.exe -Wl,--no-eh-frame-hdr -Wl,-q -DTINY
|
|
// RUN: not llvm-bolt %t.tiny.exe -o %t.tiny.bolt.exe 2>&1 | \
|
|
// RUN: FileCheck %s --check-prefix=CHECK-TINY
|
|
|
|
// CHECK-TINY: BOLT-ERROR: reserved space (1 byte) is smaller than required
|
|
|
|
#ifdef TINY
|
|
#define RSIZE "1"
|
|
#else
|
|
#define RSIZE "8192 * 1024"
|
|
#endif
|
|
|
|
asm(".pushsection .text \n\
|
|
.globl __bolt_reserved_start \n\
|
|
.type __bolt_reserved_start, @object \n\
|
|
__bolt_reserved_start: \n\
|
|
.space " RSIZE " \n\
|
|
.globl __bolt_reserved_end \n\
|
|
__bolt_reserved_end: \n\
|
|
.popsection");
|
|
|
|
int main() { return 0; }
|