Skip to content

Commit cfc807d

Browse files
committed
fixup: add a test with "ShAddrAlign" and "AddressAlign" having different values
1 parent f2abc4e commit cfc807d

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

llvm/test/tools/yaml2obj/ELF/note-section.yaml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Sections:
351351
Notes:
352352
- Type: 0x1
353353

354-
## Check that note entries and their `Desc` fields are aligned according to the
354+
## Check that note entries and their "Desc" fields are aligned according to the
355355
## specified section alignment.
356356

357357
# RUN: yaml2obj --docnum=17 -D ELFCLASS=64 %s -o - | \
@@ -466,3 +466,47 @@ Sections:
466466
Desc: 030405
467467
- Name: GNU
468468
Type: NT_GNU_BUILD_ID
469+
470+
## Check that the alignment for note entries is taken from the "AddressAlign"
471+
## field even if "ShAddrAlign" is also specified; an unexpected value in the
472+
## "ShAddrAlign" property does not trigger an incorrect alignment error.
473+
474+
# RUN: yaml2obj --docnum=18 -D ADDRALIGN=4 -D SHADDRALIGN=3 %s -o - | \
475+
# RUN: llvm-readobj --sections --section-data --notes - | \
476+
# RUN: FileCheck %s --check-prefixes=TEST18,TEST18_4
477+
478+
# RUN: yaml2obj --docnum=18 -D ADDRALIGN=8 -D SHADDRALIGN=4 %s -o - | \
479+
# RUN: llvm-readobj --sections --section-data --notes - | \
480+
# RUN: FileCheck %s --check-prefixes=TEST18,TEST18_8
481+
482+
# TEST18: Name: .note
483+
# TEST18: SectionData (
484+
# TEST18_4-NEXT: 0000: 05000000 02000000 01000000 41424344 |............ABCD|
485+
# TEST18_4-NEXT: 0010: 00000000 01020000 00000000 03000000 |................|
486+
# TEST18_4-NEXT: 0020: 02000000 03040500 04000000 00000000 |................|
487+
# TEST18_4-NEXT: 0030: 03000000 474E5500 |....GNU.|
488+
# TEST18_8-NEXT: 0000: 05000000 02000000 01000000 41424344 |............ABCD|
489+
# TEST18_8-NEXT: 0010: 00000000 00000000 01020000 00000000 |................|
490+
# TEST18_8-NEXT: 0020: 00000000 03000000 02000000 00000000 |................|
491+
# TEST18_8-NEXT: 0030: 03040500 00000000 04000000 00000000 |................|
492+
# TEST18_8-NEXT: 0040: 03000000 474E5500 |....GNU.|
493+
# TEST18-NEXT: )
494+
495+
--- !ELF
496+
FileHeader:
497+
Class: ELFCLASS64
498+
Data: ELFDATA2LSB
499+
Type: ET_EXEC
500+
Sections:
501+
- Name: .note
502+
Type: SHT_NOTE
503+
AddressAlign: [[ADDRALIGN]]
504+
ShAddrAlign: [[SHADDRALIGN]]
505+
Notes:
506+
- Name: ABCD
507+
Type: NT_VERSION
508+
Desc: 0102
509+
- Type: NT_ARCH
510+
Desc: 030405
511+
- Name: GNU
512+
Type: NT_GNU_BUILD_ID

0 commit comments

Comments
 (0)