[llvm] r271160 - Move RelaxELFRel out to llvm-mc.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Sat May 28 18:11:06 PDT 2016


Author: rafael
Date: Sat May 28 20:11:00 2016
New Revision: 271160

URL: http://llvm.org/viewvc/llvm-project?rev=271160&view=rev
Log:
Move RelaxELFRel out to llvm-mc.

Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
    llvm/trunk/tools/llvm-mc/llvm-mc.cpp

Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=271160&r1=271159&r2=271160&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Sat May 28 20:11:00 2016
@@ -371,7 +371,7 @@ protected:
 
   // If true, emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL, on
   // X86_64 ELF.
-  bool RelaxELFRelocations;
+  bool RelaxELFRelocations = false;
 
 public:
   explicit MCAsmInfo();
@@ -582,6 +582,7 @@ public:
   bool shouldUseLogicalShr() const { return UseLogicalShr; }
 
   bool canRelaxRelocations() const { return RelaxELFRelocations; }
+  void setRelaxELFRelocations(bool V) { RelaxELFRelocations = V; }
 };
 }
 

Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp?rev=271160&r1=271159&r2=271160&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp Sat May 28 20:11:00 2016
@@ -35,10 +35,6 @@ AsmWriterFlavor("x86-asm-syntax", cl::in
              clEnumValEnd));
 
 static cl::opt<bool>
-RelaxELFRel("relax-relocations", cl::init(false),
-  cl::desc("Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL"));
-
-static cl::opt<bool>
 MarkedJTDataRegions("mark-data-regions", cl::init(true),
   cl::desc("Mark code section jump table data regions."),
   cl::Hidden);
@@ -115,8 +111,6 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const T
   // Always enable the integrated assembler by default.
   // Clang also enabled it when the OS is Solaris but that is redundant here.
   UseIntegratedAssembler = true;
-
-  RelaxELFRelocations = RelaxELFRel;
 }
 
 const MCExpr *

Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=271160&r1=271159&r2=271160&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Sat May 28 20:11:00 2016
@@ -52,6 +52,10 @@ OutputFilename("o", cl::desc("Output fil
 static cl::opt<bool>
 ShowEncoding("show-encoding", cl::desc("Show instruction encodings"));
 
+static cl::opt<bool>
+RelaxELFRel("relax-relocations", cl::init(false),
+  cl::desc("Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL"));
+
 static cl::opt<DebugCompressionType>
 CompressDebugSections("compress-debug-sections", cl::ValueOptional,
   cl::init(DebugCompressionType::DCT_None),
@@ -416,6 +420,8 @@ int main(int argc, char **argv) {
   std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
   assert(MAI && "Unable to create target asm info!");
 
+  MAI->setRelaxELFRelocations(RelaxELFRel);
+
   if (CompressDebugSections != DebugCompressionType::DCT_None) {
     if (!zlib::isAvailable()) {
       errs() << ProgName




More information about the llvm-commits mailing list