[lld] [llvm] [lld][AArch64][Build Attributes] Add support for AArch64 Build Attributes (PR #147970)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 09:44:32 PDT 2025


================
@@ -775,6 +807,28 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
       continue;
     }
 
+    // Extract Build Attributes section contents into aarch64BAsubSections.
+    // Input objects may contain both build Build Attributes and GNU
+    // properties. We delay processing Build Attributes until we have finished
+    // reading all sections so that we can check that these are consistent.
+    //
+    // Ideally this belongs in the following switch, but due to the
+    // combination of enum constant reuse and fallthrough it has to be
+    // here.
+    if (ctx.arg.emachine == EM_AARCH64 && type == SHT_AARCH64_ATTRIBUTES) {
----------------
MaskRay wrote:

I think we can test `type == SHT_AARCH64_ATTRIBUTES && ` first to make it cheap on non-aarch64 targets.

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


More information about the llvm-commits mailing list