1## Test the move command without modifiers moves members to the end 2 3# RUN: rm -rf %t && mkdir -p %t 4# RUN: yaml2obj %s -o %t/1.o --docnum=1 5# RUN: yaml2obj %s -o %t/2.o --docnum=2 6# RUN: yaml2obj %s -o %t/3.o --docnum=3 7 8## Move single member: 9# RUN: llvm-ar rc %t/single.a %t/1.o %t/2.o %t/3.o 10# RUN: llvm-ar m %t/single.a %t/1.o 11# RUN: llvm-ar t %t/single.a \ 12# RUN: | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}} 13 14# SINGLE: 2.o 15# SINGLE-NEXT: 3.o 16# SINGLE-NEXT: 1.o 17 18# RUN: llvm-nm --print-armap %t/single.a \ 19# RUN: | FileCheck %s --check-prefix=SINGLE-SYM 20 21# SINGLE-SYM: symbol2 22# SINGLE-SYM-NEXT: symbol3 23# SINGLE-SYM-NEXT: symbol1 24 25## Move multiple members: 26# RUN: llvm-ar rc %t/multiple.a %t/1.o %t/2.o %t/3.o 27# RUN: llvm-ar m %t/multiple.a %t/1.o %t/2.o 28# RUN: llvm-ar t %t/multiple.a \ 29# RUN: | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}} 30 31# MULTIPLE: 3.o 32# MULTIPLE-NEXT: 1.o 33# MULTIPLE-NEXT: 2.o 34 35# RUN: llvm-nm --print-armap %t/multiple.a \ 36# RUN: | FileCheck %s --check-prefix=MULTIPLE-SYM 37 38# MULTIPLE-SYM: symbol3 39# MULTIPLE-SYM-NEXT: symbol1 40# MULTIPLE-SYM-NEXT: symbol2 41 42## Move same member: 43# RUN: llvm-ar rc %t/same.a %t/1.o %t/2.o %t/3.o 44# RUN: llvm-ar m %t/same.a %t/1.o %t/1.o 45# RUN: llvm-ar t %t/same.a \ 46# RUN: | FileCheck %s --check-prefix=SAME -DFILE=%t/2.o 47 48# SAME: 2.o 49# SAME-NEXT: 3.o 50# SAME-NEXT: 1.o 51 52# RUN: llvm-nm --print-armap %t/same.a \ 53# RUN: | FileCheck %s --check-prefix=SAME-SYM 54 55# SAME-SYM: symbol2 56# SAME-SYM-NEXT: symbol3 57# SAME-SYM-NEXT: symbol1 58 59## Move without member: 60# RUN: llvm-ar rc %t/without.a %t/1.o %t/2.o %t/3.o 61# RUN: llvm-ar m %t/without.a 62# RUN: llvm-ar t %t/without.a \ 63# RUN: | FileCheck %s --match-full-lines --check-prefix=WITHOUT --implicit-check-not {{.}} 64 65# WITHOUT: 1.o 66# WITHOUT-NEXT: 2.o 67# WITHOUT-NEXT: 3.o 68 69# RUN: llvm-nm --print-armap %t/without.a \ 70# RUN: | FileCheck %s --check-prefix=WITHOUT-SYM 71 72# WITHOUT-SYM: symbol1 73# WITHOUT-SYM-NEXT: symbol2 74# WITHOUT-SYM-NEXT: symbol3 75 76## No archive: 77# RUN: not llvm-ar m 2>&1 \ 78# RUN: | FileCheck %s --check-prefix=NO-ARCHIVE 79 80# NO-ARCHIVE: error: an archive name must be specified 81 82## Member does not exist: 83# RUN: llvm-ar rc %t/missing.a %t/1.o %t/2.o %t/3.o 84# RUN: not llvm-ar m %t/missing.a %t/missing.txt 2>&1 \ 85# RUN: | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t/missing.txt 86 87# MISSING-FILE: error: [[FILE]]: {{[nN]}}o such file or directory 88 89--- !ELF 90FileHeader: 91 Class: ELFCLASS64 92 Data: ELFDATA2LSB 93 Type: ET_REL 94 Machine: EM_X86_64 95Sections: 96 - Name: .text 97 Type: SHT_PROGBITS 98Symbols: 99 - Name: symbol1 100 Binding: STB_GLOBAL 101 Section: .text 102 103--- !ELF 104FileHeader: 105 Class: ELFCLASS64 106 Data: ELFDATA2LSB 107 Type: ET_REL 108 Machine: EM_X86_64 109Sections: 110 - Name: .text 111 Type: SHT_PROGBITS 112Symbols: 113 - Name: symbol2 114 Binding: STB_GLOBAL 115 Section: .text 116 117--- !ELF 118FileHeader: 119 Class: ELFCLASS64 120 Data: ELFDATA2LSB 121 Type: ET_REL 122 Machine: EM_X86_64 123Sections: 124 - Name: .text 125 Type: SHT_PROGBITS 126Symbols: 127 - Name: symbol3 128 Binding: STB_GLOBAL 129 Section: .text 130