[PATCH] D62606: [Driver] -static-pie: add -z text
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 29 09:06:44 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: saugustine, sivachandra.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
gcc -static-pie adds -z text.
In ld.bfd and gold, default/-z text/-z notext are tri-state.
By default, text relocations (and DF_TEXTREL) are emitted on demand.
-z text disables that.
In lld, -z text (default) and -z notext are bi-state. This change is a no-op.
Repository:
rC Clang
https://reviews.llvm.org/D62606
Files:
lib/Driver/ToolChains/Gnu.cpp
test/Driver/linux-ld.c
Index: test/Driver/linux-ld.c
===================================================================
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -190,6 +190,8 @@
// CHECK-CLANG-LD-STATIC-PIE: "-static"
// CHECK-CLANG-LD-STATIC-PIE: "-pie"
// CHECK-CLANG-LD-STATIC-PIE: "--no-dynamic-linker"
+// CHECK-CLANG-LD-STATIC-PIE: "-z"
+// CHECK-CLANG-LD-STATIC-PIE: "text"
// CHECK-CLANG-LD-STATIC-PIE: "-m" "elf_x86_64"
// CHECK-CLANG-LD-STATIC-PIE: "{{.*}}rcrt1.o"
// CHECK-CLANG-LD-STATIC-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
@@ -203,6 +205,8 @@
// CHECK-CLANG-LD-STATIC-PIE-PIE: "-static"
// CHECK-CLANG-LD-STATIC-PIE-PIE: "-pie"
// CHECK-CLANG-LD-STATIC-PIE-PIE: "--no-dynamic-linker"
+// CHECK-CLANG-LD-STATIC-PIE-PIE: "-z"
+// CHECK-CLANG-LD-STATIC-PIE-PIE: "text"
// CHECK-CLANG-LD-STATIC-PIE-PIE: "-m" "elf_x86_64"
// CHECK-CLANG-LD-STATIC-PIE-PIE: "{{.*}}rcrt1.o"
// CHECK-CLANG-LD-STATIC-PIE-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
@@ -216,6 +220,8 @@
// CHECK-CLANG-LD-STATIC-PIE-STATIC: "-static"
// CHECK-CLANG-LD-STATIC-PIE-STATIC: "-pie"
// CHECK-CLANG-LD-STATIC-PIE-STATIC: "--no-dynamic-linker"
+// CHECK-CLANG-LD-STATIC-PIE-STATIC: "-z"
+// CHECK-CLANG-LD-STATIC-PIE-STATIC: "text"
// CHECK-CLANG-LD-STATIC-PIE-STATIC: "-m" "elf_x86_64"
// CHECK-CLANG-LD-STATIC-PIE-STATIC: "{{.*}}rcrt1.o"
// CHECK-CLANG-LD-STATIC-PIE-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
Index: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -382,6 +382,8 @@
CmdArgs.push_back("-static");
CmdArgs.push_back("-pie");
CmdArgs.push_back("--no-dynamic-linker");
+ CmdArgs.push_back("-z");
+ CmdArgs.push_back("text");
}
if (ToolChain.isNoExecStackDefault()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62606.201951.patch
Type: text/x-patch
Size: 1883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190529/9431da36/attachment-0001.bin>
More information about the cfe-commits
mailing list