diff options
| author | George Rimar <grimar@accesssoftek.com> | 2016-11-29 09:43:51 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2016-11-29 09:43:51 +0000 |
| commit | 595a763f38ced2cb994903acdf36e8b76b99edf7 (patch) | |
| tree | 15dfa230bdf4fe1471a7831eaab3b0165cc01146 /lld/ELF | |
| parent | 91c1fc29944d5f623ed2232637fed2555427b33e (diff) | |
| download | bcm5719-llvm-595a763f38ced2cb994903acdf36e8b76b99edf7.tar.gz bcm5719-llvm-595a763f38ced2cb994903acdf36e8b76b99edf7.zip | |
[ELF] - Implemented -N (-omagic) command line option.
-N (-omagic)
Set the text and data sections to be readable and writable.
Also, do not page-align the data segment.
Differential revision: https://reviews.llvm.org/D26888
llvm-svn: 288123
Diffstat (limited to 'lld/ELF')
| -rw-r--r-- | lld/ELF/Config.h | 1 | ||||
| -rw-r--r-- | lld/ELF/Driver.cpp | 1 | ||||
| -rw-r--r-- | lld/ELF/Options.td | 4 | ||||
| -rw-r--r-- | lld/ELF/Writer.cpp | 2 |
4 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index e7c731240b6..31ecd264803 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -114,6 +114,7 @@ struct Configuration { bool NoUndefinedVersion; bool Nostdlib; bool OFormatBinary; + bool OMagic; bool Pic; bool Pie; bool PrintGcSections; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index ab3b77fc2bf..9356168b180 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -526,6 +526,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique); Config->NoUndefinedVersion = Args.hasArg(OPT_no_undefined_version); Config->Nostdlib = Args.hasArg(OPT_nostdlib); + Config->OMagic = Args.hasArg(OPT_omagic); Config->Pie = getArg(Args, OPT_pie, OPT_nopie, false); Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections); Config->Relocatable = Args.hasArg(OPT_relocatable); diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index c7e7e7838f4..4530796e7a5 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -161,6 +161,9 @@ def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, def oformat: Separate<["--"], "oformat">, MetaVarName<"<format>">, HelpText<"Specify the binary format for the output object file">; +def omagic: F<"omagic">, MetaVarName<"<magic>">, + HelpText<"Set the text and data sections to be readable and writable">; + def pie: F<"pie">, HelpText<"Create a position independent executable">; def print_gc_sections: F<"print-gc-sections">, @@ -261,6 +264,7 @@ def alias_format_b: S<"b">, Alias<format>; def alias_hash_style_hash_style: J<"hash-style=">, Alias<hash_style>; def alias_init_init: J<"init=">, Alias<init>; def alias_l__library: J<"library=">, Alias<l>; +def alias_omagic: Flag<["-"], "N">, Alias<omagic>; def alias_o_output: Joined<["--"], "output=">, Alias<o>; def alias_o_output2 : Separate<["--"], "output">, Alias<o>; def alias_pie_pic_executable: F<"pic-executable">, Alias<pie>; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index b74c2511b83..2fd2dc3e282 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1096,6 +1096,8 @@ template <class ELFT> static bool needsPtLoad(OutputSectionBase *Sec) { // cannot create a PT_LOAD there. template <class ELFT> static typename ELFT::uint computeFlags(typename ELFT::uint F) { + if (Config->OMagic) + return PF_R | PF_W | PF_X; if (Config->SingleRoRx && !(F & PF_W)) return F | PF_X; return F; |

