[lld] [llvm] [readobj][Arm][AArch64] Refactor Build Attributes parsing under ELFAtributeParser and add support for AArch64 Build Attributes (PR #128727)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 06:26:00 PST 2025
================
@@ -0,0 +1,176 @@
+//===-ELFAttrParserExtended.cpp-ELF Extended Attribute Information Printer-===//
+//
+// 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 "llvm/Support/ELFAttrParserExtended.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/AArch64BuildAttributes.h"
+#include "llvm/Support/ELFAttributes.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdint>
+
+using namespace llvm;
+using namespace ELFAttrs;
+
+std::optional<unsigned>
+ELFExtendedAttrParser::getAttributeValue(StringRef BuildAttrSubsectionName,
+ unsigned Tag) const {
+ for (auto SubSection : SubSectionVec) {
----------------
sivan-shani wrote:
Completely changing the data structure is not trivial.
There are many `BuildAttributeSubSection` with `Name`, `IsOptional` and `ParameterType` that need to be stored,
and each hold many `BuildAttributeItem` with several items that need storing.
It possible to add some specific data to a Map for quick retrieval but that is not trivial either. since the key has to be a string + a int.
In practice we expect few subsections (up to 2) with few elements in them (up to 3), does it worth the optimization?
https://github.com/llvm/llvm-project/pull/128727
More information about the llvm-commits
mailing list