Skip to content

Commit e6bff7d

Browse files
redstarIcohedron
authored andcommitted
[SystemZ][XRay] Make xray work with gcc (llvm#126154)
It seems that depending on the platform, gcc acceptts or does not accept `-mvx` without specifying an architecture actually having vector instructions. The solution which seems to work across different versions of gcc and clang is to specify the least architecture which has vector instructions. In addition, initialization of the unused variable CPU prevents a compiler warning from gcc.
1 parent a6e348f commit e6bff7d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler-rt/lib/xray/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ set(riscv64_SOURCES
111111
xray_trampoline_s390x.S
112112
)
113113
# Enable vector instructions in the assembly file.
114-
set_source_files_properties(xray_trampoline_s390x.S PROPERTIES COMPILE_FLAGS -mvx)
114+
set_source_files_properties(xray_trampoline_s390x.S PROPERTIES COMPILE_FLAGS -march=z13)
115115

116116
set(XRAY_SOURCE_ARCHS
117117
arm

compiler-rt/lib/xray/xray_tsc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ namespace __xray {
9696
inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT { return true; }
9797

9898
ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
99+
CPU = 0;
99100
#if __has_builtin(__builtin_readcyclecounter)
100101
return __builtin_readcyclecounter();
101102
#else

0 commit comments

Comments
 (0)