forked from OSchip/llvm-project
[Driver] Default to `-z now` and `-z relro` on Android.
Summary: RTLD_LAZY is not supported on Android (though failing to use `-z now` will work since it is assumed by the loader). RelRO is required. Reviewers: srhines, pirama Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53117 llvm-svn: 344295
This commit is contained in:
parent
2600e0946b
commit
e4dd75a9cb
|
@ -229,12 +229,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
|||
|
||||
Distro Distro(D.getVFS());
|
||||
|
||||
if (Distro.IsAlpineLinux()) {
|
||||
if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
|
||||
ExtraOpts.push_back("-z");
|
||||
ExtraOpts.push_back("now");
|
||||
}
|
||||
|
||||
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
|
||||
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
|
||||
Triple.isAndroid()) {
|
||||
ExtraOpts.push_back("-z");
|
||||
ExtraOpts.push_back("relro");
|
||||
}
|
||||
|
|
|
@ -1255,6 +1255,8 @@
|
|||
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
|
||||
// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
// CHECK-ANDROID: "-z" "now"
|
||||
// CHECK-ANDROID: "-z" "relro"
|
||||
// CHECK-ANDROID: "--enable-new-dtags"
|
||||
// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
|
||||
// CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
|
||||
|
|
Loading…
Reference in New Issue