diff options
-rw-r--r-- | test/Object/mri-addmod.test | 18 | ||||
-rw-r--r-- | tools/llvm-ar/llvm-ar.cpp | 6 |
2 files changed, 23 insertions, 1 deletions
diff --git a/test/Object/mri-addmod.test b/test/Object/mri-addmod.test new file mode 100644 index 00000000000..b8a41debc1d --- /dev/null +++ b/test/Object/mri-addmod.test @@ -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 diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index fa0842992ec..785cabd08ff 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -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()) |