[libc-commits] [libc] [libc] add dl_iterate_phdr and dladdr (PR #121179)

Tristan Ross via libc-commits libc-commits at lists.llvm.org
Sat Dec 28 10:21:02 PST 2024


================
@@ -0,0 +1,57 @@
+//===-- Implementation of dl_iterate_phdr ---------------------------------===//
+//
+// 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/link/dl_iterate_phdr.h"
+#include "config/linux/app.h"
+#include "include/llvm-libc-macros/sys-auxv-macros.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+[[gnu::weak,
+  gnu::visibility("hidden")]] extern const ElfW(Dyn) _DYNAMIC[]; // NOLINT
+
+#define AUX_CNT 38
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, dl_iterate_phdr,
----------------
RossComputerGuy wrote:

This is the only time I've copied other implementations like this. I tried figuring out what `dl_iterate_phdrs` but I didn't really understand it from the man page. Is there a way that this implementation could be changed enough that it then doesn't have a licensing problem?

https://github.com/llvm/llvm-project/pull/121179


More information about the libc-commits mailing list