[libc-commits] [libc] [libc] implement vdso (PR #91572)
James Y Knight via libc-commits
libc-commits at lists.llvm.org
Tue Jun 4 10:16:05 PDT 2024
================
@@ -0,0 +1,52 @@
+//===---------- aarch64 vdso configuration ------------------------* C++ *-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_AARCH64_VDSO_H
+#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_AARCH64_VDSO_H
+#include "src/__support/CPP/string_view.h"
+namespace LIBC_NAMESPACE {
+namespace vdso {
+// macro definitions
+#define LIBC_VDSO_HAS_RT_SIGRETURN
+#define LIBC_VDSO_HAS_GETTIMEOFDAY
+#define LIBC_VDSO_HAS_CLOCK_GETTIME
+#define LIBC_VDSO_HAS_CLOCK_GETRES
+
+// list of VDSO symbols
+// following the order in
+// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/vdso/vdso.lds.S
+enum class VDSOSym {
----------------
jyknight wrote:
Instead of defining this enum differently for each platform, and then having defines to say which of the enum values exist, I think it'd be simpler have a single definition of the enum with enum values for all vsyms that are supported by any platform.
Then, the symbol_name() function's return value (empty vs non-empty) is all that's required to indicate non-support of the entrypoint on a given platform. Since it's a constexpr function, you can use it in 'if constexpr' etc, without the need for a separate define.
https://github.com/llvm/llvm-project/pull/91572
More information about the libc-commits
mailing list