forked from OSchip/llvm-project
MC: Remove obsolete MachO UseAggressiveSymbolFolding.
Fix the FIXME and remove this old as(1) compat option. It was useful for bringup of the integrated assembler to diff object files, but now it's just causing more relocations than strictly necessary to be generated. rdar://21201804 llvm-svn: 239084
This commit is contained in:
parent
a2498cc51a
commit
7c76b4cc6e
|
@ -27,15 +27,11 @@ class MCMachObjectTargetWriter {
|
||||||
const unsigned Is64Bit : 1;
|
const unsigned Is64Bit : 1;
|
||||||
const uint32_t CPUType;
|
const uint32_t CPUType;
|
||||||
const uint32_t CPUSubtype;
|
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;
|
|
||||||
unsigned LocalDifference_RIT;
|
unsigned LocalDifference_RIT;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
|
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
|
||||||
uint32_t CPUSubtype_,
|
uint32_t CPUSubtype_);
|
||||||
bool UseAggressiveSymbolFolding_ = false);
|
|
||||||
|
|
||||||
void setLocalDifferenceRelocationType(unsigned Type) {
|
void setLocalDifferenceRelocationType(unsigned Type) {
|
||||||
LocalDifference_RIT = Type;
|
LocalDifference_RIT = Type;
|
||||||
|
@ -55,7 +51,6 @@ public:
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
bool is64Bit() const { return Is64Bit; }
|
bool is64Bit() const { return Is64Bit; }
|
||||||
bool useAggressiveSymbolFolding() const { return UseAggressiveSymbolFolding; }
|
|
||||||
uint32_t getCPUType() const { return CPUType; }
|
uint32_t getCPUType() const { return CPUType; }
|
||||||
uint32_t getCPUSubtype() const { return CPUSubtype; }
|
uint32_t getCPUSubtype() const { return CPUSubtype; }
|
||||||
unsigned getLocalDifferenceRelocationType() const {
|
unsigned getLocalDifferenceRelocationType() const {
|
||||||
|
|
|
@ -11,12 +11,9 @@
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MCMachObjectTargetWriter::MCMachObjectTargetWriter(
|
MCMachObjectTargetWriter::MCMachObjectTargetWriter(bool Is64Bit_,
|
||||||
bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_,
|
uint32_t CPUType_,
|
||||||
bool UseAggressiveSymbolFolding_)
|
uint32_t CPUSubtype_)
|
||||||
: Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_),
|
: Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_) {}
|
||||||
UseAggressiveSymbolFolding(UseAggressiveSymbolFolding_) {
|
|
||||||
}
|
|
||||||
|
|
||||||
MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {
|
MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {}
|
||||||
}
|
|
||||||
|
|
|
@ -703,9 +703,6 @@ bool MachObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
||||||
SA.isTemporary() && SA.isInSection() && &SecA == &SecB){
|
SA.isTemporary() && SA.isInSection() && &SecA == &SecB){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!TargetObjectWriter->useAggressiveSymbolFolding())
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If they are not in the same section, we can't compute the diff.
|
// If they are not in the same section, we can't compute the diff.
|
||||||
|
|
|
@ -31,8 +31,7 @@ class AArch64MachObjectWriter : public MCMachObjectTargetWriter {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AArch64MachObjectWriter(uint32_t CPUType, uint32_t CPUSubtype)
|
AArch64MachObjectWriter(uint32_t CPUType, uint32_t CPUSubtype)
|
||||||
: MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype,
|
: MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype) {}
|
||||||
/*UseAggressiveSymbolFolding=*/true) {}
|
|
||||||
|
|
||||||
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
||||||
|
|
|
@ -49,10 +49,8 @@ class ARMMachObjectWriter : public MCMachObjectTargetWriter {
|
||||||
const MCSymbol &S, uint64_t FixedValue);
|
const MCSymbol &S, uint64_t FixedValue);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType,
|
ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
|
||||||
uint32_t CPUSubtype)
|
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
|
||||||
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
|
|
||||||
/*UseAggressiveSymbolFolding=*/true) {}
|
|
||||||
|
|
||||||
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
||||||
|
|
|
@ -38,8 +38,7 @@ class PPCMachObjectWriter : public MCMachObjectTargetWriter {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PPCMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
|
PPCMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
|
||||||
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
|
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
|
||||||
/*UseAggressiveSymbolFolding=*/Is64Bit) {}
|
|
||||||
|
|
||||||
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
||||||
|
|
|
@ -54,10 +54,8 @@ class X86MachObjectWriter : public MCMachObjectTargetWriter {
|
||||||
MCValue Target, uint64_t &FixedValue);
|
MCValue Target, uint64_t &FixedValue);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,
|
X86MachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
|
||||||
uint32_t CPUSubtype)
|
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
|
||||||
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
|
|
||||||
/*UseAggressiveSymbolFolding=*/Is64Bit) {}
|
|
||||||
|
|
||||||
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
const MCAsmLayout &Layout, const MCFragment *Fragment,
|
||||||
|
|
|
@ -75,7 +75,7 @@ Ldata_expr_2 = Ldata_d - Ldata_c
|
||||||
// CHECK: ('offset', 324)
|
// CHECK: ('offset', 324)
|
||||||
// CHECK: ('alignment', 0)
|
// CHECK: ('alignment', 0)
|
||||||
// CHECK: ('reloc_offset', 412)
|
// CHECK: ('reloc_offset', 412)
|
||||||
// CHECK: ('num_reloc', 7)
|
// CHECK: ('num_reloc', 3)
|
||||||
// CHECK: ('flags', 0x80000400)
|
// CHECK: ('flags', 0x80000400)
|
||||||
// CHECK: ('reserved1', 0)
|
// CHECK: ('reserved1', 0)
|
||||||
// CHECK: ('reserved2', 0)
|
// CHECK: ('reserved2', 0)
|
||||||
|
@ -85,21 +85,9 @@ Ldata_expr_2 = Ldata_d - Ldata_c
|
||||||
// CHECK: (('word-0', 0xa0000027),
|
// CHECK: (('word-0', 0xa0000027),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 1
|
// CHECK: # Relocation 1
|
||||||
// CHECK: (('word-0', 0xa400001d),
|
|
||||||
// CHECK: ('word-1', 0x6)),
|
|
||||||
// CHECK: # Relocation 2
|
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
|
||||||
// CHECK: ('word-1', 0x4)),
|
|
||||||
// CHECK: # Relocation 3
|
|
||||||
// CHECK: (('word-0', 0xa4000013),
|
|
||||||
// CHECK: ('word-1', 0x4)),
|
|
||||||
// CHECK: # Relocation 4
|
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
|
||||||
// CHECK: ('word-1', 0x2)),
|
|
||||||
// CHECK: # Relocation 5
|
|
||||||
// CHECK: (('word-0', 0xa4000009),
|
// CHECK: (('word-0', 0xa4000009),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 6
|
// CHECK: # Relocation 2
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
// CHECK: (('word-0', 0xa1000000),
|
||||||
// CHECK: ('word-1', 0x2)),
|
// CHECK: ('word-1', 0x2)),
|
||||||
// CHECK: ])
|
// CHECK: ])
|
||||||
|
@ -111,8 +99,8 @@ Ldata_expr_2 = Ldata_d - Ldata_c
|
||||||
// CHECK: ('size', 44)
|
// CHECK: ('size', 44)
|
||||||
// CHECK: ('offset', 367)
|
// CHECK: ('offset', 367)
|
||||||
// CHECK: ('alignment', 0)
|
// CHECK: ('alignment', 0)
|
||||||
// CHECK: ('reloc_offset', 468)
|
// CHECK: ('reloc_offset', 436)
|
||||||
// CHECK: ('num_reloc', 7)
|
// CHECK: ('num_reloc', 3)
|
||||||
// CHECK: ('flags', 0x0)
|
// CHECK: ('flags', 0x0)
|
||||||
// CHECK: ('reserved1', 0)
|
// CHECK: ('reserved1', 0)
|
||||||
// CHECK: ('reserved2', 0)
|
// CHECK: ('reserved2', 0)
|
||||||
|
@ -122,21 +110,9 @@ Ldata_expr_2 = Ldata_d - Ldata_c
|
||||||
// CHECK: (('word-0', 0xa0000028),
|
// CHECK: (('word-0', 0xa0000028),
|
||||||
// CHECK: ('word-1', 0x2b)),
|
// CHECK: ('word-1', 0x2b)),
|
||||||
// CHECK: # Relocation 1
|
// CHECK: # Relocation 1
|
||||||
// CHECK: (('word-0', 0xa4000020),
|
|
||||||
// CHECK: ('word-1', 0x37)),
|
|
||||||
// CHECK: # Relocation 2
|
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
|
||||||
// CHECK: ('word-1', 0x33)),
|
|
||||||
// CHECK: # Relocation 3
|
|
||||||
// CHECK: (('word-0', 0xa4000018),
|
|
||||||
// CHECK: ('word-1', 0x33)),
|
|
||||||
// CHECK: # Relocation 4
|
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
|
||||||
// CHECK: ('word-1', 0x2f)),
|
|
||||||
// CHECK: # Relocation 5
|
|
||||||
// CHECK: (('word-0', 0xa4000010),
|
// CHECK: (('word-0', 0xa4000010),
|
||||||
// CHECK: ('word-1', 0x2b)),
|
// CHECK: ('word-1', 0x2b)),
|
||||||
// CHECK: # Relocation 6
|
// CHECK: # Relocation 2
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
// CHECK: (('word-0', 0xa1000000),
|
||||||
// CHECK: ('word-1', 0x2f)),
|
// CHECK: ('word-1', 0x2f)),
|
||||||
// CHECK: ])
|
// CHECK: ])
|
||||||
|
@ -146,9 +122,9 @@ Ldata_expr_2 = Ldata_d - Ldata_c
|
||||||
// CHECK: # Load Command 1
|
// CHECK: # Load Command 1
|
||||||
// CHECK: (('command', 2)
|
// CHECK: (('command', 2)
|
||||||
// CHECK: ('size', 24)
|
// CHECK: ('size', 24)
|
||||||
// CHECK: ('symoff', 524)
|
// CHECK: ('symoff', 460)
|
||||||
// CHECK: ('nsyms', 4)
|
// CHECK: ('nsyms', 4)
|
||||||
// CHECK: ('stroff', 572)
|
// CHECK: ('stroff', 508)
|
||||||
// CHECK: ('strsize', 36)
|
// CHECK: ('strsize', 36)
|
||||||
// CHECK: ('_string_data', '\x00_text_b\x00_data_b\x00_text_a\x00_data_a\x00\x00\x00\x00')
|
// CHECK: ('_string_data', '\x00_text_b\x00_data_b\x00_text_a\x00_data_a\x00\x00\x00\x00')
|
||||||
// CHECK: ('_symbols', [
|
// CHECK: ('_symbols', [
|
||||||
|
|
|
@ -1,39 +1,27 @@
|
||||||
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s
|
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s
|
||||||
|
|
||||||
// CHECK: # Relocation 0
|
// CHECK: # Relocation 0
|
||||||
// CHECK: (('word-0', 0xa2000014),
|
// CHECK: (('word-0', 0xa4000010),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 1
|
// CHECK: # Relocation 1
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
// CHECK: (('word-0', 0xa1000000),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 2
|
// CHECK: # Relocation 2
|
||||||
// CHECK: (('word-0', 0xa4000010),
|
// CHECK: (('word-0', 0xa4000008),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 3
|
// CHECK: # Relocation 3
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
// CHECK: (('word-0', 0xa1000000),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 4
|
// CHECK: # Relocation 4
|
||||||
// CHECK: (('word-0', 0xa400000c),
|
// CHECK: (('word-0', 0xa4000004),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 5
|
// CHECK: # Relocation 5
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
// CHECK: (('word-0', 0xa1000000),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 6
|
// CHECK: # Relocation 6
|
||||||
// CHECK: (('word-0', 0xa4000008),
|
|
||||||
// CHECK: ('word-1', 0x0)),
|
|
||||||
// CHECK: # Relocation 7
|
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
|
||||||
// CHECK: ('word-1', 0x0)),
|
|
||||||
// CHECK: # Relocation 8
|
|
||||||
// CHECK: (('word-0', 0xa4000004),
|
|
||||||
// CHECK: ('word-1', 0x0)),
|
|
||||||
// CHECK: # Relocation 9
|
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
|
||||||
// CHECK: ('word-1', 0x0)),
|
|
||||||
// CHECK: # Relocation 10
|
|
||||||
// CHECK: (('word-0', 0xa2000000),
|
// CHECK: (('word-0', 0xa2000000),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK: # Relocation 11
|
// CHECK: # Relocation 7
|
||||||
// CHECK: (('word-0', 0xa1000000),
|
// CHECK: (('word-0', 0xa1000000),
|
||||||
// CHECK: ('word-1', 0x0)),
|
// CHECK: ('word-1', 0x0)),
|
||||||
// CHECK-NEXT: ])
|
// CHECK-NEXT: ])
|
||||||
|
|
Loading…
Reference in New Issue