Skip to content

Commit

Permalink
[MC] Move CompressDebugSections/RelaxELFRelocations from TargetOption…
Browse files Browse the repository at this point in the history
…s/MCAsmInfo to MCTargetOptions

The convention is for such MC-specific options to reside in
MCTargetOptions. However, CompressDebugSections/RelaxELFRelocations do
not follow the convention: `CompressDebugSections` is defined in both
TargetOptions and MCAsmInfo and there is forwarding complexity.

Move the option to MCTargetOptions and hereby simplify the code. Rename
the misleading RelaxELFRelocations to X86RelaxRelocations. llvm-mc
-relax-relocations and llc -x86-relax-relocations can now be unified.
  • Loading branch information
MaskRay committed Mar 7, 2024
1 parent 886ecb3 commit a331937
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 83 deletions.
5 changes: 3 additions & 2 deletions clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion);
Options.UseInitArray = CodeGenOpts.UseInitArray;
Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
Options.CompressDebugSections = CodeGenOpts.getCompressDebugSections();
Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations;

// Set EABI version.
Options.EABIVersion = TargetOpts.EABIVersion;
Expand Down Expand Up @@ -460,6 +458,9 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose;
Options.MCOptions.Dwarf64 = CodeGenOpts.Dwarf64;
Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments;
Options.MCOptions.X86RelaxRelocations = CodeGenOpts.RelaxELFRelocations;
Options.MCOptions.CompressDebugSections =
CodeGenOpts.getCompressDebugSections();
Options.MCOptions.ABIName = TargetOpts.ABI;
for (const auto &Entry : HSOpts.UserEntries)
if (!Entry.IsFramework &&
Expand Down
4 changes: 2 additions & 2 deletions clang/tools/driver/cc1as_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
MCTargetOptions MCOptions;
MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
MCOptions.X86RelaxRelocations = Opts.RelaxELFRelocations;
MCOptions.CompressDebugSections = Opts.CompressDebugSections;
MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;

std::unique_ptr<MCAsmInfo> MAI(
Expand All @@ -436,9 +438,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,

// Ensure MCAsmInfo initialization occurs before any use, otherwise sections
// may be created with a combination of default and explicit settings.
MAI->setCompressDebugSections(Opts.CompressDebugSections);

MAI->setRelaxELFRelocations(Opts.RelaxELFRelocations);

bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
if (Opts.OutputPath.empty())
Expand Down
2 changes: 1 addition & 1 deletion lld/test/ELF/weak-undef-got-pie.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/dummy-shared.s -o %t1.o
# RUN: ld.lld %t1.o -shared -o %t1.so
# RUN: llvm-mc -filetype=obj -relax-relocations=false -triple=x86_64 %s -o %t.o
# RUN: llvm-mc -filetype=obj -x86-relax-relocations=false -triple=x86_64 %s -o %t.o

# RUN: ld.lld -pie %t.o %t1.so -o %t
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCS %s
Expand Down
2 changes: 0 additions & 2 deletions llvm/include/llvm/CodeGen/CommandFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ bool getUseCtors();

bool getDisableIntegratedAS();

bool getRelaxELFRelocations();

bool getDataSections();
std::optional<bool> getExplicitDataSections();

Expand Down
16 changes: 0 additions & 16 deletions llvm/include/llvm/MC/MCAsmInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,17 +524,10 @@ class MCAsmInfo {
/// Preserve Comments in assembly
bool PreserveAsmComments;

/// Compress DWARF debug sections. Defaults to no compression.
DebugCompressionType CompressDebugSections = DebugCompressionType::None;

/// True if the integrated assembler should interpret 'a >> b' constant
/// expressions as logical rather than arithmetic.
bool UseLogicalShr = true;

// If true, emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL, on
// X86_64 ELF.
bool RelaxELFRelocations = true;

// If true, then the lexer and expression parser will support %neg(),
// %hi(), and similar unary operators.
bool HasMipsExpressions = false;
Expand Down Expand Up @@ -875,18 +868,9 @@ class MCAsmInfo {
PreserveAsmComments = Value;
}

DebugCompressionType compressDebugSections() const {
return CompressDebugSections;
}

void setCompressDebugSections(DebugCompressionType CompressDebugSections) {
this->CompressDebugSections = CompressDebugSections;
}

bool shouldUseLogicalShr() const { return UseLogicalShr; }

bool canRelaxRelocations() const { return RelaxELFRelocations; }
void setRelaxELFRelocations(bool V) { RelaxELFRelocations = V; }
bool hasMipsExpressions() const { return HasMipsExpressions; }
bool needsFunctionDescriptors() const { return NeedsFunctionDescriptors; }
bool shouldUseMotorolaIntegers() const { return UseMotorolaIntegers; }
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/MC/MCContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ class MCContext {

const MCSubtargetInfo *getSubtargetInfo() const { return MSTI; }

const MCTargetOptions *getTargetOptions() const { return TargetOptions; }

CodeViewContext &getCVContext();

void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
Expand Down
7 changes: 7 additions & 0 deletions llvm/include/llvm/MC/MCTargetOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class MCTargetOptions {

bool Dwarf64 : 1;

// If true, prefer R_X86_64_[REX_]GOTPCRELX to R_X86_64_GOTPCREL on x86-64
// ELF.
bool X86RelaxRelocations = true;

EmitDwarfUnwindType EmitDwarfUnwind;

int DwarfVersion = 0;
Expand All @@ -76,6 +80,9 @@ class MCTargetOptions {
};
DwarfDirectory MCUseDwarfDirectory;

// Whether to compress DWARF debug sections.
DebugCompressionType CompressDebugSections = DebugCompressionType::None;

std::string ABIName;
std::string AssemblyLanguage;
std::string SplitDwarfFile;
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ bool getNoDeprecatedWarn();

bool getNoTypeCheck();

bool getX86RelaxRelocations();

std::string getABIName();

std::string getAsSecureLogFile();
Expand Down
29 changes: 12 additions & 17 deletions llvm/include/llvm/Target/TargetOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,18 @@ namespace llvm {
HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
EnableFastISel(false), EnableGlobalISel(false), UseInitArray(false),
DisableIntegratedAS(false), RelaxELFRelocations(true),
FunctionSections(false), DataSections(false),
IgnoreXCOFFVisibility(false), XCOFFTracebackTable(true),
UniqueSectionNames(true), UniqueBasicBlockSectionNames(false),
TrapUnreachable(false), NoTrapAfterNoreturn(false), TLSSize(0),
EmulatedTLS(false), EnableTLSDESC(false), EnableIPRA(false),
EmitStackSizeSection(false), EnableMachineOutliner(false),
EnableMachineFunctionSplitter(false), SupportsDefaultOutlining(false),
EmitAddrsig(false), BBAddrMap(false), EmitCallSiteInfo(false),
SupportsDebugEntryValues(false), EnableDebugEntryValues(false),
ValueTrackingVariableLocations(false), ForceDwarfFrameSection(false),
XRayFunctionIndex(true), DebugStrictDwarf(false), Hotpatch(false),
DisableIntegratedAS(false), FunctionSections(false),
DataSections(false), IgnoreXCOFFVisibility(false),
XCOFFTracebackTable(true), UniqueSectionNames(true),
UniqueBasicBlockSectionNames(false), TrapUnreachable(false),
NoTrapAfterNoreturn(false), TLSSize(0), EmulatedTLS(false),
EnableTLSDESC(false), EnableIPRA(false), EmitStackSizeSection(false),
EnableMachineOutliner(false), EnableMachineFunctionSplitter(false),
SupportsDefaultOutlining(false), EmitAddrsig(false), BBAddrMap(false),
EmitCallSiteInfo(false), SupportsDebugEntryValues(false),
EnableDebugEntryValues(false), ValueTrackingVariableLocations(false),
ForceDwarfFrameSection(false), XRayFunctionIndex(true),
DebugStrictDwarf(false), Hotpatch(false),
PPCGenScalarMASSEntries(false), JMCInstrument(false),
EnableCFIFixup(false), MisExpect(false), XCOFFReadOnlyPointers(false),
FPDenormalMode(DenormalMode::IEEE, DenormalMode::IEEE) {}
Expand Down Expand Up @@ -260,11 +260,6 @@ namespace llvm {
/// Disable the integrated assembler.
unsigned DisableIntegratedAS : 1;

/// Compress DWARF debug sections.
DebugCompressionType CompressDebugSections = DebugCompressionType::None;

unsigned RelaxELFRelocations : 1;

/// Emit functions into separate sections.
unsigned FunctionSections : 1;

Expand Down
9 changes: 0 additions & 9 deletions llvm/lib/CodeGen/CommandFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ CGOPT(bool, StackRealign)
CGOPT(std::string, TrapFuncName)
CGOPT(bool, UseCtors)
CGOPT(bool, DisableIntegratedAS)
CGOPT(bool, RelaxELFRelocations)
CGOPT_EXP(bool, DataSections)
CGOPT_EXP(bool, FunctionSections)
CGOPT(bool, IgnoreXCOFFVisibility)
Expand Down Expand Up @@ -362,13 +361,6 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
cl::init(false));
CGBINDOPT(UseCtors);

static cl::opt<bool> RelaxELFRelocations(
"x86-relax-relocations",
cl::desc(
"Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"),
cl::init(true));
CGBINDOPT(RelaxELFRelocations);

static cl::opt<bool> DataSections(
"data-sections", cl::desc("Emit data into separate sections"),
cl::init(false));
Expand Down Expand Up @@ -568,7 +560,6 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.StackSymbolOrdering = getStackSymbolOrdering();
Options.UseInitArray = !getUseCtors();
Options.DisableIntegratedAS = getDisableIntegratedAS();
Options.RelaxELFRelocations = getRelaxELFRelocations();
Options.DataSections =
getExplicitDataSections().value_or(TheTriple.hasDefaultDataSections());
Options.FunctionSections = getFunctionSections();
Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/CodeGen/LLVMTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ void LLVMTargetMachine::initAsmInfo() {

TmpAsmInfo->setPreserveAsmComments(Options.MCOptions.PreserveAsmComments);

TmpAsmInfo->setCompressDebugSections(Options.CompressDebugSections);

TmpAsmInfo->setRelaxELFRelocations(Options.RelaxELFRelocations);

TmpAsmInfo->setFullRegisterNames(Options.MCOptions.PPCUseFullRegisterNames);

if (Options.ExceptionModel != ExceptionHandling::None)
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ void llvm::computeLTOCacheKey(
AddString(Conf.CPU);
// FIXME: Hash more of Options. For now all clients initialize Options from
// command-line flags (which is unsupported in production), but may set
// RelaxELFRelocations. The clang driver can also pass FunctionSections,
// X86RelaxRelocations. The clang driver can also pass FunctionSections,
// DataSections and DebuggerTuning via command line flags.
AddUnsigned(Conf.Options.RelaxELFRelocations);
AddUnsigned(Conf.Options.MCOptions.X86RelaxRelocations);
AddUnsigned(Conf.Options.FunctionSections);
AddUnsigned(Conf.Options.DataSections);
AddUnsigned((unsigned)Conf.Options.DebuggerTuning);
Expand Down
9 changes: 4 additions & 5 deletions llvm/lib/MC/ELFObjectWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,11 +875,10 @@ void ELFWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec,
const MCAsmLayout &Layout) {
MCSectionELF &Section = static_cast<MCSectionELF &>(Sec);
StringRef SectionName = Section.getName();

auto &MC = Asm.getContext();
const auto &MAI = MC.getAsmInfo();

const DebugCompressionType CompressionType = MAI->compressDebugSections();
auto &Ctx = Asm.getContext();
const DebugCompressionType CompressionType =
Ctx.getTargetOptions() ? Ctx.getTargetOptions()->CompressDebugSections
: DebugCompressionType::None;
if (CompressionType == DebugCompressionType::None ||
!SectionName.starts_with(".debug_")) {
Asm.writeSectionData(W.OS, &Section, Layout);
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ MCOPT(bool, FatalWarnings)
MCOPT(bool, NoWarn)
MCOPT(bool, NoDeprecatedWarn)
MCOPT(bool, NoTypeCheck)
MCOPT(bool, X86RelaxRelocations)
MCOPT(std::string, ABIName)
MCOPT(std::string, AsSecureLogFile)

Expand Down Expand Up @@ -122,6 +123,13 @@ llvm::mc::RegisterMCTargetOptionsFlags::RegisterMCTargetOptionsFlags() {
"no-type-check", cl::desc("Suppress type errors (Wasm)"));
MCBINDOPT(NoTypeCheck);

static cl::opt<bool> X86RelaxRelocations(
"x86-relax-relocations",
cl::desc(
"Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"),
cl::init(true));
MCBINDOPT(X86RelaxRelocations);

static cl::opt<std::string> ABIName(
"target-abi", cl::Hidden,
cl::desc("The name of the ABI to be targeted from the backend."),
Expand All @@ -148,6 +156,7 @@ MCTargetOptions llvm::mc::InitMCTargetOptionsFromFlags() {
Options.MCNoWarn = getNoWarn();
Options.MCNoDeprecatedWarn = getNoDeprecatedWarn();
Options.MCNoTypeCheck = getNoTypeCheck();
Options.X86RelaxRelocations = getX86RelaxRelocations();
Options.EmitDwarfUnwind = getEmitDwarfUnwind();
Options.EmitCompactUnwindNonCanonical = getEmitCompactUnwindNonCanonical();
Options.AsSecureLogFile = getAsSecureLogFile();
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc,
// Older versions of ld.bfd/ld.gold/lld
// do not support GOTPCRELX/REX_GOTPCRELX,
// and we want to keep back-compatibility.
if (!Ctx.getAsmInfo()->canRelaxRelocations())
if (!Ctx.getTargetOptions()->X86RelaxRelocations)
return ELF::R_X86_64_GOTPCREL;
switch (unsigned(Kind)) {
default:
Expand Down Expand Up @@ -259,7 +259,7 @@ static unsigned getRelocType32(MCContext &Ctx, SMLoc Loc,
return ELF::R_386_GOTPC;
// Older versions of ld.bfd/ld.gold/lld do not support R_386_GOT32X and we
// want to maintain compatibility.
if (!Ctx.getAsmInfo()->canRelaxRelocations())
if (!Ctx.getTargetOptions()->X86RelaxRelocations)
return ELF::R_386_GOT32;

return Kind == MCFixupKind(X86::reloc_signed_4byte_relax)
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/X86/X86MCInstLower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,13 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
const MCSymbolRefExpr *Sym = MCSymbolRefExpr::create(
MCInstLowering.GetSymbolFromOperand(MI.getOperand(3)), SRVK, Ctx);

// As of binutils 2.32, ld has a bogus TLS relaxation error when the GD/LD
// Before binutils 2.41, ld has a bogus TLS relaxation error when the GD/LD
// code sequence using R_X86_64_GOTPCREL (instead of R_X86_64_GOTPCRELX) is
// attempted to be relaxed to IE/LE (binutils PR24784). Work around the bug by
// only using GOT when GOTPCRELX is enabled.
// TODO Delete the workaround when GOTPCRELX becomes commonplace.
// TODO Delete the workaround when rustc no longer relies on the hack
bool UseGot = MMI->getModule()->getRtLibUseGOT() &&
Ctx.getAsmInfo()->canRelaxRelocations();
Ctx.getTargetOptions()->X86RelaxRelocations;

if (Is64Bits) {
bool NeedsPadding = SRVK == MCSymbolRefExpr::VK_TLSGD;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/ExecutionEngine/JITLink/AArch64/ELF_minimal.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -relax-relocations=false \
# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -x86-relax-relocations=false \
# RUN: -position-independent -filetype=obj -o %t/elf_minimal.o %s
# RUN: llvm-jitlink -noexec %t/elf_minimal.o

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -relax-relocations=false \
# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -x86-relax-relocations=false \
# RUN: -position-independent -filetype=obj -o %t/elf_reloc.o %s
# RUN: llvm-jitlink -noexec \
# RUN: -abs external_data=0xdeadbeef \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-windows-msvc -relax-relocations=false \
# RUN: llvm-mc -triple=x86_64-windows-msvc -x86-relax-relocations=false \
# RUN: -position-independent -filetype=obj -o %t/coff_sm_reloc.o %s
# RUN: llvm-jitlink -noexec \
# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/ExecutionEngine/JITLink/x86-64/ELF_common_var.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=x86_64-unknown-linux -relax-relocations=false -position-independent -filetype=obj -o %t/elf_common.o %s
# RUN: llvm-mc -triple=x86_64-unknown-linux -x86-relax-relocations=false -position-independent -filetype=obj -o %t/elf_common.o %s
# RUN: llvm-jitlink -entry=load_common -noexec -check %s %t/elf_common.o
#
# Check that common variable GOT entry is synthesized correctly.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/MC/ELF/got-relaxed-i386.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux %s -o - | llvm-readobj -r - | FileCheck %s
// RUN: llvm-mc -filetype=obj -relax-relocations=false -triple i386-pc-linux %s -o - | llvm-readobj -r - | FileCheck --check-prefix=OLD %s
// RUN: llvm-mc -filetype=obj -x86-relax-relocations=false -triple i386-pc-linux %s -o - | llvm-readobj -r - | FileCheck --check-prefix=OLD %s

movl mov@GOT(%ebx), %eax
mull mul@GOT(%ebx)
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/MC/ELF/relocation-386.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -relax-relocations=false -o - | llvm-readobj -r - | FileCheck %s --check-prefix=CHECK --check-prefix=I386
// RUN: llvm-mc -filetype=obj -triple i386-pc-elfiamcu %s -relax-relocations=false -o - | llvm-readobj -r - | FileCheck %s --check-prefix=CHECK --check-prefix=IAMCU
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -x86-relax-relocations=false -o - | llvm-readobj -r - | FileCheck %s --check-prefix=CHECK --check-prefix=I386
// RUN: llvm-mc -filetype=obj -triple i386-pc-elfiamcu %s -x86-relax-relocations=false -o - | llvm-readobj -r - | FileCheck %s --check-prefix=CHECK --check-prefix=IAMCU
// RUN: not llvm-mc -filetype=obj -triple=i686 --defsym ERR=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:

// Test that we produce the correct relocation types and that the relocations
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/MC/X86/gotpcrelx.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: llvm-readobj -r %t.o | FileCheck %s --check-prefixes=CHECK,COMMON
# RUN: llvm-mc -filetype=obj -triple=x86_64 -relax-relocations=false %s -o %t1.o
# RUN: llvm-mc -filetype=obj -triple=x86_64 -x86-relax-relocations=false %s -o %t1.o
# RUN: llvm-readobj -r %t1.o | FileCheck %s --check-prefixes=NORELAX,COMMON

# COMMON: Relocations [
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/gold/gold-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite,

// Disable the new X86 relax relocations since gold might not support them.
// FIXME: Check the gold version or add a new option to enable them.
Conf.Options.RelaxELFRelocations = false;
Conf.Options.MCOptions.X86RelaxRelocations = false;

// Toggle function/data sections.
if (!codegen::getExplicitFunctionSections())
Expand Down
Loading

0 comments on commit a331937

Please sign in to comment.