| 1 |
# RUN: yaml2obj %s -o %t |
| 2 |
# RUN: not llvm-objcopy %t %t2 2>&1 | FileCheck %s |
| 3 |
# CHECK: error: invalid alignment 1 of group section '.group' |
| 4 |
|
| 5 |
# In this test, we check that llvm-objcopy reports an error |
| 6 |
# for SHT_GROUP section with invalid alignment (not a multiple of 4). |
| 7 |
|
| 8 |
--- !ELF |
| 9 |
FileHeader: |
| 10 |
Class: ELFCLASS64 |
| 11 |
Data: ELFDATA2LSB |
| 12 |
Type: ET_REL |
| 13 |
Machine: EM_X86_64 |
| 14 |
Sections: |
| 15 |
## It is not important for passing the test case to have this placeholder, |
| 16 |
## but having it would trigger ubsan failure when writing the group section |
| 17 |
## into a file if the error tested would not be reported by llvm-objcopy. |
| 18 |
- Name: .placeholder |
| 19 |
Type: SHT_PROGBITS |
| 20 |
Flags: [ SHF_ALLOC, SHF_EXECINSTR ] |
| 21 |
AddressAlign: 0x0000000000000001 |
| 22 |
Content: "00" |
| 23 |
- Name: .group |
| 24 |
Type: SHT_GROUP |
| 25 |
Link: .symtab |
| 26 |
AddressAlign: 0x0000000000000001 |
| 27 |
Info: foo |
| 28 |
Members: |
| 29 |
- SectionOrType: GRP_COMDAT |
| 30 |
- SectionOrType: .text.foo |
| 31 |
- Name: .text.foo |
| 32 |
Type: SHT_PROGBITS |
| 33 |
Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ] |
| 34 |
AddressAlign: 0x0000000000000001 |
| 35 |
Symbols: |
| 36 |
- Name: foo |
| 37 |
Section: .group |