[libc-commits] [libc] [libc][linux] add support to parse PT_GNU_PROPERTY (PR #174772)
Jakob Koschel via libc-commits
libc-commits at lists.llvm.org
Wed Jan 14 05:57:36 PST 2026
================
@@ -0,0 +1,92 @@
+//===-- Header file of gnu_property_section -------------------------------===//
+//
+// 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_STARTUP_LINUX_GNU_PROPERTY_SECTION_H
+#define LLVM_LIBC_STARTUP_LINUX_GNU_PROPERTY_SECTION_H
+
+#include "include/llvm-libc-macros/link-macros.h"
+#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/config.h"
+
+#include <linux/elf.h>
+#include <stddef.h>
+
+namespace LIBC_NAMESPACE_DECL {
+
+// The layout of the .note.gnu.property section and the program property is
+// described in "System V Application Binary Interface - Linux Extensions"
+// (https://github.com/hjl-tools/linux-abi/wiki).
+
+// The program property note is basically a note (Elf64_Nhdr) prepended with:
+// * n_name[4]: should always be "GNU\0"
+// * n_desc: an array of n_descsz bytes with program property entries
+// Since we are casting a memory address into this struct, the layout needs to
+// *exactly* match.
+struct Elf64_ProgramPropertyNote {
----------------
jakos-sec wrote:
That's a good question! For now I think there is no reason to have them public since there is no real use outside of here. I also moved them to the cpp file so we don't need to expose them. If there are good reasons to have them for other uses, we could add them to the public ELF header, WDYT?
https://github.com/llvm/llvm-project/pull/174772
More information about the libc-commits
mailing list