Add support for addmod to mri scripts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220294 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-10-21 14:46:17 +00:00
parent 41454cc88b
commit 2afb0e4d2c
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,18 @@
; RUN: echo create %t.a > %t.mri
; RUN: echo addmod %p/Inputs/trivial-object-test.elf-x86-64 >> %t.mri
; RUN: echo save >> %t.mri
; RUN: echo end >> %t.mri
; RUN: llvm-ar -M < %t.mri
; RUN: llvm-nm -M %t.a | FileCheck %s
; CHECK: Archive map
; CHECK-NEXT: main in trivial-object-test.elf-x86-64
; CHECK: trivial-object-test.elf-x86-64:
; CHECK-NEXT: U SomeOtherFunction
; CHECK-NEXT: 0000000000000000 T main
; CHECK-NEXT: U puts
; line_iterator is incompatible to CRLF.
; REQUIRES: shell

View File

@ -178,7 +178,7 @@ static void getMembers() {
}
namespace {
enum class MRICommand { Create, Save, End, Invalid };
enum class MRICommand { AddMod, Create, Save, End, Invalid };
}
static ArchiveOperation parseMRIScript() {
@ -192,12 +192,16 @@ static ArchiveOperation parseMRIScript() {
StringRef CommandStr, Rest;
std::tie(CommandStr, Rest) = Line.split(' ');
auto Command = StringSwitch<MRICommand>(CommandStr.lower())
.Case("addmod", MRICommand::AddMod)
.Case("create", MRICommand::Create)
.Case("save", MRICommand::Save)
.Case("end", MRICommand::End)
.Default(MRICommand::Invalid);
switch (Command) {
case MRICommand::AddMod:
Members.push_back(Rest);
break;
case MRICommand::Create:
Create = true;
if (!ArchiveName.empty())