[lld] r317068 - Add --no-omagic and --no-print-gc-sections.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 19:04:43 PDT 2017
Author: ruiu
Date: Tue Oct 31 19:04:43 2017
New Revision: 317068
URL: http://llvm.org/viewvc/llvm-project?rev=317068&view=rev
Log:
Add --no-omagic and --no-print-gc-sections.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Options.td
lld/trunk/test/ELF/gc-sections-print.s
lld/trunk/test/ELF/segments.s
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=317068&r1=317067&r2=317068&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Oct 31 19:04:43 2017
@@ -668,14 +668,15 @@ void LinkerDriver::readConfigs(opt::Inpu
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);
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=317068&r1=317067&r2=317068&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Tue Oct 31 19:04:43 2017
@@ -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">;
Modified: lld/trunk/test/ELF/gc-sections-print.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gc-sections-print.s?rev=317068&r1=317067&r2=317068&view=diff
==============================================================================
--- lld/trunk/test/ELF/gc-sections-print.s (original)
+++ lld/trunk/test/ELF/gc-sections-print.s Tue Oct 31 19:04:43 2017
@@ -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:
Modified: lld/trunk/test/ELF/segments.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/segments.s?rev=317068&r1=317067&r2=317068&view=diff
==============================================================================
--- lld/trunk/test/ELF/segments.s (original)
+++ lld/trunk/test/ELF/segments.s Tue Oct 31 19:04:43 2017
@@ -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
More information about the llvm-commits
mailing list