Skip to content

Commit 18923c3

Browse files
[wasm] Read autolink entries from custom section instead of data segments
This change is required since swiftlang/llvm-project@d0f00c4 and we no longer need wasm custom implementation.
1 parent 6877778 commit 18923c3

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

Diff for: lib/DriverTool/autolink_extract_main.cpp

-30
Original file line numberDiff line numberDiff line change
@@ -153,36 +153,6 @@ extractLinkerFlagsFromObjectFile(const llvm::object::ObjectFile *ObjectFile,
153153
return false;
154154
}
155155

156-
/// Look inside the object file 'WasmObjectFile' and append any linker flags
157-
/// found in its ".swift1_autolink_entries" section to 'LinkerFlags'. Return
158-
/// 'true' if there was an error, and 'false' otherwise.
159-
static bool
160-
extractLinkerFlagsFromObjectFile(const llvm::object::WasmObjectFile *ObjectFile,
161-
std::vector<std::string> &LinkerFlags,
162-
std::unordered_map<std::string, bool> &SwiftRuntimeLibraries,
163-
CompilerInstance &Instance) {
164-
// Search for the data segment we hold autolink entries in
165-
for (const llvm::object::WasmSegment &Segment : ObjectFile->dataSegments()) {
166-
if (Segment.Data.Name == ".swift1_autolink_entries") {
167-
168-
StringRef SegmentData = llvm::toStringRef(Segment.Data.Content);
169-
// entries are null-terminated, so extract them and push them into
170-
// the set.
171-
llvm::SmallVector<llvm::StringRef, 4> SplitFlags;
172-
SegmentData.split(SplitFlags, llvm::StringRef("\0", 1), -1,
173-
/*KeepEmpty=*/false);
174-
for (const auto &Flag : SplitFlags) {
175-
auto RuntimeLibEntry = SwiftRuntimeLibraries.find(Flag.str());
176-
if (RuntimeLibEntry == SwiftRuntimeLibraries.end())
177-
LinkerFlags.emplace_back(Flag.str());
178-
else
179-
RuntimeLibEntry->second = true;
180-
}
181-
}
182-
}
183-
return false;
184-
}
185-
186156
/// Look inside the binary 'Bin' and append any linker flags found in its
187157
/// ".swift1_autolink_entries" section to 'LinkerFlags'. If 'Bin' is an archive,
188158
/// recursively look inside all children within the archive. Return 'true' if

0 commit comments

Comments
 (0)