63 lines · plain
1# RUN: yaml2obj %s -o %t2 3# RUN: llvm-objcopy --set-section-alignment .foo=4 --set-section-alignment .bar=0x5 \4# RUN: --set-section-alignment .baz=0 %t %t.25# RUN: llvm-readobj --sections %t.2 | FileCheck --check-prefix=CHECK %s6 7# CHECK: Name: .foo8# CHECK: AddressAlignment:9# CHECK-SAME: 4{{$}}10# CHECK: Name: .bar11# CHECK: AddressAlignment:12# CHECK-SAME: 5{{$}}13# CHECK: Name: .baz14# CHECK: AddressAlignment:15# CHECK-SAME: 0{{$}}16 17## If a section is specified multiple times, the last wins.18## Also incidentally show that unmentioned sections are not impacted.19# RUN: llvm-objcopy --set-section-alignment .foo=4 --set-section-alignment=.foo=7 %t %t.320# RUN: llvm-readobj --sections %t.3 | FileCheck --check-prefix=MULTI %s21 22# MULTI: Name: .foo23# MULTI: AddressAlignment:24# MULTI-SAME: 7{{$}}25# MULTI: Name: .bar26# MULTI: AddressAlignment:27# MULTI-SAME: 0{{$}}28# MULTI: Name: .baz29# MULTI: AddressAlignment:30# MULTI-SAME: 4{{$}}31 32## Ignore the option if the section does not exist.33# RUN: llvm-objcopy --set-section-alignment .not_exist=4 %t.3 %t.434# RUN: cmp %t.3 %t.435 36# RUN: not llvm-objcopy --set-section-alignment=.foo %t /dev/null 2>&1 | \37# RUN: FileCheck --check-prefix=MISSING-EQUAL %s38# MISSING-EQUAL: error: bad format for --set-section-alignment: missing '='39 40# RUN: not llvm-objcopy --set-section-alignment==4 %t /dev/null 2>&1 | \41# RUN: FileCheck --check-prefix=MISSING-SECTION %s42# MISSING-SECTION: error: bad format for --set-section-alignment: missing section name43 44# RUN: not llvm-objcopy --set-section-alignment=.foo=bar %t /dev/null 2>&1 | \45# RUN: FileCheck --check-prefix=INVALID-ALIGN %s46# INVALID-ALIGN: error: invalid value for --set-section-alignment: 'bar'47 48!ELF49FileHeader:50 Class: ELFCLASS6451 Data: ELFDATA2LSB52 Type: ET_REL53 Machine: EM_X86_6454Sections:55 - Name: .foo56 Type: SHT_PROGBITS57 - Name: .bar58 Type: SHT_NOBITS59 - Name: .baz60 Type: SHT_NOTE61 AddressAlign: 462 Notes: []63