1 //===---------- x86/x86_64 vdso configuration ---------------------* C++ *-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_VDSO_H 9 #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_VDSO_H 10 #include "src/__support/CPP/string_view.h" 11 #include "src/__support/OSUtil/linux/vdso_sym.h" 12 namespace LIBC_NAMESPACE_DECL { 13 namespace vdso { 14 // translate VDSOSym to symbol names 15 // On x86, there are symbols defined without the __vdso_ prefix, however, 16 // it is suggested that one should use the __vdso_ prefix. 17 // Additionally, there is also an __vdso_sgx_enter_enclave, it is for the SGX 18 // support, we do not include it here for now. 19 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/entry/vdso/vdso.lds.S 20 LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) { 21 switch (sym) { 22 case VDSOSym::ClockGetTime: 23 return "__vdso_clock_gettime"; 24 case VDSOSym::GetTimeOfDay: 25 return "__vdso_gettimeofday"; 26 case VDSOSym::GetCpu: 27 return "__vdso_getcpu"; 28 case VDSOSym::Time: 29 return "__vdso_time"; 30 case VDSOSym::ClockGetRes: 31 return "__vdso_clock_getres"; 32 default: 33 return ""; 34 } 35 } 36 37 // symbol versions 38 LIBC_INLINE constexpr cpp::string_view symbol_version(VDSOSym) { 39 return "LINUX_2.6"; 40 } 41 } // namespace vdso 42 } // namespace LIBC_NAMESPACE_DECL 43 #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_VDSO_H 44