OSDN Git Service

Move RelaxELFRel out to llvm-mc.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 29 May 2016 01:11:00 +0000 (01:11 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 29 May 2016 01:11:00 +0000 (01:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271160 91177308-0d34-0410-b5e6-96231b3b80d8

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

index d4cbba7..b879e6d 100644 (file)
@@ -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; }
 };
 }
 
index e6fdf57..b7c56ce 100644 (file)
@@ -35,10 +35,6 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(ATT),
              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 Triple &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 *
index d9e3798..e25cfd4 100644 (file)
@@ -52,6 +52,10 @@ OutputFilename("o", cl::desc("Output filename"),
 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