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
diff --git a/llvm/include/llvm/MC/MCMachObjectWriter.h b/llvm/include/llvm/MC/MCMachObjectWriter.h
index 63c2a28..ee0a002 100644
--- a/llvm/include/llvm/MC/MCMachObjectWriter.h
+++ b/llvm/include/llvm/MC/MCMachObjectWriter.h
@@ -27,15 +27,11 @@
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;
unsigned LocalDifference_RIT;
protected:
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
- uint32_t CPUSubtype_,
- bool UseAggressiveSymbolFolding_ = false);
+ uint32_t CPUSubtype_);
void setLocalDifferenceRelocationType(unsigned Type) {
LocalDifference_RIT = Type;
@@ -55,7 +51,6 @@
/// @{
bool is64Bit() const { return Is64Bit; }
- bool useAggressiveSymbolFolding() const { return UseAggressiveSymbolFolding; }
uint32_t getCPUType() const { return CPUType; }
uint32_t getCPUSubtype() const { return CPUSubtype; }
unsigned getLocalDifferenceRelocationType() const {
diff --git a/llvm/lib/MC/MCMachObjectTargetWriter.cpp b/llvm/lib/MC/MCMachObjectTargetWriter.cpp
index 146cebf..4ffd6a7 100644
--- a/llvm/lib/MC/MCMachObjectTargetWriter.cpp
+++ b/llvm/lib/MC/MCMachObjectTargetWriter.cpp
@@ -11,12 +11,9 @@
using namespace llvm;
-MCMachObjectTargetWriter::MCMachObjectTargetWriter(
- bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_,
- bool UseAggressiveSymbolFolding_)
- : Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_),
- UseAggressiveSymbolFolding(UseAggressiveSymbolFolding_) {
-}
+MCMachObjectTargetWriter::MCMachObjectTargetWriter(bool Is64Bit_,
+ uint32_t CPUType_,
+ uint32_t CPUSubtype_)
+ : Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_) {}
-MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {
-}
+MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {}
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index 3d06d0f..07a6038 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -703,9 +703,6 @@
SA.isTemporary() && SA.isInSection() && &SecA == &SecB){
return true;
}
- } else {
- if (!TargetObjectWriter->useAggressiveSymbolFolding())
- return false;
}
// If they are not in the same section, we can't compute the diff.
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
index 338fad8..8a6b221 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
@@ -31,8 +31,7 @@
public:
AArch64MachObjectWriter(uint32_t CPUType, uint32_t CPUSubtype)
- : MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype,
- /*UseAggressiveSymbolFolding=*/true) {}
+ : MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
index f1a6d11..5d9b327 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
@@ -49,10 +49,8 @@
const MCSymbol &S, uint64_t FixedValue);
public:
- ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType,
- uint32_t CPUSubtype)
- : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
- /*UseAggressiveSymbolFolding=*/true) {}
+ ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
+ : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
index e14ff50..4c0965a 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
@@ -38,8 +38,7 @@
public:
PPCMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
- : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
- /*UseAggressiveSymbolFolding=*/Is64Bit) {}
+ : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
index 1bf8083..71b8e43 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
@@ -54,10 +54,8 @@
MCValue Target, uint64_t &FixedValue);
public:
- X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,
- uint32_t CPUSubtype)
- : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
- /*UseAggressiveSymbolFolding=*/Is64Bit) {}
+ X86MachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
+ : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
diff --git a/llvm/test/MC/MachO/absolutize.s b/llvm/test/MC/MachO/absolutize.s
index 19917e3..8947c0f 100644
--- a/llvm/test/MC/MachO/absolutize.s
+++ b/llvm/test/MC/MachO/absolutize.s
@@ -6,9 +6,9 @@
xorl %eax,%eax
Ltext_c:
xorl %eax,%eax
-Ltext_d:
+Ltext_d:
xorl %eax,%eax
-
+
movl $(_text_a - _text_b), %eax
Ltext_expr_0 = _text_a - _text_b
movl $(Ltext_expr_0), %eax
@@ -30,9 +30,9 @@
.long 0
Ldata_c:
.long 0
-Ldata_d:
+Ldata_d:
.long 0
-
+
.long _data_a - _data_b
Ldata_expr_0 = _data_a - _data_b
.long Ldata_expr_0
@@ -75,7 +75,7 @@
// CHECK: ('offset', 324)
// CHECK: ('alignment', 0)
// CHECK: ('reloc_offset', 412)
-// CHECK: ('num_reloc', 7)
+// CHECK: ('num_reloc', 3)
// CHECK: ('flags', 0x80000400)
// CHECK: ('reserved1', 0)
// CHECK: ('reserved2', 0)
@@ -85,21 +85,9 @@
// CHECK: (('word-0', 0xa0000027),
// CHECK: ('word-1', 0x0)),
// 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-1', 0x0)),
-// CHECK: # Relocation 6
+// CHECK: # Relocation 2
// CHECK: (('word-0', 0xa1000000),
// CHECK: ('word-1', 0x2)),
// CHECK: ])
@@ -111,8 +99,8 @@
// CHECK: ('size', 44)
// CHECK: ('offset', 367)
// CHECK: ('alignment', 0)
-// CHECK: ('reloc_offset', 468)
-// CHECK: ('num_reloc', 7)
+// CHECK: ('reloc_offset', 436)
+// CHECK: ('num_reloc', 3)
// CHECK: ('flags', 0x0)
// CHECK: ('reserved1', 0)
// CHECK: ('reserved2', 0)
@@ -122,21 +110,9 @@
// CHECK: (('word-0', 0xa0000028),
// CHECK: ('word-1', 0x2b)),
// 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-1', 0x2b)),
-// CHECK: # Relocation 6
+// CHECK: # Relocation 2
// CHECK: (('word-0', 0xa1000000),
// CHECK: ('word-1', 0x2f)),
// CHECK: ])
@@ -146,9 +122,9 @@
// CHECK: # Load Command 1
// CHECK: (('command', 2)
// CHECK: ('size', 24)
-// CHECK: ('symoff', 524)
+// CHECK: ('symoff', 460)
// CHECK: ('nsyms', 4)
-// CHECK: ('stroff', 572)
+// CHECK: ('stroff', 508)
// CHECK: ('strsize', 36)
// CHECK: ('_string_data', '\x00_text_b\x00_data_b\x00_text_a\x00_data_a\x00\x00\x00\x00')
// CHECK: ('_symbols', [
diff --git a/llvm/test/MC/MachO/reloc-diff.s b/llvm/test/MC/MachO/reloc-diff.s
index 601edba..a63a413 100644
--- a/llvm/test/MC/MachO/reloc-diff.s
+++ b/llvm/test/MC/MachO/reloc-diff.s
@@ -1,39 +1,27 @@
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s
// CHECK: # Relocation 0
-// CHECK: (('word-0', 0xa2000014),
+// CHECK: (('word-0', 0xa4000010),
// CHECK: ('word-1', 0x0)),
// CHECK: # Relocation 1
// CHECK: (('word-0', 0xa1000000),
// CHECK: ('word-1', 0x0)),
// CHECK: # Relocation 2
-// CHECK: (('word-0', 0xa4000010),
+// CHECK: (('word-0', 0xa4000008),
// CHECK: ('word-1', 0x0)),
// CHECK: # Relocation 3
// CHECK: (('word-0', 0xa1000000),
// CHECK: ('word-1', 0x0)),
// CHECK: # Relocation 4
-// CHECK: (('word-0', 0xa400000c),
+// CHECK: (('word-0', 0xa4000004),
// CHECK: ('word-1', 0x0)),
// CHECK: # Relocation 5
// CHECK: (('word-0', 0xa1000000),
// CHECK: ('word-1', 0x0)),
// 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-1', 0x0)),
-// CHECK: # Relocation 11
+// CHECK: # Relocation 7
// CHECK: (('word-0', 0xa1000000),
// CHECK: ('word-1', 0x0)),
// CHECK-NEXT: ])
@@ -43,7 +31,7 @@
_external_def:
Ltemp:
ret
-
+
.data
.long _external_def - _local_def
.long Ltemp - _local_def