llvm.org GIT mirror llvm / ad17cce
Merging r196970: ------------------------------------------------------------------------ r196970 | fang | 2013-12-10 16:37:41 -0500 (Tue, 10 Dec 2013) | 3 lines on darwin<10, fallback to .weak_definition (PPC,X86) .weak_def_can_be_hidden was not yet supported by the system assembler ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@206050 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 6 years ago
10 changed file(s) with 100 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
269269 /// defined symbol.
270270 bool HasWeakDefDirective; // Defaults to false.
271271
272 /// True if we have a directive to declare a global as being a weak
273 /// defined symbol that can be hidden (unexported).
274 bool HasWeakDefCanBeHiddenDirective; // Defaults to false.
275
272276 /// True if we have a .linkonce directive. This is used on cygwin/mingw.
273277 bool HasLinkOnceDirective; // Defaults to false.
274278
500504 bool hasNoDeadStrip() const { return HasNoDeadStrip; }
501505 const char *getWeakRefDirective() const { return WeakRefDirective; }
502506 bool hasWeakDefDirective() const { return HasWeakDefDirective; }
507 bool hasWeakDefCanBeHiddenDirective() const {
508 return HasWeakDefCanBeHiddenDirective;
509 }
503510 bool hasLinkOnceDirective() const { return HasLinkOnceDirective; }
504511
505512 MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
227227
228228 bool CanBeHidden = false;
229229
230 if (Linkage == GlobalValue::LinkOnceODRLinkage) {
230 if (Linkage == GlobalValue::LinkOnceODRLinkage &&
231 MAI->hasWeakDefCanBeHiddenDirective()) {
231232 if (GV->hasUnnamedAddr()) {
232233 CanBeHidden = true;
233234 } else {
7676 HasNoDeadStrip = false;
7777 WeakRefDirective = 0;
7878 HasWeakDefDirective = false;
79 HasWeakDefCanBeHiddenDirective = false;
7980 HasLinkOnceDirective = false;
8081 HiddenVisibilityAttr = MCSA_Hidden;
8182 HiddenDeclarationVisibilityAttr = MCSA_Hidden;
3636
3737 // Directives:
3838 HasWeakDefDirective = true;
39 HasWeakDefCanBeHiddenDirective = true;
3940 WeakRefDirective = "\t.weak_reference ";
4041 ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
4142 HasMachoZeroFillDirective = true; // Uses .zerofill
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "PPCMCAsmInfo.h"
14 #include "llvm/ADT/Triple.h"
15
1416 using namespace llvm;
1517
1618 void PPCMCAsmInfoDarwin::anchor() { }
1719
20 /// This version of the constructor is here to maintain ABI compatibility with
21 /// LLVM 3.4.0
1822 PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
1923 if (is64Bit) {
2024 PointerSize = CalleeSaveStackSlotSize = 8;
2933
3034 AssemblerDialect = 1; // New-Style mnemonics.
3135 SupportsDebugInformation= true; // Debug information.
36 }
37
38 PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
39 if (is64Bit) {
40 PointerSize = CalleeSaveStackSlotSize = 8;
41 }
42 IsLittleEndian = false;
43
44 CommentString = ";";
45 ExceptionsType = ExceptionHandling::DwarfCFI;
46
47 if (!is64Bit)
48 Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode.
49
50 AssemblerDialect = 1; // New-Style mnemonics.
51 SupportsDebugInformation= true; // Debug information.
52
53 // old assembler lacks some directives
54 // FIXME: this should really be a check on the assembler characteristics
55 // rather than OS version
56 if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
57 HasWeakDefCanBeHiddenDirective = false;
3258 }
3359
3460 void PPCLinuxMCAsmInfo::anchor() { }
1717 #include "llvm/MC/MCAsmInfoELF.h"
1818
1919 namespace llvm {
20 class Triple;
2021
2122 class PPCMCAsmInfoDarwin : public MCAsmInfoDarwin {
2223 virtual void anchor();
2324 public:
25 /// This version of the constructor is here to maintain ABI compatibility
26 /// with LLVM 3.4.0.
2427 explicit PPCMCAsmInfoDarwin(bool is64Bit);
28 explicit PPCMCAsmInfoDarwin(bool is64Bit, const Triple&);
2529 };
2630
2731 class PPCLinuxMCAsmInfo : public MCAsmInfoELF {
7171
7272 MCAsmInfo *MAI;
7373 if (TheTriple.isOSDarwin())
74 MAI = new PPCMCAsmInfoDarwin(isPPC64);
74 MAI = new PPCMCAsmInfoDarwin(isPPC64, TheTriple);
7575 else
7676 MAI = new PPCLinuxMCAsmInfo(isPPC64);
7777
6969 // version in use. From at least >= ld64-97.17 (Xcode 3.2.6) the abs-ified
7070 // FDE relocs may be used.
7171 DwarfFDESymbolsUseAbsDiff = T.isMacOSX() && !T.isMacOSXVersionLT(10, 6);
72
73 // old assembler lacks some directives
74 // FIXME: this should really be a check on the assembler characteristics
75 // rather than OS version
76 if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
77 HasWeakDefCanBeHiddenDirective = false;
7278 }
7379
7480 X86_64MCAsmInfoDarwin::X86_64MCAsmInfoDarwin(const Triple &Triple)
0 ; taken from X86 version of the same test
1 ; RUN: llc -mtriple=powerpc-apple-darwin10 -O0 < %s | FileCheck %s
2 ; RUN: llc -mtriple=powerpc-apple-darwin9 -O0 < %s | FileCheck --check-prefix=CHECK-D89 %s
3 ; RUN: llc -mtriple=powerpc-apple-darwin8 -O0 < %s | FileCheck --check-prefix=CHECK-D89 %s
4
5 @v1 = linkonce_odr global i32 32
6 ; CHECK: .globl _v1
7 ; CHECK: .weak_def_can_be_hidden _v1
8
9 ; CHECK-D89: .globl _v1
10 ; CHECK-D89: .weak_definition _v1
11
12 define i32 @f1() {
13 %x = load i32 * @v1
14 ret i32 %x
15 }
16
17 @v2 = linkonce_odr global i32 32
18 ; CHECK: .globl _v2
19 ; CHECK: .weak_definition _v2
20
21 ; CHECK-D89: .globl _v2
22 ; CHECK-D89: .weak_definition _v2
23
24 @v3 = linkonce_odr unnamed_addr global i32 32
25 ; CHECK: .globl _v3
26 ; CHECK: .weak_def_can_be_hidden _v3
27
28 ; CHECK-D89: .globl _v3
29 ; CHECK-D89: .weak_definition _v3
30
31 define i32* @f2() {
32 ret i32* @v2
33 }
34
35 define i32* @f3() {
36 ret i32* @v3
37 }
None ; RUN: llc -mtriple=x86_64-apple-darwin -O0 < %s | FileCheck %s
0 ; RUN: llc -mtriple=x86_64-apple-darwin11 -O0 < %s | FileCheck %s
1 ; RUN: llc -mtriple=x86_64-apple-darwin10 -O0 < %s | FileCheck %s
2 ; RUN: llc -mtriple=x86_64-apple-darwin9 -O0 < %s | FileCheck --check-prefix=CHECK-D89 %s
3 ; RUN: llc -mtriple=i686-apple-darwin9 -O0 < %s | FileCheck --check-prefix=CHECK-D89 %s
4 ; RUN: llc -mtriple=i686-apple-darwin8 -O0 < %s | FileCheck --check-prefix=CHECK-D89 %s
15
26 @v1 = linkonce_odr global i32 32
37 ; CHECK: .globl _v1
48 ; CHECK: .weak_def_can_be_hidden _v1
9
10 ; CHECK-D89: .globl _v1
11 ; CHECK-D89: .weak_definition _v1
512
613 define i32 @f1() {
714 %x = load i32 * @v1
1219 ; CHECK: .globl _v2
1320 ; CHECK: .weak_definition _v2
1421
22 ; CHECK-D89: .globl _v2
23 ; CHECK-D89: .weak_definition _v2
24
1525 @v3 = linkonce_odr unnamed_addr global i32 32
1626 ; CHECK: .globl _v3
1727 ; CHECK: .weak_def_can_be_hidden _v3
28
29 ; CHECK-D89: .globl _v3
30 ; CHECK-D89: .weak_definition _v3
1831
1932 define i32* @f2() {
2033 ret i32* @v2