-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] implement vdso #91572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] implement vdso #91572
Changes from all commits
9673650
fad0a8e
7975840
fce9d12
9c0668d
2a43d7e
4d93cc0
a575ca9
5dc4737
9852d54
ad62a03
4aead1e
347c1f7
16f7426
1614d0f
6e90bcd
66a7e5b
a0110ea
4baa641
b0462dd
4e48674
6705345
37644c9
6478047
3fefec5
a275cb8
db4ccf5
2e158fc
cca6647
9017884
56fe811
18b0fd9
df58616
fc42ae6
f5ec229
3031d4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Definition of macros from link.h ----------------------------------===// | ||
// | ||
// 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_HDR_LINK_MACROS_H | ||
#define LLVM_LIBC_HDR_LINK_MACROS_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-macros/link-macros.h" | ||
|
||
#else // Overlay mode | ||
|
||
#include <link.h> | ||
|
||
#endif // LLVM_LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_LINK_MACROS_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Definition of macros from sys/auxv.h ------------------------------===// | ||
// | ||
// 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_HDR_SYS_AUXV_MACROS_H | ||
#define LLVM_LIBC_HDR_SYS_AUXV_MACROS_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-macros/sys-auxv-macros.h" | ||
|
||
#else // Overlay mode | ||
|
||
#include <sys/auxv.h> | ||
|
||
#endif // LLVM_LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_SYS_AUXV_MACROS_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//===---------- 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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should also include the top level vdso header ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would make a recursive include chain, which is not good. (it wouldn't actually infinitely recurse because of header guards, but it's still a bad idea). Perhaps instead these arch/vdso.h files should be renamed to ".inc" and be without header guards, to show that they're not intended to be standalone headers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we can refactor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 3031d4a |
||
#include "src/__support/OSUtil/linux/vdso_sym.h" | ||
namespace LIBC_NAMESPACE_DECL { | ||
namespace vdso { | ||
// translate VDSOSym to symbol names | ||
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/vdso/vdso.lds.S | ||
LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) { | ||
switch (sym) { | ||
case VDSOSym::RTSigReturn: | ||
return "__kernel_rt_sigreturn"; | ||
case VDSOSym::GetTimeOfDay: | ||
return "__kernel_gettimeofday"; | ||
case VDSOSym::ClockGetTime: | ||
return "__kernel_clock_gettime"; | ||
case VDSOSym::ClockGetRes: | ||
return "__kernel_clock_getres"; | ||
default: | ||
return ""; | ||
} | ||
} | ||
|
||
// symbol versions | ||
LIBC_INLINE constexpr cpp::string_view symbol_version(VDSOSym) { | ||
return "LINUX_2.6.39"; | ||
} | ||
} // namespace vdso | ||
} // namespace LIBC_NAMESPACE_DECL | ||
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_AARCH64_VDSO_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//===---------- arm 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_ARM_VDSO_H | ||
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_ARM_VDSO_H | ||
#include "src/__support/CPP/string_view.h" | ||
#include "src/__support/OSUtil/linux/vdso_sym.h" | ||
namespace LIBC_NAMESPACE_DECL { | ||
namespace vdso { | ||
// translate VDSOSym to symbol names | ||
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/vdso/vdso.lds.S | ||
LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) { | ||
switch (sym) { | ||
case VDSOSym::ClockGetTime: | ||
return "__vdso_clock_gettime"; | ||
case VDSOSym::GetTimeOfDay: | ||
return "__vdso_gettimeofday"; | ||
case VDSOSym::ClockGetRes: | ||
return "__vdso_clock_getres"; | ||
case VDSOSym::ClockGetTime64: | ||
return "__vdso_clock_gettime64"; | ||
default: | ||
return ""; | ||
} | ||
} | ||
|
||
// symbol versions | ||
LIBC_INLINE constexpr cpp::string_view symbol_version(VDSOSym) { | ||
return "LINUX_2.6"; | ||
} | ||
} // namespace vdso | ||
} // namespace LIBC_NAMESPACE_DECL | ||
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_ARM_VDSO_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===---------- RISC-V 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_RISCV_VDSO_H | ||
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_RISCV_VDSO_H | ||
#include "src/__support/CPP/string_view.h" | ||
#include "src/__support/OSUtil/linux/vdso_sym.h" | ||
namespace LIBC_NAMESPACE_DECL { | ||
namespace vdso { | ||
// translate VDSOSym to symbol names | ||
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/kernel/vdso/vdso.lds.S | ||
LIBC_INLINE constexpr cpp::string_view symbol_name(VDSOSym sym) { | ||
switch (sym) { | ||
case VDSOSym::RTSigReturn: | ||
return "__vdso_rt_sigreturn"; | ||
case VDSOSym::GetTimeOfDay: | ||
return "__vdso_gettimeofday"; | ||
case VDSOSym::ClockGetTime: | ||
return "__vdso_clock_gettime"; | ||
case VDSOSym::ClockGetRes: | ||
return "__vdso_clock_getres"; | ||
case VDSOSym::GetCpu: | ||
return "__vdso_getcpu"; | ||
case VDSOSym::FlushICache: | ||
return "__vdso_flush_icache"; | ||
case VDSOSym::RiscvHwProbe: | ||
return "__vdso_riscv_hwprobe"; | ||
default: | ||
return ""; | ||
} | ||
} | ||
|
||
// symbol versions | ||
LIBC_INLINE constexpr cpp::string_view symbol_version(VDSOSym) { | ||
return "LINUX_4.15"; | ||
nickdesaulniers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} // namespace vdso | ||
} // namespace LIBC_NAMESPACE_DECL | ||
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_RISCV_VDSO_H |
Uh oh!
There was an error while loading. Please reload this page.