summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-11-01 02:04:43 +0000
committerRui Ueyama <ruiu@google.com>2017-11-01 02:04:43 +0000
commit700b1f8a56ca2de891bbc8ae99aa47228dc0881d (patch)
tree5d59e799fc8c8a96639436c8da231a543d1d3241
parent6418bff2f350fc222791fcff76b7c9f7a32d2ace (diff)
downloadbcm5719-llvm-700b1f8a56ca2de891bbc8ae99aa47228dc0881d.tar.gz
bcm5719-llvm-700b1f8a56ca2de891bbc8ae99aa47228dc0881d.zip
Add --no-omagic and --no-print-gc-sections.
llvm-svn: 317068
-rw-r--r--lld/ELF/Driver.cpp5
-rw-r--r--lld/ELF/Options.td6
-rw-r--r--lld/test/ELF/gc-sections-print.s6
-rw-r--r--lld/test/ELF/segments.s5
4 files changed, 20 insertions, 2 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index ce7d4a3330c..8176a37c7c4 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -668,14 +668,15 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->NoinhibitExec = Args.hasArg(OPT_noinhibit_exec);
Config->Nostdlib = Args.hasArg(OPT_nostdlib);
Config->OFormatBinary = isOutputFormatBinary(Args);
- Config->Omagic = Args.hasArg(OPT_omagic);
+ Config->Omagic = Args.hasFlag(OPT_omagic, OPT_no_omagic, false);
Config->OptRemarksFilename = Args.getLastArgValue(OPT_opt_remarks_filename);
Config->OptRemarksWithHotness = Args.hasArg(OPT_opt_remarks_with_hotness);
Config->Optimize = getInteger(Args, OPT_O, 1);
Config->OrphanHandling = getOrphanHandling(Args);
Config->OutputFile = Args.getLastArgValue(OPT_o);
Config->Pie = Args.hasFlag(OPT_pie, OPT_nopie, false);
- Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections);
+ Config->PrintGcSections =
+ Args.hasFlag(OPT_print_gc_sections, OPT_no_print_gc_sections, false);
Config->Rpath = getRpath(Args);
Config->Relocatable = Args.hasArg(OPT_relocatable);
Config->SaveTemps = Args.hasArg(OPT_save_temps);
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index d3f6c5e46f8..e326f5b65f0 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -201,6 +201,12 @@ def noinhibit_exec: F<"noinhibit-exec">,
def nopie: F<"nopie">, HelpText<"Do not create a position independent executable">;
+def no_omagic: Flag<["--"], "no-omagic">, MetaVarName<"<magic>">,
+ HelpText<"Do not set the text data sections to be writable">;
+
+def no_print_gc_sections: F<"no-print-gc-sections">,
+ HelpText<"Do not list removed unused sections">;
+
def no_rosegment: F<"no-rosegment">,
HelpText<"Do not put read-only non-executable sections in their own segment">;
diff --git a/lld/test/ELF/gc-sections-print.s b/lld/test/ELF/gc-sections-print.s
index 59177a65367..e05824177c1 100644
--- a/lld/test/ELF/gc-sections-print.s
+++ b/lld/test/ELF/gc-sections-print.s
@@ -5,6 +5,12 @@
# PRINT: removing unused section from '.text.x' in file
# PRINT-NEXT: removing unused section from '.text.y' in file
+# RUN: ld.lld %t --gc-sections --print-gc-sections --no-print-gc-sections -o %t2 >& %t.log
+# RUN: echo >> %t.log
+# RUN: FileCheck -check-prefix=NOPRINT %s < %t.log
+
+# NOPRINT-NOT: removing
+
.globl _start
.protected a, x, y
_start:
diff --git a/lld/test/ELF/segments.s b/lld/test/ELF/segments.s
index 9307ba39fe4..4648ba97a85 100644
--- a/lld/test/ELF/segments.s
+++ b/lld/test/ELF/segments.s
@@ -1,7 +1,10 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
# RUN: ld.lld %t -o %t1
# RUN: llvm-readobj --program-headers %t1 | FileCheck --check-prefix=ROSEGMENT %s
+# RUN: ld.lld --omagic --no-omagic %t -o %t1
+# RUN: llvm-readobj --program-headers %t1 | FileCheck --check-prefix=ROSEGMENT %s
# ROSEGMENT: ProgramHeader {
# ROSEGMENT: Type: PT_LOAD
@@ -76,6 +79,8 @@
# RUN: ld.lld -N %t -o %t3
# RUN: llvm-readobj --program-headers %t3 | FileCheck --check-prefix=OMAGIC %s
+# RUN: ld.lld --omagic %t -o %t3
+# RUN: llvm-readobj --program-headers %t3 | FileCheck --check-prefix=OMAGIC %s
# OMAGIC: ProgramHeader {
# OMAGIC: Type: PT_LOAD
OpenPOWER on IntegriCloud