[llvm] Reland "[ObjectYAML][ELF] Take alignment into account when generating notes" (PR #118434)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 01:29:13 PST 2024


================
@@ -333,3 +333,132 @@ Sections:
       - Name: ABC
         Desc: '123456'
         Type: NT_VERSION
+
+## Check that an incorrect alignment is reported
+
+# RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=ERR_ALIGN1
+# ERR_ALIGN1: error: .note.foo: invalid alignment for a note section: 0x1
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+Sections:
+  - Name:         .note.foo
+    Type:         SHT_NOTE
+    AddressAlign: 1
+    Notes:
+      - Type: 0x1
+
+## Check that note entries and their `Desc` fields are aligned according to the
+## specified section alignment
----------------
jh7370 wrote:

Ditto.

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


More information about the llvm-commits mailing list