[PATCH] D46417: wasm: Add a flag to control merging data segments

Nick Fitzgerald via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 13:11:53 PDT 2018


fitzgen updated this revision to Diff 145522.
fitzgen edited the summary of this revision.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46417

Files:
  wasm/Config.h
  wasm/Driver.cpp
  wasm/Options.td
  wasm/Writer.cpp


Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -858,7 +858,7 @@
 }
 
 static StringRef getOutputDataSegmentName(StringRef Name) {
-  if (Config->Relocatable)
+  if (!Config->MergeDataSegments)
     return Name;
   if (Name.startswith(".text."))
     return ".text";
Index: wasm/Options.td
===================================================================
--- wasm/Options.td
+++ wasm/Options.td
@@ -40,6 +40,10 @@
     "Enable garbage collection of unused sections",
     "Disable garbage collection of unused sections">;
 
+defm merge_data_segments: B<"merge-data-segments",
+    "Enable merging data segments",
+    "Disable merging data segments">;
+
 def help: F<"help">, HelpText<"Print option help">;
 
 def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
Index: wasm/Driver.cpp
===================================================================
--- wasm/Driver.cpp
+++ wasm/Driver.cpp
@@ -293,6 +293,9 @@
   Config->Relocatable = Args.hasArg(OPT_relocatable);
   Config->GcSections =
       Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, !Config->Relocatable);
+  Config->MergeDataSegments =
+      Args.hasFlag(OPT_merge_data_segments, OPT_no_merge_data_segments,
+                   !Config->Relocatable);
   Config->PrintGcSections =
       Args.hasFlag(OPT_print_gc_sections, OPT_no_print_gc_sections, false);
   Config->SearchPaths = args::getStrings(Args, OPT_L);
Index: wasm/Config.h
===================================================================
--- wasm/Config.h
+++ wasm/Config.h
@@ -25,6 +25,7 @@
   bool GcSections;
   bool ImportMemory;
   bool ImportTable;
+  bool MergeDataSegments;
   bool PrintGcSections;
   bool Relocatable;
   bool StripAll;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46417.145522.patch
Type: text/x-patch
Size: 1778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/00bbe311/attachment.bin>


More information about the llvm-commits mailing list