[lld] r288021 - [ELF] - Set Config->SingleRoRx differently. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 02:11:10 PST 2016


Author: grimar
Date: Mon Nov 28 04:11:10 2016
New Revision: 288021

URL: http://llvm.org/viewvc/llvm-project?rev=288021&view=rev
Log:
[ELF] - Set Config->SingleRoRx differently. NFC.

Previously Config->SingleRoRx was set in
createFiles() and used HasSections.

This change moves it to readConfigs at place of
common flags handling, and adds logic that sets
this flag separatelly from ScriptParser if SECTIONS present.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=288021&r1=288020&r2=288021&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Nov 28 04:11:10 2016
@@ -530,6 +530,7 @@ void LinkerDriver::readConfigs(opt::Inpu
   Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections);
   Config->Relocatable = Args.hasArg(OPT_relocatable);
   Config->SaveTemps = Args.hasArg(OPT_save_temps);
+  Config->SingleRoRx = Args.hasArg(OPT_no_rosegment);
   Config->Shared = Args.hasArg(OPT_shared);
   Config->Target1Rel = getArg(Args, OPT_target1_rel, OPT_target1_abs, false);
   Config->Threads = getArg(Args, OPT_threads, OPT_no_threads, true);
@@ -696,12 +697,6 @@ void LinkerDriver::createFiles(opt::Inpu
     }
   }
 
-  // -no-rosegment is used to avoid placing read only non-executable sections in
-  // their own segment. We do the same if SECTIONS command is present in linker
-  // script. See comment for computeFlags().
-  Config->SingleRoRx =
-      Args.hasArg(OPT_no_rosegment) || ScriptConfig->HasSections;
-
   if (Files.empty() && ErrorCount == 0)
     error("no input files");
 }

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=288021&r1=288020&r2=288021&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Nov 28 04:11:10 2016
@@ -1262,6 +1262,11 @@ void ScriptParser::readSearchDir() {
 
 void ScriptParser::readSections() {
   Opt.HasSections = true;
+  // -no-rosegment is used to avoid placing read only non-executable sections in
+  // their own segment. We do the same if SECTIONS command is present in linker
+  // script. See comment for computeFlags().
+  Config->SingleRoRx = true;
+
   expect("{");
   while (!Error && !consume("}")) {
     StringRef Tok = next();




More information about the llvm-commits mailing list