mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
MC/Mach-O: On second thought, use a custom hook for enabling aggressive
IsSymbolRefDifferenceFullyResolved, it turns out this does change behavior on enough cases for x86-32 that I would rather wait a bit on it. - In practice, we will want to change this eventually because it only means we generate less relocations (it also eliminates the need for the horrible '.set' hack that Darwin requires in some places). llvm-svn: 122042
This commit is contained in:
parent
14208868a4
commit
6979fc1057
@ -19,10 +19,14 @@ class MCMachObjectTargetWriter {
|
||||
const unsigned Is64Bit : 1;
|
||||
const uint32_t CPUType;
|
||||
const uint32_t CPUSubtype;
|
||||
// FIXME: Remove this, we should just always use it once we no longer care
|
||||
// about Darwin 'as' compatibility.
|
||||
const unsigned UseAggressiveSymbolFolding : 1;
|
||||
|
||||
protected:
|
||||
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
|
||||
uint32_t CPUSubtype_);
|
||||
uint32_t CPUSubtype_,
|
||||
bool UseAggressiveSymbolFolding_ = false);
|
||||
|
||||
public:
|
||||
virtual ~MCMachObjectTargetWriter();
|
||||
@ -31,6 +35,7 @@ public:
|
||||
/// @{
|
||||
|
||||
bool is64Bit() const { return Is64Bit; }
|
||||
bool useAggressiveSymbolFolding() const { return UseAggressiveSymbolFolding; }
|
||||
uint32_t getCPUType() const { return CPUType; }
|
||||
uint32_t getCPUSubtype() const { return CPUSubtype; }
|
||||
|
||||
|
@ -12,8 +12,10 @@
|
||||
using namespace llvm;
|
||||
|
||||
MCMachObjectTargetWriter::MCMachObjectTargetWriter(
|
||||
bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_)
|
||||
: Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_) {
|
||||
bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_,
|
||||
bool UseAggressiveSymbolFolding_)
|
||||
: Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_),
|
||||
UseAggressiveSymbolFolding(UseAggressiveSymbolFolding_) {
|
||||
}
|
||||
|
||||
MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {
|
||||
|
@ -1126,6 +1126,9 @@ public:
|
||||
bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
|
||||
const MCSymbolRefExpr *A,
|
||||
const MCSymbolRefExpr *B) const {
|
||||
if (!TargetObjectWriter->useAggressiveSymbolFolding())
|
||||
return false;
|
||||
|
||||
// The effective address is
|
||||
// addr(atom(A)) + offset(A)
|
||||
// - addr(atom(B)) - offset(B)
|
||||
|
@ -50,7 +50,8 @@ class X86MachObjectWriter : public MCMachObjectTargetWriter {
|
||||
public:
|
||||
X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,
|
||||
uint32_t CPUSubtype)
|
||||
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
|
||||
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
|
||||
/*UseAggressiveSymbolFolding=*/Is64Bit) {}
|
||||
};
|
||||
|
||||
class X86AsmBackend : public TargetAsmBackend {
|
||||
|
Loading…
x
Reference in New Issue
Block a user