[llvm] r228976 - Learn that __DATA, __objc_classrefs is not atomized via symbols.
Rafael Espindola
rafael.espindola at gmail.com
Thu Feb 12 15:11:59 PST 2015
Author: rafael
Date: Thu Feb 12 17:11:59 2015
New Revision: 228976
URL: http://llvm.org/viewvc/llvm-project?rev=228976&view=rev
Log:
Learn that __DATA,__objc_classrefs is not atomized via symbols.
This should hopefully fix objc on AArch64.
Added:
llvm/trunk/test/MC/MachO/AArch64/classrefs.s
Modified:
llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=228976&r1=228975&r2=228976&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Thu Feb 12 17:11:59 2015
@@ -33,6 +33,10 @@ bool MCAsmInfoDarwin::isSectionAtomizabl
if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring")
return false;
+ if (SMO.getSegmentName() == "__DATA" &&
+ SMO.getSectionName() == "__objc_classrefs")
+ return false;
+
switch (SMO.getType()) {
default:
return true;
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=228976&r1=228975&r2=228976&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp Thu Feb 12 17:11:59 2015
@@ -134,6 +134,10 @@ static bool canUseLocalRelocation(const
RefSec.getSectionName() == "__cfstring")
return false;
+ if (RefSec.getSegmentName() == "__DATA" &&
+ RefSec.getSectionName() == "__objc_classrefs")
+ return false;
+
return true;
}
Added: llvm/trunk/test/MC/MachO/AArch64/classrefs.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/AArch64/classrefs.s?rev=228976&view=auto
==============================================================================
--- llvm/trunk/test/MC/MachO/AArch64/classrefs.s (added)
+++ llvm/trunk/test/MC/MachO/AArch64/classrefs.s Thu Feb 12 17:11:59 2015
@@ -0,0 +1,25 @@
+; RUN: llvm-mc -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
+
+; Test that we produce an external relocation with Lbar. We could also produce
+; an internal relocation. We just have to be careful to not use another symbol.
+
+// CHECK: Relocations [
+// CHECK-NEXT: Section __data {
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x0
+// CHECK-NEXT: PCRel: 0
+// CHECK-NEXT: Length: 3
+// CHECK-NEXT: Extern: 1
+// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
+// CHECK-NEXT: Symbol: Lbar
+// CHECK-NEXT: Scattered: 0
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
+
+ .section __DATA,__objc_classrefs,regular,no_dead_strip
+Lbar:
+
+ .section __DATA,__data
+ .quad Lbar
+
More information about the llvm-commits
mailing list