[PATCH] D53117: [Driver] Default to `-z now` and `-z relro` on Android.

Dan Albert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 11 13:59:49 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC344295: [Driver] Default to `-z now` and `-z relro` on Android. (authored by danalbert, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53117?vs=169133&id=169300#toc

Repository:
  rC Clang

https://reviews.llvm.org/D53117

Files:
  lib/Driver/ToolChains/Linux.cpp
  test/Driver/linux-ld.c


Index: test/Driver/linux-ld.c
===================================================================
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -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"
Index: lib/Driver/ToolChains/Linux.cpp
===================================================================
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -229,12 +229,13 @@
 
   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");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53117.169300.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181011/a3e7c0e7/attachment.bin>


More information about the cfe-commits mailing list