[PATCH] D55533: [TextAPI][elfabi] Make SoName optional

Armando Montanez via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 17:03:25 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348817: [TextAPI][elfabi] Make SoName optional (authored by amontanez, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55533?vs=177615&id=177625#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55533/new/

https://reviews.llvm.org/D55533

Files:
  llvm/trunk/include/llvm/TextAPI/ELF/ELFStub.h
  llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp
  llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp


Index: llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp
===================================================================
--- llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp
+++ llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp
@@ -37,7 +37,6 @@
 TEST(ElfYamlTextAPI, YAMLReadableTBE) {
   const char Data[] = "--- !tapi-tbe\n"
                       "TbeVersion: 1.0\n"
-                      "SoName: test.so\n"
                       "Arch: x86_64\n"
                       "NeededLibs: [libc.so, libfoo.so, libbar.so]\n"
                       "Symbols:\n"
@@ -47,8 +46,8 @@
   ASSERT_THAT_ERROR(StubOrErr.takeError(), Succeeded());
   std::unique_ptr<ELFStub> Stub = std::move(StubOrErr.get());
   EXPECT_NE(Stub.get(), nullptr);
+  EXPECT_FALSE(Stub->SoName.hasValue());
   EXPECT_EQ(Stub->Arch, (uint16_t)llvm::ELF::EM_X86_64);
-  EXPECT_STREQ(Stub->SoName.c_str(), "test.so");
   EXPECT_EQ(Stub->NeededLibs.size(), 3u);
   EXPECT_STREQ(Stub->NeededLibs[0].c_str(), "libc.so");
   EXPECT_STREQ(Stub->NeededLibs[1].c_str(), "libfoo.so");
@@ -72,6 +71,8 @@
   ASSERT_THAT_ERROR(StubOrErr.takeError(), Succeeded());
   std::unique_ptr<ELFStub> Stub = std::move(StubOrErr.get());
   EXPECT_NE(Stub.get(), nullptr);
+  EXPECT_TRUE(Stub->SoName.hasValue());
+  EXPECT_STREQ(Stub->SoName->c_str(), "test.so");
   EXPECT_EQ(Stub->Symbols.size(), 5u);
 
   auto Iterator = Stub->Symbols.begin();
@@ -143,7 +144,6 @@
   const char Expected[] =
       "--- !tapi-tbe\n"
       "TbeVersion:      1.0\n"
-      "SoName:          test.so\n"
       "Arch:            AArch64\n"
       "Symbols:         \n"
       "  foo:             { Type: NoType, Size: 99, Warning: Does nothing }\n"
@@ -152,7 +152,6 @@
       "...\n";
   ELFStub Stub;
   Stub.TbeVersion = VersionTuple(1, 0);
-  Stub.SoName = "test.so";
   Stub.Arch = ELF::EM_AARCH64;
 
   ELFSymbol SymFoo("foo");
Index: llvm/trunk/include/llvm/TextAPI/ELF/ELFStub.h
===================================================================
--- llvm/trunk/include/llvm/TextAPI/ELF/ELFStub.h
+++ llvm/trunk/include/llvm/TextAPI/ELF/ELFStub.h
@@ -54,7 +54,7 @@
 // TODO: Add support for symbol versioning.
 public:
   VersionTuple TbeVersion;
-  std::string SoName;
+  Optional<std::string> SoName;
   ELFArch Arch;
   std::vector<std::string> NeededLibs;
   std::set<ELFSymbol> Symbols;
Index: llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp
===================================================================
--- llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp
+++ llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp
@@ -132,7 +132,7 @@
     if (!IO.mapTag("!tapi-tbe", true))
       IO.setError("Not a .tbe YAML file.");
     IO.mapRequired("TbeVersion", Stub.TbeVersion);
-    IO.mapRequired("SoName", Stub.SoName);
+    IO.mapOptional("SoName", Stub.SoName);
     IO.mapRequired("Arch", (ELFArchMapper &)Stub.Arch);
     IO.mapOptional("NeededLibs", Stub.NeededLibs);
     IO.mapRequired("Symbols", Stub.Symbols);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55533.177625.patch
Type: text/x-patch
Size: 2928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181211/feb9c57b/attachment.bin>


More information about the llvm-commits mailing list