[clang] 53ee31c - [Fuchsia] Make __start_* / __stop_* symbols hidden
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 25 11:51:08 PDT 2023
Author: Petr Hosek
Date: 2023-08-25T18:50:46Z
New Revision: 53ee31c9871deceaff625dc772d52c0cec520ff9
URL: https://github.com/llvm/llvm-project/commit/53ee31c9871deceaff625dc772d52c0cec520ff9
DIFF: https://github.com/llvm/llvm-project/commit/53ee31c9871deceaff625dc772d52c0cec520ff9.diff
LOG: [Fuchsia] Make __start_* / __stop_* symbols hidden
This is the intended semantics, see for more details:
https://sourceware.org/pipermail/binutils/2020-June/111685.html
Differential Revision: https://reviews.llvm.org/D158822
Added:
Modified:
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/test/Driver/fuchsia.c
clang/test/Driver/fuchsia.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 65692cc7f954cb..af34a46ae4f7d6 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -56,6 +56,9 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-z");
CmdArgs.push_back("now");
+ CmdArgs.push_back("-z");
+ CmdArgs.push_back("start-stop-visibility=hidden");
+
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
if (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") ||
llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")) {
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index e6010c2c51bb00..cfcb8ad0d3ab42 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -36,7 +36,7 @@
// CHECK: "-stack-protector" "2"
// CHECK-AARCH64: "-target-feature" "+outline-atomics"
// CHECK-NOT: "-fcommon"
-// CHECK: {{.*}}ld.lld{{.*}}" "-z" "max-page-size=4096" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments" "-z" "rel" "--pack-dyn-relocs=relr"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "max-page-size=4096" "-z" "now" "-z" "start-stop-visibility=hidden" "-z" "rodynamic" "-z" "separate-loadable-segments" "-z" "rel" "--pack-dyn-relocs=relr"
// CHECK: "--sysroot=[[SYSROOT]]"
// CHECK: "-pie"
// CHECK: "--build-id"
diff --git a/clang/test/Driver/fuchsia.cpp b/clang/test/Driver/fuchsia.cpp
index 0f307811edf80e..69d5cb19041a7a 100644
--- a/clang/test/Driver/fuchsia.cpp
+++ b/clang/test/Driver/fuchsia.cpp
@@ -40,7 +40,7 @@
// CHECK-RISCV64: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}c++{{/|\\\\}}v1"
// CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1"
// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
-// CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "start-stop-visibility=hidden" "-z" "rodynamic" "-z" "separate-loadable-segments" "-z" "rel" "--pack-dyn-relocs=relr"
// CHECK: "--sysroot=[[SYSROOT]]"
// CHECK: "-pie"
// CHECK: "--build-id"
More information about the cfe-commits
mailing list