Skip to content

Commit 7c76b4c

Browse files
author
Jim Grosbach
committed
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
1 parent a2498cc commit 7c76b4c

File tree

9 files changed

+28
-81
lines changed

9 files changed

+28
-81
lines changed

llvm/include/llvm/MC/MCMachObjectWriter.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ class MCMachObjectTargetWriter {
2727
const unsigned Is64Bit : 1;
2828
const uint32_t CPUType;
2929
const uint32_t CPUSubtype;
30-
// FIXME: Remove this, we should just always use it once we no longer care
31-
// about Darwin 'as' compatibility.
32-
const unsigned UseAggressiveSymbolFolding : 1;
3330
unsigned LocalDifference_RIT;
3431

3532
protected:
3633
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
37-
uint32_t CPUSubtype_,
38-
bool UseAggressiveSymbolFolding_ = false);
34+
uint32_t CPUSubtype_);
3935

4036
void setLocalDifferenceRelocationType(unsigned Type) {
4137
LocalDifference_RIT = Type;
@@ -55,7 +51,6 @@ class MCMachObjectTargetWriter {
5551
/// @{
5652

5753
bool is64Bit() const { return Is64Bit; }
58-
bool useAggressiveSymbolFolding() const { return UseAggressiveSymbolFolding; }
5954
uint32_t getCPUType() const { return CPUType; }
6055
uint32_t getCPUSubtype() const { return CPUSubtype; }
6156
unsigned getLocalDifferenceRelocationType() const {

llvm/lib/MC/MCMachObjectTargetWriter.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@
1111

1212
using namespace llvm;
1313

14-
MCMachObjectTargetWriter::MCMachObjectTargetWriter(
15-
bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_,
16-
bool UseAggressiveSymbolFolding_)
17-
: Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_),
18-
UseAggressiveSymbolFolding(UseAggressiveSymbolFolding_) {
19-
}
14+
MCMachObjectTargetWriter::MCMachObjectTargetWriter(bool Is64Bit_,
15+
uint32_t CPUType_,
16+
uint32_t CPUSubtype_)
17+
: Is64Bit(Is64Bit_), CPUType(CPUType_), CPUSubtype(CPUSubtype_) {}
2018

21-
MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {
22-
}
19+
MCMachObjectTargetWriter::~MCMachObjectTargetWriter() {}

llvm/lib/MC/MachObjectWriter.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,6 @@ bool MachObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
703703
SA.isTemporary() && SA.isInSection() && &SecA == &SecB){
704704
return true;
705705
}
706-
} else {
707-
if (!TargetObjectWriter->useAggressiveSymbolFolding())
708-
return false;
709706
}
710707

711708
// If they are not in the same section, we can't compute the diff.

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class AArch64MachObjectWriter : public MCMachObjectTargetWriter {
3131

3232
public:
3333
AArch64MachObjectWriter(uint32_t CPUType, uint32_t CPUSubtype)
34-
: MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype,
35-
/*UseAggressiveSymbolFolding=*/true) {}
34+
: MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype) {}
3635

3736
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
3837
const MCAsmLayout &Layout, const MCFragment *Fragment,

llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ class ARMMachObjectWriter : public MCMachObjectTargetWriter {
4949
const MCSymbol &S, uint64_t FixedValue);
5050

5151
public:
52-
ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType,
53-
uint32_t CPUSubtype)
54-
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
55-
/*UseAggressiveSymbolFolding=*/true) {}
52+
ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
53+
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
5654

5755
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
5856
const MCAsmLayout &Layout, const MCFragment *Fragment,

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ class PPCMachObjectWriter : public MCMachObjectTargetWriter {
3838

3939
public:
4040
PPCMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
41-
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
42-
/*UseAggressiveSymbolFolding=*/Is64Bit) {}
41+
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
4342

4443
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
4544
const MCAsmLayout &Layout, const MCFragment *Fragment,

llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ class X86MachObjectWriter : public MCMachObjectTargetWriter {
5454
MCValue Target, uint64_t &FixedValue);
5555

5656
public:
57-
X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,
58-
uint32_t CPUSubtype)
59-
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
60-
/*UseAggressiveSymbolFolding=*/Is64Bit) {}
57+
X86MachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
58+
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
6159

6260
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
6361
const MCAsmLayout &Layout, const MCFragment *Fragment,

llvm/test/MC/MachO/absolutize.s

+11-35
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ _text_b:
66
xorl %eax,%eax
77
Ltext_c:
88
xorl %eax,%eax
9-
Ltext_d:
9+
Ltext_d:
1010
xorl %eax,%eax
11-
11+
1212
movl $(_text_a - _text_b), %eax
1313
Ltext_expr_0 = _text_a - _text_b
1414
movl $(Ltext_expr_0), %eax
@@ -30,9 +30,9 @@ _data_b:
3030
.long 0
3131
Ldata_c:
3232
.long 0
33-
Ldata_d:
33+
Ldata_d:
3434
.long 0
35-
35+
3636
.long _data_a - _data_b
3737
Ldata_expr_0 = _data_a - _data_b
3838
.long Ldata_expr_0
@@ -75,7 +75,7 @@ Ldata_expr_2 = Ldata_d - Ldata_c
7575
// CHECK: ('offset', 324)
7676
// CHECK: ('alignment', 0)
7777
// CHECK: ('reloc_offset', 412)
78-
// CHECK: ('num_reloc', 7)
78+
// CHECK: ('num_reloc', 3)
7979
// CHECK: ('flags', 0x80000400)
8080
// CHECK: ('reserved1', 0)
8181
// CHECK: ('reserved2', 0)
@@ -85,21 +85,9 @@ Ldata_expr_2 = Ldata_d - Ldata_c
8585
// CHECK: (('word-0', 0xa0000027),
8686
// CHECK: ('word-1', 0x0)),
8787
// CHECK: # Relocation 1
88-
// CHECK: (('word-0', 0xa400001d),
89-
// CHECK: ('word-1', 0x6)),
90-
// CHECK: # Relocation 2
91-
// CHECK: (('word-0', 0xa1000000),
92-
// CHECK: ('word-1', 0x4)),
93-
// CHECK: # Relocation 3
94-
// CHECK: (('word-0', 0xa4000013),
95-
// CHECK: ('word-1', 0x4)),
96-
// CHECK: # Relocation 4
97-
// CHECK: (('word-0', 0xa1000000),
98-
// CHECK: ('word-1', 0x2)),
99-
// CHECK: # Relocation 5
10088
// CHECK: (('word-0', 0xa4000009),
10189
// CHECK: ('word-1', 0x0)),
102-
// CHECK: # Relocation 6
90+
// CHECK: # Relocation 2
10391
// CHECK: (('word-0', 0xa1000000),
10492
// CHECK: ('word-1', 0x2)),
10593
// CHECK: ])
@@ -111,8 +99,8 @@ Ldata_expr_2 = Ldata_d - Ldata_c
11199
// CHECK: ('size', 44)
112100
// CHECK: ('offset', 367)
113101
// CHECK: ('alignment', 0)
114-
// CHECK: ('reloc_offset', 468)
115-
// CHECK: ('num_reloc', 7)
102+
// CHECK: ('reloc_offset', 436)
103+
// CHECK: ('num_reloc', 3)
116104
// CHECK: ('flags', 0x0)
117105
// CHECK: ('reserved1', 0)
118106
// CHECK: ('reserved2', 0)
@@ -122,21 +110,9 @@ Ldata_expr_2 = Ldata_d - Ldata_c
122110
// CHECK: (('word-0', 0xa0000028),
123111
// CHECK: ('word-1', 0x2b)),
124112
// CHECK: # Relocation 1
125-
// CHECK: (('word-0', 0xa4000020),
126-
// CHECK: ('word-1', 0x37)),
127-
// CHECK: # Relocation 2
128-
// CHECK: (('word-0', 0xa1000000),
129-
// CHECK: ('word-1', 0x33)),
130-
// CHECK: # Relocation 3
131-
// CHECK: (('word-0', 0xa4000018),
132-
// CHECK: ('word-1', 0x33)),
133-
// CHECK: # Relocation 4
134-
// CHECK: (('word-0', 0xa1000000),
135-
// CHECK: ('word-1', 0x2f)),
136-
// CHECK: # Relocation 5
137113
// CHECK: (('word-0', 0xa4000010),
138114
// CHECK: ('word-1', 0x2b)),
139-
// CHECK: # Relocation 6
115+
// CHECK: # Relocation 2
140116
// CHECK: (('word-0', 0xa1000000),
141117
// CHECK: ('word-1', 0x2f)),
142118
// CHECK: ])
@@ -146,9 +122,9 @@ Ldata_expr_2 = Ldata_d - Ldata_c
146122
// CHECK: # Load Command 1
147123
// CHECK: (('command', 2)
148124
// CHECK: ('size', 24)
149-
// CHECK: ('symoff', 524)
125+
// CHECK: ('symoff', 460)
150126
// CHECK: ('nsyms', 4)
151-
// CHECK: ('stroff', 572)
127+
// CHECK: ('stroff', 508)
152128
// CHECK: ('strsize', 36)
153129
// CHECK: ('_string_data', '\x00_text_b\x00_data_b\x00_text_a\x00_data_a\x00\x00\x00\x00')
154130
// CHECK: ('_symbols', [

llvm/test/MC/MachO/reloc-diff.s

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,27 @@
11
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s
22

33
// CHECK: # Relocation 0
4-
// CHECK: (('word-0', 0xa2000014),
4+
// CHECK: (('word-0', 0xa4000010),
55
// CHECK: ('word-1', 0x0)),
66
// CHECK: # Relocation 1
77
// CHECK: (('word-0', 0xa1000000),
88
// CHECK: ('word-1', 0x0)),
99
// CHECK: # Relocation 2
10-
// CHECK: (('word-0', 0xa4000010),
10+
// CHECK: (('word-0', 0xa4000008),
1111
// CHECK: ('word-1', 0x0)),
1212
// CHECK: # Relocation 3
1313
// CHECK: (('word-0', 0xa1000000),
1414
// CHECK: ('word-1', 0x0)),
1515
// CHECK: # Relocation 4
16-
// CHECK: (('word-0', 0xa400000c),
16+
// CHECK: (('word-0', 0xa4000004),
1717
// CHECK: ('word-1', 0x0)),
1818
// CHECK: # Relocation 5
1919
// CHECK: (('word-0', 0xa1000000),
2020
// CHECK: ('word-1', 0x0)),
2121
// CHECK: # Relocation 6
22-
// CHECK: (('word-0', 0xa4000008),
23-
// CHECK: ('word-1', 0x0)),
24-
// CHECK: # Relocation 7
25-
// CHECK: (('word-0', 0xa1000000),
26-
// CHECK: ('word-1', 0x0)),
27-
// CHECK: # Relocation 8
28-
// CHECK: (('word-0', 0xa4000004),
29-
// CHECK: ('word-1', 0x0)),
30-
// CHECK: # Relocation 9
31-
// CHECK: (('word-0', 0xa1000000),
32-
// CHECK: ('word-1', 0x0)),
33-
// CHECK: # Relocation 10
3422
// CHECK: (('word-0', 0xa2000000),
3523
// CHECK: ('word-1', 0x0)),
36-
// CHECK: # Relocation 11
24+
// CHECK: # Relocation 7
3725
// CHECK: (('word-0', 0xa1000000),
3826
// CHECK: ('word-1', 0x0)),
3927
// CHECK-NEXT: ])
@@ -43,7 +31,7 @@ _local_def:
4331
_external_def:
4432
Ltemp:
4533
ret
46-
34+
4735
.data
4836
.long _external_def - _local_def
4937
.long Ltemp - _local_def

0 commit comments

Comments
 (0)