[lld] r365547 - [lld][WebAssembly] Fix name of data section in PIC mode

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


Author: sbc
Date: Tue Jul  9 12:47:32 2019
New Revision: 365547

URL: http://llvm.org/viewvc/llvm-project?rev=365547&view=rev
Log:
[lld][WebAssembly] Fix name of data section in PIC mode

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).

Differential Revision: https://reviews.llvm.org/D64439

Modified:
    lld/trunk/wasm/Writer.cpp

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=365547&r1=365546&r2=365547&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Tue Jul  9 12:47:32 2019
@@ -304,9 +304,9 @@ void Writer::addSection(OutputSection *S
 // 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 @@ static StringRef getOutputDataSegmentNam
   // 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."))




More information about the llvm-commits mailing list