Skip to content

Commit 0e410da

Browse files
keithkateinoigakukun
authored andcommitted
Mark start/stop sections as SHF_GNU_RETAIN
Fixes swiftlang/swift-package-manager#5698
1 parent 9ce1baf commit 0e410da

File tree

3 files changed

+1
-14
lines changed

3 files changed

+1
-14
lines changed

lib/Driver/UnixToolChains.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,6 @@ toolchains::GenericUnix::constructInvocation(const DynamicLinkJobAction &job,
214214
#else
215215
Arguments.push_back(context.Args.MakeArgString("-fuse-ld=" + Linker));
216216
#endif
217-
// Starting with lld 13, Swift stopped working with the lld --gc-sections
218-
// implementation for ELF, unless -z nostart-stop-gc is also passed to lld:
219-
//
220-
// https://reviews.llvm.org/D96914
221-
if (Linker == "lld" || (Linker.length() > 5 &&
222-
Linker.substr(Linker.length() - 6) == "ld.lld")) {
223-
Arguments.push_back("-Xlinker");
224-
Arguments.push_back("-z");
225-
Arguments.push_back("-Xlinker");
226-
Arguments.push_back("nostart-stop-gc");
227-
}
228217
}
229218

230219
// Configure the toolchain.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static const void *__backtraceRef __attribute__((used))
3636
// by the linker. Otherwise, we may end up with undefined symbol references as
3737
// the linker table section was never constructed.
3838
#if defined(__ELF__)
39-
# define DECLARE_EMPTY_METADATA_SECTION(name) __asm__("\t.section " #name ",\"a\"\n");
39+
# define DECLARE_EMPTY_METADATA_SECTION(name) __asm__("\t.section " #name ",\"aR\"\n");
4040
#elif defined(__wasm__)
4141
# define DECLARE_EMPTY_METADATA_SECTION(name) __asm__("\t.section " #name ",\"\",@\n");
4242
#endif

test/Driver/link-time-opt.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// CHECK-SIMPLE-THIN-linux-gnu: clang
1515
// CHECK-SIMPLE-THIN-linux-gnu-DAG: -flto=thin
1616
// CHECK-SIMPLE-THIN-linux-gnu-DAG: -fuse-ld=lld
17-
// CHECK-SIMPLE-THIN-linux-gnu-DAG: -Xlinker -z -Xlinker nostart-stop-gc
1817
// CHECK-SIMPLE-THIN-linux-gnu-DAG: [[BITCODEFILE]]
1918
// CHECK-SIMPLE-THIN-linux-gnu-NOT: swift-autolink-extract
2019

@@ -36,7 +35,6 @@
3635
// CHECK-SIMPLE-FULL-linux-gnu: clang
3736
// CHECK-SIMPLE-FULL-linux-gnu-DAG: -flto=full
3837
// CHECK-SIMPLE-FULL-linux-gnu-DAG: -fuse-ld=lld
39-
// CHECK-SIMPLE-FULL-linux-gnu-DAG: -Xlinker -z -Xlinker nostart-stop-gc
4038
// CHECK-SIMPLE-FULL-linux-gnu-DAG: [[BITCODEFILE]]
4139
// CHECK-SIMPLE-FULL-linux-gnu-NOT: swift-autolink-extract
4240

0 commit comments

Comments
 (0)