[PATCH] D64439: [lld][WebAssembly] Fix data section name in PIC mode

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 12:12:55 PDT 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.

This should always have been ".data".  Without this we treat the
section as a user-defined section in other places (such as the
generation of __start/__stop symbols).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64439

Files:
  lld/wasm/Writer.cpp


Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -304,9 +304,9 @@
 // gold provide the feature, and used by many programs.
 static void addStartStopSymbols(const OutputSegment *Seg) {
   StringRef Name = Seg->Name;
-  LLVM_DEBUG(dbgs() << "addStartStopSymbols: " << Name << "\n");
   if (!isValidCIdentifier(Name))
     return;
+  LLVM_DEBUG(dbgs() << "addStartStopSymbols: " << Name << "\n");
   uint32_t Start = Seg->StartVA;
   uint32_t Stop = Start + Seg->Size;
   Symtab->addOptionalDataSymbol(Saver.save("__start_" + Name), Start);
@@ -601,7 +601,7 @@
   // With PIC code we currently only support a single data segment since
   // we only have a single __memory_base to use as our base address.
   if (Config->Pic)
-    return "data";
+    return ".data";
   if (!Config->MergeDataSegments)
     return Name;
   if (Name.startswith(".text."))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64439.208773.patch
Type: text/x-patch
Size: 947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190709/bdbd57b6/attachment.bin>


More information about the llvm-commits mailing list