MC: Remove obsolete MachO UseAggressiveSymbolFolding.
authorJim Grosbach <grosbach@apple.com>
Thu, 4 Jun 2015 20:27:42 +0000 (20:27 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 4 Jun 2015 20:27:42 +0000 (20:27 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239084 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCMachObjectWriter.h
lib/MC/MCMachObjectTargetWriter.cpp
lib/MC/MachObjectWriter.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
test/MC/MachO/absolutize.s
test/MC/MachO/reloc-diff.s

index 63c2a28a7c9c84482fe31b94afb7476e34abcb80..ee0a002ba9681a5fdc1dd087d70d725353ebeef7 100644 (file)
@@ -27,15 +27,11 @@ 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;
   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 @@ public:
   /// @{
 
   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 {
index 146cebf01a3af9ac46bd40bb1d99de071ca5d615..4ffd6a78a61fdb78cb21b1cfc4021b4166e9c03c 100644 (file)
 
 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() {}
index 3d06d0ff32fe83fd5ebf9236ea8df400895dfd08..07a6038c1897d662bbe2b621e1562dcc9561fa65 100644 (file)
@@ -703,9 +703,6 @@ bool MachObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
             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.
index 338fad8e0b1eca6a088e09ec95b17cf01c645c69..8a6b2215aa47c341c629bec2df66ac248db4c8a9 100644 (file)
@@ -31,8 +31,7 @@ class AArch64MachObjectWriter : public MCMachObjectTargetWriter {
 
 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,
index f1a6d111194b64df7afd606953cd5c5beb981a10..5d9b32779813e87e18419d9ae39529c8ce6b4962 100644 (file)
@@ -49,10 +49,8 @@ class ARMMachObjectWriter : public MCMachObjectTargetWriter {
                                 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,
index e14ff50e46b37f8a28b16bc330f19631bfc194d4..4c0965afff16a9cb0a1eb7c92ae895ada62f818a 100644 (file)
@@ -38,8 +38,7 @@ class PPCMachObjectWriter : public MCMachObjectTargetWriter {
 
 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,
index 1bf80834f551eea452abd1eb43cfd20eab60926f..71b8e436c85160c711d63f5ed51e22beeabfe943 100644 (file)
@@ -54,10 +54,8 @@ class X86MachObjectWriter : public MCMachObjectTargetWriter {
                               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,
index 19917e3bae1c02d6216b4b5f534b9663151c76b4..8947c0f65e536087f7c48c5affd42ed8d1f9c499 100644 (file)
@@ -6,9 +6,9 @@ _text_b:
         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 @@ _data_b:
         .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 @@ Ldata_expr_2 = Ldata_d - Ldata_c
 // 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 @@ Ldata_expr_2 = Ldata_d - Ldata_c
 // 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 @@ Ldata_expr_2 = Ldata_d - Ldata_c
 // 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 @@ Ldata_expr_2 = Ldata_d - Ldata_c
 // 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 @@ Ldata_expr_2 = Ldata_d - Ldata_c
 // 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', [
index 601edba47b42b6dc2724f3d40a08e13f726e9b82..a63a413f24b61a9b4e07ff87a4d62dd23b3dc48b 100644 (file)
@@ -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 @@ _local_def:
 _external_def:
 Ltemp:
         ret
-        
+
         .data
         .long _external_def - _local_def
         .long Ltemp - _local_def