[llvm] r220294 - Add support for addmod to mri scripts.
Rafael Espindola
rafael.espindola at gmail.com
Tue Oct 21 07:46:18 PDT 2014
Author: rafael
Date: Tue Oct 21 09:46:17 2014
New Revision: 220294
URL: http://llvm.org/viewvc/llvm-project?rev=220294&view=rev
Log:
Add support for addmod to mri scripts.
Added:
llvm/trunk/test/Object/mri-addmod.test
Modified:
llvm/trunk/tools/llvm-ar/llvm-ar.cpp
Added: llvm/trunk/test/Object/mri-addmod.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/mri-addmod.test?rev=220294&view=auto
==============================================================================
--- llvm/trunk/test/Object/mri-addmod.test (added)
+++ llvm/trunk/test/Object/mri-addmod.test Tue Oct 21 09:46:17 2014
@@ -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
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=220294&r1=220293&r2=220294&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Tue Oct 21 09:46:17 2014
@@ -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())
More information about the llvm-commits
mailing list