Skip to content

Commit 003b48e

Browse files
authored
[BOLT][test] enable GNU extensions, use C++ compiler, remove unnecessary target (#117043)
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++' ```
1 parent 8458bbe commit 003b48e

10 files changed

+11
-11
lines changed

bolt/test/AArch64/data-at-0-offset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang %cflags -O2 -fPIE -Wl,-q -pie %s -o %t.exe
1+
// RUN: %clang %cflags -O2 -fPIE -std=gnu99 -Wl,-q -pie %s -o %t.exe
22
// RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
33
// CHECK-NOT: BOLT-WARNING: unable to disassemble instruction at offset
44

bolt/test/AArch64/double_jump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// A contrived example to test the double jump removal peephole.
22

3-
// RUN: %clang %cflags -O0 %s -o %t.exe
3+
// RUN: %clangxx %cxxflags -O0 %s -o %t.exe
44
// RUN: llvm-bolt %t.exe -o %t.bolt --peepholes=double-jumps | \
55
// RUN: FileCheck %s -check-prefix=CHECKBOLT
66
// RUN: llvm-objdump --no-print-imm-hex -d %t.bolt | FileCheck %s

bolt/test/R_ABS.pic.lld.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* with libc available.
77
* REQUIRES: system-linux
88
*
9-
* RUN: %clang %cflags -fPIC -shared %s -o %t.so -Wl,-q -fuse-ld=lld
9+
* RUN: %clangxx %cxxflags -fPIC -shared %s -o %t.so -Wl,-q -fuse-ld=lld
1010
* RUN: llvm-bolt %t.so -o %t.so.bolt --relocs
1111
*/
1212

bolt/test/X86/double-jump.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## correctly on Windows e.g. subshell execution
55
REQUIRES: shell
66

7-
RUN: %clang %cflags %p/Inputs/double_jump.cpp -o %t.exe
7+
RUN: %clangxx %cxxflags %p/Inputs/double_jump.cpp -o %t.exe
88
RUN: (llvm-bolt %t.exe --peepholes=double-jumps \
99
RUN: --eliminate-unreachable -o %t 2>&1 \
1010
RUN: && llvm-objdump -d %t --print-imm-hex --no-show-raw-insn) | FileCheck %s

bolt/test/X86/dwarf5-df-inlined-subroutine-gc-sections-range.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
; RUN: -split-dwarf-file=main.dwo -o main.o
77
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-inlined-subroutine-gc-sections-range-helper.s \
88
; RUN: -split-dwarf-file=helper.dwo -o helper.o
9-
; RUN: %clang --target=x86_64-pc-linux -fuse-ld=lld -Wl,-gc-sections -Wl,-q -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
9+
; RUN: %clang -fuse-ld=lld -Wl,-gc-sections -Wl,-q -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
1010
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections
1111
; RUN: llvm-dwarfdump --debug-addr main.exe > log.txt
1212
; RUN: llvm-dwarfdump --debug-rnglists --verbose --show-form main.dwo >> log.txt

bolt/test/X86/jmp-optimization.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## correctly on Windows e.g. unsupported parameter expansion
55
REQUIRES: shell
66

7-
RUN: %clang %cflags -O2 %S/Inputs/jmp_opt{,2,3}.cpp -o %t
7+
RUN: %clangxx %cxxflags -O2 %S/Inputs/jmp_opt{,2,3}.cpp -o %t
88
RUN: llvm-bolt -inline-small-functions %t -o %t.bolt
99
RUN: llvm-objdump -d %t.bolt --print-imm-hex | FileCheck %s
1010

bolt/test/X86/match-functions-with-call-graph.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# REQUIRES: system-linux
44
# RUN: split-file %s %t
5-
# RUN: %clang %cflags %t/main.cpp -o %t.exe -Wl,-q -nostdlib
5+
# RUN: %clangxx %cxxflags %t/main.cpp -o %t.exe -Wl,-q -nostdlib
66
# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml --profile-ignore-hash -v=1 \
77
# RUN: --dyno-stats --print-cfg --infer-stale-profile=1 --match-with-call-graph 2>&1 | FileCheck %s
88

bolt/test/pie.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## on Linux systems where the host triple matches the target.
55
REQUIRES: system-linux
66

7-
RUN: %clang %cflags -fPIC -pie %p/Inputs/jump_table_icp.cpp -o %t
7+
RUN: %clangxx %cxxflags -fPIC -pie %p/Inputs/jump_table_icp.cpp -o %t
88
RUN: llvm-bolt %t -o %t.null 2>&1 | FileCheck %s
99

1010
CHECK: BOLT-INFO: shared object or position-independent executable detected

bolt/test/runtime/X86/instrumentation-indirect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int main(int argc, char **argv) {
3838
/*
3939
REQUIRES: system-linux,bolt-runtime,lit-max-individual-test-time
4040
41-
RUN: %clang %cflags %s -o %t.exe -Wl,-q -pie -fpie
41+
RUN: %clang %cflags -D_GNU_SOURCE %s -o %t.exe -Wl,-q -pie -fpie
4242
4343
RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata \
4444
RUN: --instrumentation-wait-forks=1 --conservative-instrumentation \

bolt/test/runtime/bolt-reserved.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* new sections.
66
*/
77

8-
// RUN: %clang %s -o %t.exe -Wl,-q
8+
// RUN: %clangxx %s -o %t.exe -Wl,-q
99
// RUN: llvm-bolt %t.exe -o %t.bolt.exe 2>&1 | FileCheck %s
1010
// RUN: %t.bolt.exe
1111

@@ -16,7 +16,7 @@
1616
* not enough for allocating new sections.
1717
*/
1818

19-
// RUN: %clang %s -o %t.tiny.exe -Wl,--no-eh-frame-hdr -Wl,-q -DTINY
19+
// RUN: %clangxx %s -o %t.tiny.exe -Wl,--no-eh-frame-hdr -Wl,-q -DTINY
2020
// RUN: not llvm-bolt %t.tiny.exe -o %t.tiny.bolt.exe 2>&1 | \
2121
// RUN: FileCheck %s --check-prefix=CHECK-TINY
2222

0 commit comments

Comments
 (0)