Revert "[WebAssembly] Add __start_/_stop_ symbols for data sections"
This reverts commit 7804dbddccba412087a15cab8db4412939700952.
This change broke a bunch of tests of the WebAssembly waterfall.
Will hopefully reland with increased test coverage.
llvm-svn: 361273
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index 88c93fc..eb567ec 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -73,8 +73,6 @@
void addSection(OutputSection *Sec);
void addSections();
- void addStartStopSymbols(const InputSegment *Seg);
-
void createCustomSections();
void createSyntheticSections();
void finalizeSections();
@@ -295,22 +293,6 @@
OutputSections.push_back(Sec);
}
-// If a section name is valid as a C identifier (which is rare because of
-// the leading '.'), linkers are expected to define __start_<secname> and
-// __stop_<secname> symbols. They are at beginning and end of the section,
-// respectively. This is not requested by the ELF standard, but GNU ld and
-// gold provide the feature, and used by many programs.
-void Writer::addStartStopSymbols(const InputSegment *Seg) {
- StringRef S = Seg->getName();
- LLVM_DEBUG(dbgs() << "addStartStopSymbols: " << S << "\n");
- if (!isValidCIdentifier(S))
- return;
- uint32_t Start = Seg->OutputSeg->StartVA + Seg->OutputSegmentOffset;
- uint32_t Stop = Start + Seg->getSize();
- Symtab->addOptionalDataSymbol(Saver.save("__start_" + S), Start, 0);
- Symtab->addOptionalDataSymbol(Saver.save("__stop_" + S), Stop, 0);
-}
-
void Writer::addSections() {
addSection(Out.DylinkSec);
addSection(Out.TypeSec);
@@ -561,6 +543,8 @@
Out.FunctionSec->addFunction(Func);
}
+ scanRelocations();
+
for (InputGlobal *Global : Symtab->SyntheticGlobals)
Out.GlobalSec->addGlobal(Global);
@@ -740,40 +724,19 @@
populateTargetFeatures();
log("-- calculateImports");
calculateImports();
- log("-- layoutMemory");
- layoutMemory();
-
- if (!Config->Relocatable) {
- // Create linker synthesized __start_SECNAME/__stop_SECNAME symbols
- // This has to be done after memory layout is performed.
- for (const OutputSegment *Seg : Segments)
- for (const InputSegment *S : Seg->InputSegments)
- addStartStopSymbols(S);
- }
-
log("-- assignIndexes");
assignIndexes();
- log("-- scanRelocations");
- scanRelocations();
log("-- calculateInitFunctions");
calculateInitFunctions();
-
+ log("-- calculateTypes");
+ calculateTypes();
+ log("-- layoutMemory");
+ layoutMemory();
if (!Config->Relocatable) {
- // Create linker synthesized functions
if (Config->Pic)
createApplyRelocationsFunction();
createCallCtorsFunction();
-
- // Make sure we have resolved all symbols.
- if (!Config->AllowUndefined)
- Symtab->reportRemainingUndefines();
-
- if (errorCount())
- return;
}
-
- log("-- calculateTypes");
- calculateTypes();
log("-- calculateExports");
calculateExports();
log("-- calculateCustomSections");