зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1751817 - Pass --rtlib=libgcc to clang when building for Android. r=firefox-build-system-reviewers,andi
Instead of forcing it via a patch to clang itself (which now conflicts with other changes on clang trunk, although the conflict is benign). Because of https://github.com/llvm/llvm-project/issues/53397 we need to narrow down the warnings that trigger errors in the check for `pthread_cond_timedwait_monotonic_np`. Differential Revision: https://phabricator.services.mozilla.com/D136850
This commit is contained in:
Родитель
209e7cc15f
Коммит
773fa3be25
|
@ -13,7 +13,6 @@
|
|||
"compiler-rt-13-no-codesign.patch",
|
||||
"win64-no-symlink.patch",
|
||||
"revert-llvmorg-13-init-8182-gc2297544c047.patch",
|
||||
"revert-llvmorg-13-init-4019-ga478b0a199f4.patch",
|
||||
"revert-llvmorg-12-init-7827-g2a078c307204.patch",
|
||||
"llvmorg-14-init-2833-gbadcd5858972.patch",
|
||||
"llvmorg-14-init-3166-gd9ab62ca3d29.patch",
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
"revert-llvmorg-14-init-3652-gf3c2094d8c11.patch",
|
||||
"revert-llvmorg-14-init-3651-g85ba583eba19.patch",
|
||||
"revert-llvmorg-14-init-3650-g50d7ecc560b2.patch",
|
||||
"revert-llvmorg-13-init-8182-gc2297544c047.patch",
|
||||
"revert-llvmorg-13-init-4019-ga478b0a199f4.patch"
|
||||
"revert-llvmorg-13-init-8182-gc2297544c047.patch"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
index c9360fc67165..b9451bde3dd8 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -310,12 +310,6 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
||||
}
|
||||
|
||||
-ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
|
||||
- if (getTriple().isAndroid())
|
||||
- return ToolChain::RLT_CompilerRT;
|
||||
- return Generic_ELF::GetDefaultRuntimeLibType();
|
||||
-}
|
||||
-
|
||||
ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {
|
||||
if (getTriple().isAndroid())
|
||||
return ToolChain::CST_Libcxx;
|
||||
diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
|
||||
index 169a37c44072..65897631715a 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Linux.h
|
||||
+++ b/clang/lib/Driver/ToolChains/Linux.h
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
- RuntimeLibType GetDefaultRuntimeLibType() const override;
|
||||
CXXStdlibType GetDefaultCXXStdlibType() const override;
|
||||
bool
|
||||
IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const override;
|
||||
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
|
||||
index cc505588331b..fc43acd07644 100644
|
||||
--- a/clang/test/Driver/linux-ld.c
|
||||
+++ b/clang/test/Driver/linux-ld.c
|
||||
@@ -283,7 +283,7 @@
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-CLANG-ANDROID-NONE %s
|
||||
// CHECK-CLANG-ANDROID-NONE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
-// CHECK-CLANG-ANDROID-NONE: "-l:libunwind.a" "-ldl" "-lc"
|
||||
+// CHECK-CLANG-ANDROID-NONE: "-lgcc" "-ldl" "-lc"
|
||||
//
|
||||
// RUN: %clang -shared -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
|
||||
@@ -291,7 +291,7 @@
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-CLANG-ANDROID-SHARED %s
|
||||
// CHECK-CLANG-ANDROID-SHARED: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
-// CHECK-CLANG-ANDROID-SHARED: "-l:libunwind.a" "-ldl" "-lc"
|
||||
+// CHECK-CLANG-ANDROID-SHARED: "-lgcc" "-ldl" "-lc"
|
||||
//
|
||||
// RUN: %clang -static -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=aarch64-linux-android -rtlib=platform --unwindlib=platform \
|
||||
@@ -299,7 +299,7 @@
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-CLANG-ANDROID-STATIC %s
|
||||
// CHECK-CLANG-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
-// CHECK-CLANG-ANDROID-STATIC: "--start-group" "{{[^"]*}}{{/|\\\\}}libclang_rt.builtins-aarch64-android.a" "-l:libunwind.a" "-lc" "--end-group"
|
||||
+// CHECK-CLANG-ANDROID-STATIC: "--start-group" "-lgcc" "-lc" "--end-group"
|
||||
//
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=x86_64-unknown-linux -rtlib=platform --unwindlib=platform \
|
||||
@@ -1081,12 +1081,10 @@
|
||||
// CHECK-ANDROID: "--enable-new-dtags"
|
||||
// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
|
||||
// CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
|
||||
-// CHECK-ANDROID-NOT: "-lgcc_s"
|
||||
-// CHECK-ANDROID-NOT: "-lgcc"
|
||||
-// CHECK-ANDROID: "-l:libunwind.a"
|
||||
+// CHECK-ANDROID-NOT: "gcc_s"
|
||||
+// CHECK-ANDROID: "-lgcc"
|
||||
// CHECK-ANDROID: "-ldl"
|
||||
-// CHECK-ANDROID-NOT: "-lgcc_s"
|
||||
-// CHECK-ANDROID-NOT: "-lgcc"
|
||||
+// CHECK-ANDROID-NOT: "gcc_s"
|
||||
// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtend_android.o"
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
|
||||
@@ -1139,12 +1137,10 @@
|
||||
// CHECK-ANDROID-SO-NOT: "-Bsymbolic"
|
||||
// CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtbegin_so.o"
|
||||
// CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
|
||||
-// CHECK-ANDROID-SO-NOT: "-lgcc_s"
|
||||
-// CHECK-ANDROID-SO-NOT: "-lgcc"
|
||||
-// CHECK-ANDROID-SO: "-l:libunwind.a"
|
||||
+// CHECK-ANDROID-SO-NOT: "gcc_s"
|
||||
+// CHECK-ANDROID-SO: "-lgcc"
|
||||
// CHECK-ANDROID-SO: "-ldl"
|
||||
-// CHECK-ANDROID-SO-NOT: "-lgcc_s"
|
||||
-// CHECK-ANDROID-SO-NOT: "-lgcc"
|
||||
+// CHECK-ANDROID-SO-NOT: "gcc_s"
|
||||
// CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtend_so.o"
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
|
||||
@@ -1195,12 +1191,10 @@
|
||||
// CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
// CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtbegin_static.o"
|
||||
// CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
|
||||
-// CHECK-ANDROID-STATIC-NOT: "-lgcc_eh"
|
||||
-// CHECK-ANDROID-STATIC-NOT: "-lgcc"
|
||||
-// CHECK-ANDROID-STATIC: "-l:libunwind.a"
|
||||
+// CHECK-ANDROID-STATIC-NOT: "gcc_s"
|
||||
+// CHECK-ANDROID-STATIC: "-lgcc"
|
||||
// CHECK-ANDROID-STATIC-NOT: "-ldl"
|
||||
-// CHECK-ANDROID-STATIC-NOT: "-lgcc_eh"
|
||||
-// CHECK-ANDROID-STATIC-NOT: "-lgcc"
|
||||
+// CHECK-ANDROID-STATIC-NOT: "gcc_s"
|
||||
// CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtend_android.o"
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-androideabi -rtlib=platform --unwindlib=platform \
|
||||
@@ -1253,11 +1247,9 @@
|
||||
// CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
|
||||
// CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
|
||||
-// CHECK-ANDROID-PIE-NOT: "-lgcc_s"
|
||||
-// CHECK-ANDROID-PIE-NOT: "-lgcc"
|
||||
-// CHECK-ANDROID-PIE: "-l:libunwind.a"
|
||||
-// CHECK-ANDROID-PIE-NOT: "-lgcc_s"
|
||||
-// CHECK-ANDROID-PIE-NOT: "-lgcc"
|
||||
+// CHECK-ANDROID-PIE-NOT: "gcc_s"
|
||||
+// CHECK-ANDROID-PIE: "-lgcc"
|
||||
+// CHECK-ANDROID-PIE-NOT: "gcc_s"
|
||||
// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o"
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-androideabi \
|
|
@ -1273,6 +1273,11 @@ def compiler(
|
|||
if info.flags:
|
||||
raise FatalCheckError("Unknown compiler or compiler not supported.")
|
||||
|
||||
# Recent clang defaults to compiler-rt, but we want libgcc for compat
|
||||
# with the older NDKs we use.
|
||||
if host_or_target.os == "Android":
|
||||
flags.append("--rtlib=libgcc")
|
||||
|
||||
return namespace(
|
||||
wrapper=wrapper,
|
||||
compiler=compiler,
|
||||
|
|
|
@ -79,6 +79,7 @@ case "$target" in
|
|||
"
|
||||
# These flags are only necessary to pass the cmake tests.
|
||||
exe_linker_flags="
|
||||
--rtlib=libgcc
|
||||
-L$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$ndk_target/$api_level
|
||||
-L$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$ndk_target
|
||||
"
|
||||
|
|
|
@ -2971,7 +2971,7 @@ with only_when(compile_environment):
|
|||
body="pthread_cond_timedwait_monotonic_np(0, 0, 0);",
|
||||
# -Werror to catch any "implicit declaration" warning that means the function
|
||||
# is not supported.
|
||||
flags=["-Werror"],
|
||||
flags=["-Werror=implicit-function-declaration"],
|
||||
check_msg="for pthread_cond_timedwait_monotonic_np",
|
||||
),
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче