From c615a826fd3586f83ef3d6f542b8e3a29432fcd3 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sun, 29 May 2016 01:11:00 +0000 Subject: [PATCH] Move RelaxELFRel out to llvm-mc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271160 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCAsmInfo.h | 3 ++- lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp | 6 ------ tools/llvm-mc/llvm-mc.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h index d4cbba7a728..b879e6d43e2 100644 --- a/include/llvm/MC/MCAsmInfo.h +++ b/include/llvm/MC/MCAsmInfo.h @@ -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; } }; } diff --git a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp index e6fdf57ed18..b7c56cec2db 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp @@ -35,10 +35,6 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(ATT), clEnumValEnd)); static cl::opt -RelaxELFRel("relax-relocations", cl::init(false), - cl::desc("Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL")); - -static cl::opt 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 * diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index d9e3798ee88..e25cfd4d5bf 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -52,6 +52,10 @@ OutputFilename("o", cl::desc("Output filename"), static cl::opt ShowEncoding("show-encoding", cl::desc("Show instruction encodings")); +static cl::opt +RelaxELFRel("relax-relocations", cl::init(false), + cl::desc("Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL")); + static cl::opt CompressDebugSections("compress-debug-sections", cl::ValueOptional, cl::init(DebugCompressionType::DCT_None), @@ -416,6 +420,8 @@ int main(int argc, char **argv) { std::unique_ptr 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 -- 2.11.0