46 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_VDSO_H9#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_VDSO_H10#include "src/__support/CPP/string_view.h"11#include "src/__support/OSUtil/linux/vdso_sym.h"12namespace LIBC_NAMESPACE_DECL {13namespace vdso {14// translate VDSOSym to symbol names15// 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 SGX18// 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.S20LIBC_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 case VDSOSym::GetRandom:33 return "__vdso_getrandom";34 default:35 return "";36 }37}38 39// symbol versions40LIBC_INLINE constexpr cpp::string_view symbol_version(VDSOSym) {41 return "LINUX_2.6";42}43} // namespace vdso44} // namespace LIBC_NAMESPACE_DECL45#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_X86_64_VDSO_H46