Skip to content

Commit 3821f7c

Browse files
committed
Mark start/stop sections as SHF_GNU_RETAIN
Fixes swiftlang/swift-package-manager#5698
1 parent 7621b76 commit 3821f7c

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

lib/Driver/UnixToolChains.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,6 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job,
184184
#else
185185
Arguments.push_back(context.Args.MakeArgString("-fuse-ld=" + Linker));
186186
#endif
187-
// Starting with lld 13, Swift stopped working with the lld --gc-sections
188-
// implementation for ELF, unless -z nostart-stop-gc is also passed to lld:
189-
//
190-
// https://reviews.llvm.org/D96914
191-
if (Linker == "lld" || (Linker.length() > 5 &&
192-
Linker.substr(Linker.length() - 6) == "ld.lld")) {
193-
Arguments.push_back("-Xlinker");
194-
Arguments.push_back("-z");
195-
Arguments.push_back("-Xlinker");
196-
Arguments.push_back("nostart-stop-gc");
197-
}
198187
}
199188

200189
// Configure the toolchain.

stdlib/public/runtime/SwiftRT-ELF-WASM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static constexpr const void *__dso_handle = nullptr;
2828
// by the linker. Otherwise, we may end up with undefined symbol references as
2929
// the linker table section was never constructed.
3030
#if defined(__ELF__)
31-
# define DECLARE_EMPTY_METADATA_SECTION(name) __asm__("\t.section " #name ",\"a\"\n");
31+
# define DECLARE_EMPTY_METADATA_SECTION(name) __asm__("\t.section " #name ",\"aR\"\n");
3232
#elif defined(__wasm__)
3333
# define DECLARE_EMPTY_METADATA_SECTION(name) __asm__("\t.section " #name ",\"\",@\n");
3434
#endif

0 commit comments

Comments
 (0)