[libc-commits] [libc] [libc] implement vdso (PR #91572)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Sat Jun 1 14:56:55 PDT 2024
================
@@ -0,0 +1,258 @@
+//===------------- Linux VDSO Implementation --------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+#include "src/__support/OSUtil/linux/vdso.h"
+#include "src/__support/CPP/array.h"
+#include "src/__support/CPP/optional.h"
+#include "src/__support/CPP/string_view.h"
+#include "src/__support/threads/callonce.h"
+#include "src/__support/threads/linux/futex_word.h"
+#include "src/errno/libc_errno.h"
+#include "x86_64/vdso.h"
+#include <cstddef>
+#include <linux/auxvec.h>
+#include <linux/elf.h>
+
+#ifndef ElfW
+#if __POINTER_WIDTH__ == 32
+#define ElfW(type) Elf32_##type
+#else
+#define ElfW(type) Elf64_##type
+#endif
+#endif
----------------
SchrodingerZhu wrote:
`ElfW` is defined in `link.h`. In current overlay mode, if I want to pull in `libc.hdr.link_macros`, then it would include `link.h` for non-fulllbuild target, which will include `elf.h`. Unfortunately, `elf.h` does define `Elf<32/64>_XXX` types that conflict with `<linux/elf.h>`.
The solution is to provide all the ELF types and macros by ourselves. I wish I can do that in a separate PR as it would consist of quite a lot changes.
https://github.com/llvm/llvm-project/pull/91572
More information about the libc-commits
mailing list