llvm.org GIT mirror llvm / 9f8b01c
[llvm-ar] Create thin archives with MRI scripts This patch implements the "CREATE_THIN" MRI script command, allowing thin archives to be created via MRI scripts. Differential Revision: https://reviews.llvm.org/D62919 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362704 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Reynolds 2 months ago
2 changed file(s) with 28 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 RUN: rm -rf %t && mkdir -p %t/addlib/
1
2 RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o
3 RUN: cp %t/elf.o %t/addlib/elf.o
4 RUN: cp %t/elf.o %t/delete.o
5
6 RUN: cd %t && llvm-ar rTc addlib/addlib.ar addlib/elf.o
7
8 RUN: echo "createthin %t/archive.ar" > %t/mri.script
9 RUN: echo "addmod elf.o" >> %t/mri.script
10 RUN: echo "addlib addlib/addlib.ar" >> %t/mri.script
11 RUN: echo "addmod delete.o" >> %t/mri.script
12 RUN: echo "delete delete.o" >> %t/mri.script
13 RUN: echo "save" >> %t/mri.script
14 RUN: echo "end" >> %t/mri.script
15
16 RUN: cd %t && llvm-ar -M < mri.script
17 RUN: FileCheck -input-file=%t/archive.ar %s
18
19 CHECK: !
20 CHECK: elf.o
21 CHECK-NEXT: addlib/elf.o/
22 CHECK-NOT: delete.o
951951 }
952952
953953 static void runMRIScript() {
954 enum class MRICommand { AddLib, AddMod, Create, Delete, Save, End, Invalid };
954 enum class MRICommand { AddLib, AddMod, Create, CreateThin, Delete, Save, End, Invalid };
955955
956956 ErrorOr> Buf = MemoryBuffer::getSTDIN();
957957 failIfError(Buf.getError());
975975 .Case("addlib", MRICommand::AddLib)
976976 .Case("addmod", MRICommand::AddMod)
977977 .Case("create", MRICommand::Create)
978 .Case("createthin", MRICommand::CreateThin)
978979 .Case("delete", MRICommand::Delete)
979980 .Case("save", MRICommand::Save)
980981 .Case("end", MRICommand::End)
994995 case MRICommand::AddMod:
995996 addMember(NewMembers, Rest);
996997 break;
998 case MRICommand::CreateThin:
999 Thin = true;
1000 LLVM_FALLTHROUGH;
9971001 case MRICommand::Create:
9981002 Create = true;
9991003 if (!ArchiveName.empty())