[PATCH] D40825: [WebAssembly] Simplify check for emitting relocations

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 08:54:02 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL319789: [WebAssembly] Simplify check for emitting relocations (authored by sbc).

Repository:
  rL LLVM

https://reviews.llvm.org/D40825

Files:
  lld/trunk/wasm/Driver.cpp
  lld/trunk/wasm/Writer.cpp


Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -226,7 +226,7 @@
     writeGlobal(OS, Global);
   }
 
-  if (Config->Relocatable || Config->EmitRelocs) {
+  if (Config->EmitRelocs) {
     for (ObjFile *File : Symtab->ObjectFiles) {
       uint32_t GlobalIndex = File->NumGlobalImports();
       for (const WasmGlobal &Global : File->getWasmObj()->globals()) {
@@ -539,7 +539,7 @@
   createDataSection();
 
   // Custom sections
-  if (Config->EmitRelocs || Config->Relocatable)
+  if (Config->EmitRelocs)
     createRelocSections();
   createLinkingSection();
   if (!Config->StripDebug && !Config->StripAll)
@@ -565,7 +565,7 @@
     NumFunctions += WasmFile->functions().size();
 
     // Global Index
-    if (Config->Relocatable || Config->EmitRelocs) {
+    if (Config->EmitRelocs) {
       File->GlobalIndexOffset =
           GlobalImports.size() - File->NumGlobalImports() + NumGlobals;
       NumGlobals += WasmFile->globals().size();
Index: lld/trunk/wasm/Driver.cpp
===================================================================
--- lld/trunk/wasm/Driver.cpp
+++ lld/trunk/wasm/Driver.cpp
@@ -257,6 +257,8 @@
   Config->Sysroot = Args.getLastArgValue(OPT_sysroot);
   errorHandler().Verbose = Args.hasArg(OPT_verbose);
   ThreadsEnabled = Args.hasFlag(OPT_threads, OPT_no_threads, true);
+  if (Config->Relocatable)
+    Config->EmitRelocs = true;
 
   Config->InitialMemory = args::getInteger(Args, OPT_initial_memory, 0);
   Config->GlobalBase = args::getInteger(Args, OPT_global_base, 1024);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40825.125543.patch
Type: text/x-patch
Size: 1626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/85ff5424/attachment.bin>


More information about the llvm-commits mailing list