xref: /aosp_15_r20/external/llvm-libc/src/__support/OSUtil/linux/riscv/vdso.h (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1 //===---------- RISC-V 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_RISCV_VDSO_H
9 #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_RISCV_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 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/kernel/vdso/vdso.lds.S
symbol_name(VDSOSym sym)16 LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) {
17   switch (sym) {
18   case VDSOSym::RTSigReturn:
19     return "__vdso_rt_sigreturn";
20   case VDSOSym::GetTimeOfDay:
21     return "__vdso_gettimeofday";
22   case VDSOSym::ClockGetTime:
23     return "__vdso_clock_gettime";
24   case VDSOSym::ClockGetRes:
25     return "__vdso_clock_getres";
26   case VDSOSym::GetCpu:
27     return "__vdso_getcpu";
28   case VDSOSym::FlushICache:
29     return "__vdso_flush_icache";
30   case VDSOSym::RiscvHwProbe:
31     return "__vdso_riscv_hwprobe";
32   default:
33     return "";
34   }
35 }
36 
37 // symbol versions
symbol_version(VDSOSym)38 LIBC_INLINE constexpr cpp::string_view symbol_version(VDSOSym) {
39   return "LINUX_4.15";
40 }
41 } // namespace vdso
42 } // namespace LIBC_NAMESPACE_DECL
43 #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_RISCV_VDSO_H
44