Learn that __DATA,__objc_classrefs is not atomized via symbols.

This should hopefully fix objc on AArch64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-02-12 23:11:59 +00:00
parent 122ea21abf
commit ef1d2264bc
3 changed files with 33 additions and 0 deletions

View File

@ -33,6 +33,10 @@ bool MCAsmInfoDarwin::isSectionAtomizableBySymbols(
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;

View File

@ -134,6 +134,10 @@ static bool canUseLocalRelocation(const MCSectionMachO &Section,
RefSec.getSectionName() == "__cfstring")
return false;
if (RefSec.getSegmentName() == "__DATA" &&
RefSec.getSectionName() == "__objc_classrefs")
return false;
return true;
}

View File

@ -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