llvm.org GIT mirror llvm / 6880f0e
Fix PR18743. The IR @foo = private constant i32 42 is valid, but before this patch we would produce an invalid MachO from it. It was invalid because it would use an L label in a section where the liker needs the labels in order to atomize it. One way of fixing it would be to just reject this IR in the backend, but that would not be very front end friendly. What this patch does is use an 'l' prefix in sections that we know the linker requires symbols for atomizing them. This allows frontends to just use private and not worry about which sections they go to or how the linker handles them. One small issue with this strategy is that now a symbol name depends on the section, which is not available before codegen. This is not a problem in practice. The reason is that it only happens with private linkage, which will be ignored by the non codegen users (llvm-nm and llvm-ar). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201608 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
30 changed file(s) with 335 addition(s) and 158 deletion(s). Raw diff Collapse all Expand all
160160 /// getCurrentSection() - Return the current section we are emitting to.
161161 const MCSection *getCurrentSection() const;
162162
163 void getNameWithPrefix(SmallVectorImpl &Name,
164 const GlobalValue *GV) const;
165
163166 MCSymbol *getSymbol(const GlobalValue *GV) const;
164167
165168 //===------------------------------------------------------------------===//
5656
5757 /// Return an MCExpr to use for a reference to the specified type info global
5858 /// variable from exception handling information.
59 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
60 unsigned Encoding, Mangler &Mang,
61 MachineModuleInfo *MMI,
62 MCStreamer &Streamer) const
59 const MCExpr *
60 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
61 Mangler &Mang, const TargetMachine &TM,
62 MachineModuleInfo *MMI, MCStreamer &Streamer) const
6363 LLVM_OVERRIDE;
6464
6565 // The symbol that gets passed to .cfi_personality.
6666 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
67 const TargetMachine &TM,
6768 MachineModuleInfo *MMI) const LLVM_OVERRIDE;
6869
6970 void InitializeELF(bool UseInitArray_);
8990 Mangler &Mang, const TargetMachine &TM) const
9091 LLVM_OVERRIDE;
9192
93 bool isSectionAtomizableBySymbols(const MCSection &Section) const
94 LLVM_OVERRIDE;
95
9296 const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
9397 SectionKind Kind, Mangler &Mang,
9498 const TargetMachine &TM) const
104108 /// This hook allows targets to selectively decide not to emit the
105109 /// UsedDirective for some symbols in llvm.used.
106110 /// FIXME: REMOVE this (rdar://7071300)
107 bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const
108 LLVM_OVERRIDE;
111 bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,
112 TargetMachine &TM) const LLVM_OVERRIDE;
109113
110114 /// The mach-o version of this method defaults to returning a stub reference.
111 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
112 unsigned Encoding, Mangler &Mang,
113 MachineModuleInfo *MMI,
114 MCStreamer &Streamer) const
115 const MCExpr *
116 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
117 Mangler &Mang, const TargetMachine &TM,
118 MachineModuleInfo *MMI, MCStreamer &Streamer) const
115119 LLVM_OVERRIDE;
116120
117121 // The symbol that gets passed to .cfi_personality.
118122 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
123 const TargetMachine &TM,
119124 MachineModuleInfo *MMI) const LLVM_OVERRIDE;
120125 };
121126
5050 /// Print the appropriate prefix and the specified global variable's name.
5151 /// If the global variable doesn't have a name, this fills in a unique name
5252 /// for the global.
53 void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV) const;
54 void getNameWithPrefix(SmallVectorImpl &OutName,
55 const GlobalValue *GV) const;
53 void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
54 bool CannotUsePrivateLabel) const;
55 void getNameWithPrefix(SmallVectorImpl &OutName, const GlobalValue *GV,
56 bool CannotUsePrivateLabel) const;
5657
5758 /// Print the appropriate prefix and the specified name as the global variable
5859 /// name. GVName must not be empty.
4747 class MachineFunction;
4848 class MachineInstr;
4949 class MachineJumpTableInfo;
50 class Mangler;
5051 class MCContext;
5152 class MCExpr;
53 class MCSymbol;
5254 template class SmallVectorImpl;
5355 class DataLayout;
5456 class TargetRegisterClass;
13341336 return LibcallCallingConvs[Call];
13351337 }
13361338
1339 void getNameWithPrefix(SmallVectorImpl &Name, const GlobalValue *GV,
1340 Mangler &Mang) const;
1341 MCSymbol *getSymbol(const GlobalValue *GV, Mangler &Mang) const;
1342
13371343 private:
13381344 const TargetMachine &TM;
13391345 const DataLayout *DL;
7070 /// This hook allows targets to selectively decide not to emit the
7171 /// UsedDirective for some symbols in llvm.used.
7272 /// FIXME: REMOVE this (rdar://7071300)
73 virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
74 Mangler &Mang) const {
73 virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,
74 TargetMachine &TM) const {
7575 return GV != 0;
7676 }
7777
116116
117117 /// Return an MCExpr to use for a reference to the specified global variable
118118 /// from exception handling information.
119 virtual const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
120 unsigned Encoding,
121 Mangler &Mang,
122 MachineModuleInfo *MMI,
123 MCStreamer &Streamer) const;
124
125 /// Return the MCSymbol for the specified global value. This symbol is the
126 /// main label that is the address of the global
127 MCSymbol *getSymbol(const GlobalValue *GV, Mangler &M) const;
119 virtual const MCExpr *
120 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
121 Mangler &Mang, const TargetMachine &TM,
122 MachineModuleInfo *MMI, MCStreamer &Streamer) const;
128123
129124 /// Return the MCSymbol for a private symbol with global value name as its
130125 /// base, with the specified suffix.
131126 MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,
132 StringRef Suffix, Mangler &M) const;
127 StringRef Suffix, Mangler &Mang,
128 const TargetMachine &TM) const;
133129
134130 // The symbol that gets passed to .cfi_personality.
135 virtual MCSymbol *
136 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
137 MachineModuleInfo *MMI) const;
131 virtual MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
132 Mangler &Mang,
133 const TargetMachine &TM,
134 MachineModuleInfo *MMI) const;
138135
139136 const MCExpr *
140137 getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
156153 virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
157154
158155 virtual const MCExpr *
159 getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang) const {
156 getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang,
157 const TargetMachine &TM) const {
160158 return 0;
161159 }
160
161 /// \brief True if the section is atomized using the symbols in it.
162 /// This is false if the section is not atomized at all (most ELF sections) or
163 /// if it is atomized based on its contents (MachO' __TEXT,__cstring for
164 /// example).
165 virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const;
162166
163167 protected:
164168 virtual const MCSection *
310310 llvm_unreachable("Unknown linkage type!");
311311 }
312312
313 void AsmPrinter::getNameWithPrefix(SmallVectorImpl &Name,
314 const GlobalValue *GV) const {
315 TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang);
316 }
317
313318 MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {
314 return getObjFileLowering().getSymbol(GV, *Mang);
319 return TM.getTargetLowering()->getSymbol(GV, *Mang);
315320 }
316321
317322 /// EmitGlobalVariable - Emit the specified global variable to the .s file.
13681373 for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
13691374 const GlobalValue *GV =
13701375 dyn_cast(InitList->getOperand(i)->stripPointerCasts());
1371 if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang))
1376 if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang, TM))
13721377 OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
13731378 }
13741379 }
15731578 }
15741579
15751580 if (const MCExpr *RelocExpr =
1576 AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang))
1581 AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang,
1582 AP.TM))
15771583 return RelocExpr;
15781584
15791585 switch (CE->getOpcode()) {
21022108
21032109 MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,
21042110 StringRef Suffix) const {
2105 return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang);
2111 return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang,
2112 TM);
21062113 }
21072114
21082115 /// GetExternalSymbolSymbol - Return the MCSymbol for the specified
142142 const TargetLoweringObjectFile &TLOF = getObjFileLowering();
143143
144144 const MCExpr *Exp =
145 TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, MMI, OutStreamer);
145 TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, TM, MMI, OutStreamer);
146146 OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
147147 } else
148148 OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
118118 if (!shouldEmitPersonality)
119119 return;
120120
121 const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI);
121 const MCSymbol *Sym =
122 TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
122123 Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
123124
124125 Asm->OutStreamer.EmitDebugLabel
100100 if (shouldEmitPersonality) {
101101 const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
102102 const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
103 const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI);
103 const MCSymbol *Sym =
104 TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
104105
105106 Asm->OutStreamer.PushSection();
106107 Asm->OutStreamer.EmitWin64EHHandlerData();
2323 #include "llvm/IR/DataLayout.h"
2424 #include "llvm/IR/DerivedTypes.h"
2525 #include "llvm/IR/GlobalVariable.h"
26 #include "llvm/IR/Mangler.h"
2627 #include "llvm/MC/MCAsmInfo.h"
28 #include "llvm/MC/MCContext.h"
2729 #include "llvm/MC/MCExpr.h"
2830 #include "llvm/Support/CommandLine.h"
2931 #include "llvm/Support/ErrorHandling.h"
14251427
14261428 return true;
14271429 }
1430
1431 void TargetLoweringBase::getNameWithPrefix(SmallVectorImpl &Name,
1432 const GlobalValue *GV,
1433 Mangler &Mang) const {
1434 if (!GV->hasPrivateLinkage()) {
1435 // Simple case: If GV is not private, it is not important to find out if
1436 // private labels are legal in this case or not.
1437 Mang.getNameWithPrefix(Name, GV, false);
1438 return;
1439 }
1440 SectionKind GVKind =
1441 TargetLoweringObjectFile::getKindForGlobal(GV, getTargetMachine());
1442 const TargetLoweringObjectFile &TLOF = getObjFileLowering();
1443 const MCSection *TheSection =
1444 TLOF.SectionForGlobal(GV, GVKind, Mang, getTargetMachine());
1445 bool CannotUsePrivateLabel = TLOF.isSectionAtomizableBySymbols(*TheSection);
1446 Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);
1447 }
1448
1449 MCSymbol *TargetLoweringBase::getSymbol(const GlobalValue *GV,
1450 Mangler &Mang) const {
1451 SmallString<60> NameStr;
1452 getNameWithPrefix(NameStr, GV, Mang);
1453 const TargetLoweringObjectFile &TLOF = getObjFileLowering();
1454 return TLOF.getContext().GetOrCreateSymbol(NameStr.str());
1455 }
3535 #include "llvm/Support/ErrorHandling.h"
3636 #include "llvm/Support/raw_ostream.h"
3737 #include "llvm/Target/TargetMachine.h"
38 #include "llvm/Target/TargetLowering.h"
3839 using namespace llvm;
3940 using namespace dwarf;
4041
4243 // ELF
4344 //===----------------------------------------------------------------------===//
4445
45 MCSymbol *
46 TargetLoweringObjectFileELF::getCFIPersonalitySymbol(const GlobalValue *GV,
47 Mangler &Mang,
48 MachineModuleInfo *MMI) const {
46 MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(
47 const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
48 MachineModuleInfo *MMI) const {
4949 unsigned Encoding = getPersonalityEncoding();
5050 switch (Encoding & 0x70) {
5151 default:
5252 report_fatal_error("We do not support this DWARF encoding yet!");
5353 case dwarf::DW_EH_PE_absptr:
54 return getSymbol(GV, Mang);
54 return TM.getTargetLowering()->getSymbol(GV, Mang);
5555 case dwarf::DW_EH_PE_pcrel: {
5656 return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +
57 getSymbol(GV, Mang)->getName());
57 TM.getTargetLowering()->getSymbol(GV, Mang)->getName());
5858 }
5959 }
6060 }
8888
8989 const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
9090 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
91 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
91 const TargetMachine &TM, MachineModuleInfo *MMI,
92 MCStreamer &Streamer) const {
9293
9394 if (Encoding & dwarf::DW_EH_PE_indirect) {
9495 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo();
9596
96 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
97 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);
9798
9899 // Add information about the stub reference to ELFMMI so that the stub
99100 // gets emitted by the asmprinter.
100101 MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
101102 if (StubSym.getPointer() == 0) {
102 MCSymbol *Sym = getSymbol(GV, Mang);
103 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
103104 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
104105 }
105106
108109 Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
109110 }
110111
111 return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
112 MMI, Streamer);
112 return TargetLoweringObjectFile::
113 getTTypeGlobalReference(GV, Encoding, Mang, TM, MMI, Streamer);
113114 }
114115
115116 static SectionKind
194195 return Flags;
195196 }
196197
197
198 const MCSection *TargetLoweringObjectFileELF::
199 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
200 Mangler &Mang, const TargetMachine &TM) const {
198 const MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
199 const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
200 const TargetMachine &TM) const {
201201 StringRef SectionName = GV->getSection();
202202
203203 // Infer section flags from the section name if we can.
247247 Prefix = getSectionPrefixForGlobal(Kind);
248248
249249 SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
250 MCSymbol *Sym = getSymbol(GV, Mang);
250 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
251251 Name.append(Sym->getName().begin(), Sym->getName().end());
252252 StringRef Group = "";
253253 unsigned Flags = getELFSectionFlags(Kind);
486486 Streamer.AddBlankLine();
487487 }
488488
489 const MCSection *TargetLoweringObjectFileMachO::
490 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
491 Mangler &Mang, const TargetMachine &TM) const {
489 const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
490 const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
491 const TargetMachine &TM) const {
492492 // Parse the section specifier and create it if valid.
493493 StringRef Segment, Section;
494494 unsigned TAA = 0, StubSize = 0;
525525 return S;
526526 }
527527
528 bool TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols(
529 const MCSection &Section) const {
530 const MCSectionMachO &SMO = static_cast(Section);
531
532 // Sections holding 1 byte strings are atomized based on the data
533 // they contain.
534 // Sections holding 2 byte strings require symbols in order to be
535 // atomized.
536 // There is no dedicated section for 4 byte strings.
537 if (SMO.getKind().isMergeable1ByteCString())
538 return false;
539
540 if (SMO.getSegmentName() == "__DATA" &&
541 SMO.getSectionName() == "__cfstring")
542 return false;
543
544 switch (SMO.getType()) {
545 default:
546 return true;
547
548 // These sections are atomized at the element boundaries without using
549 // symbols.
550 case MCSectionMachO::S_4BYTE_LITERALS:
551 case MCSectionMachO::S_8BYTE_LITERALS:
552 case MCSectionMachO::S_16BYTE_LITERALS:
553 case MCSectionMachO::S_LITERAL_POINTERS:
554 case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:
555 case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:
556 case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:
557 case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:
558 case MCSectionMachO::S_INTERPOSING:
559 return false;
560 }
561 }
562
528563 const MCSection *TargetLoweringObjectFileMachO::
529564 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
530565 Mangler &Mang, const TargetMachine &TM) const {
605640 return ReadOnlySection; // .const
606641 }
607642
608 /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide
609 /// not to emit the UsedDirective for some symbols in llvm.used.
643 /// This hook allows targets to selectively decide not to emit the UsedDirective
644 /// for some symbols in llvm.used.
610645 // FIXME: REMOVE this (rdar://7071300)
611 bool TargetLoweringObjectFileMachO::
612 shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const {
613 /// On Darwin, internally linked data beginning with "L" or "l" does not have
614 /// the directive emitted (this occurs in ObjC metadata).
615 if (!GV) return false;
616
646 bool TargetLoweringObjectFileMachO::shouldEmitUsedDirectiveFor(
647 const GlobalValue *GV, Mangler &Mang, TargetMachine &TM) const {
617648 // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
618649 if (GV->hasLocalLinkage() && !isa(GV)) {
619650 // FIXME: ObjC metadata is currently emitted as internal symbols that have
620651 // \1L and \0l prefixes on them. Fix them to be Private/LinkerPrivate and
621652 // this horrible hack can go away.
622 MCSymbol *Sym = getSymbol(GV, Mang);
653 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
623654 if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')
624655 return false;
625656 }
629660
630661 const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
631662 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
632 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
663 const TargetMachine &TM, MachineModuleInfo *MMI,
664 MCStreamer &Streamer) const {
633665 // The mach-o version of this method defaults to returning a stub reference.
634666
635667 if (Encoding & DW_EH_PE_indirect) {
636668 MachineModuleInfoMachO &MachOMMI =
637669 MMI->getObjFileInfo();
638670
639 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);
671 MCSymbol *SSym =
672 getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);
640673
641674 // Add information about the stub reference to MachOMMI so that the stub
642675 // gets emitted by the asmprinter.
644677 GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :
645678 MachOMMI.getGVStubEntry(SSym);
646679 if (StubSym.getPointer() == 0) {
647 MCSymbol *Sym = getSymbol(GV, Mang);
680 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
648681 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
649682 }
650683
653686 Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
654687 }
655688
656 return TargetLoweringObjectFile::
657 getTTypeGlobalReference(GV, Encoding, Mang, MMI, Streamer);
658 }
659
660 MCSymbol *TargetLoweringObjectFileMachO::
661 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
662 MachineModuleInfo *MMI) const {
689 return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
690 TM, MMI, Streamer);
691 }
692
693 MCSymbol *TargetLoweringObjectFileMachO::getCFIPersonalitySymbol(
694 const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
695 MachineModuleInfo *MMI) const {
663696 // The mach-o version of this method defaults to returning a stub reference.
664697 MachineModuleInfoMachO &MachOMMI =
665698 MMI->getObjFileInfo();
666699
667 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);
700 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);
668701
669702 // Add information about the stub reference to MachOMMI so that the stub
670703 // gets emitted by the asmprinter.
671704 MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
672705 if (StubSym.getPointer() == 0) {
673 MCSymbol *Sym = getSymbol(GV, Mang);
706 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
674707 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
675708 }
676709
716749 return Flags;
717750 }
718751
719 const MCSection *TargetLoweringObjectFileCOFF::
720 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
721 Mangler &Mang, const TargetMachine &TM) const {
752 const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
753 const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
754 const TargetMachine &TM) const {
722755 int Selection = 0;
723756 unsigned Characteristics = getCOFFSectionFlags(Kind);
724757 StringRef Name = GV->getSection();
726759 if (GV->isWeakForLinker()) {
727760 Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
728761 Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
729 MCSymbol *Sym = getSymbol(GV, Mang);
762 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
730763 COMDATSymName = Sym->getName();
731764 }
732765 return getContext().getCOFFSection(Name,
760793 unsigned Characteristics = getCOFFSectionFlags(Kind);
761794
762795 Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
763 MCSymbol *Sym = getSymbol(GV, Mang);
796 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
764797 return getContext().getCOFFSection(Name, Characteristics,
765798 Kind, Sym->getName(),
766799 COFF::IMAGE_COMDAT_SELECT_ANY);
2626 #include "llvm/Support/ErrorHandling.h"
2727 #include "llvm/Support/MemoryBuffer.h"
2828 #include "llvm/Support/MutexGuard.h"
29 #include "llvm/Target/TargetLowering.h"
2930
3031 using namespace llvm;
3132
370371 // load address of the symbol, not the local address.
371372 Mangler Mang(TM->getDataLayout());
372373 SmallString<128> Name;
373 Mang.getNameWithPrefix(Name, F);
374 TM->getTargetLowering()->getNameWithPrefix(Name, F, Mang);
374375 return (void*)Dyld.getSymbolLoadAddress(Name);
375376 }
376377
7575 OS << '@' << ArgWords;
7676 }
7777
78 void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV) const {
78 void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
79 bool CannotUsePrivateLabel) const {
7980 ManglerPrefixTy PrefixTy = Mangler::Default;
80 if (GV->hasPrivateLinkage())
81 PrefixTy = Mangler::Private;
82 else if (GV->hasLinkerPrivateLinkage() || GV->hasLinkerPrivateWeakLinkage())
81 if (GV->hasPrivateLinkage()) {
82 if (CannotUsePrivateLabel)
83 PrefixTy = Mangler::LinkerPrivate;
84 else
85 PrefixTy = Mangler::Private;
86 } else if (GV->hasLinkerPrivateLinkage() ||
87 GV->hasLinkerPrivateWeakLinkage()) {
8388 PrefixTy = Mangler::LinkerPrivate;
89 }
8490
8591 if (!GV->hasName()) {
8692 // Get the ID for the global, assigning a new one if we haven't got one
133139 }
134140
135141 void Mangler::getNameWithPrefix(SmallVectorImpl &OutName,
136 const GlobalValue *GV) const {
142 const GlobalValue *GV,
143 bool CannotUsePrivateLabel) const {
137144 raw_svector_ostream OS(OutName);
138 getNameWithPrefix(OS, GV);
145 getNameWithPrefix(OS, GV, CannotUsePrivateLabel);
139146 }
335335 SmallPtrSet &AsmUsed,
336336 Mangler &Mangler) {
337337 SmallString<64> Buffer;
338 Mangler.getNameWithPrefix(Buffer, &GV);
338 TargetMach->getTargetLowering()->getNameWithPrefix(Buffer, &GV, Mangler);
339339
340340 if (GV.isDeclaration())
341341 return;
380380
381381 // string is owned by _defines
382382 SmallString<64> Buffer;
383 _mangler.getNameWithPrefix(Buffer, def);
383 _target->getTargetLowering()->getNameWithPrefix(Buffer, def, _mangler);
384384
385385 // set alignment part log2() can have rounding errors
386386 uint32_t align = def->getAlignment();
516516 return;
517517
518518 SmallString<64> name;
519 _mangler.getNameWithPrefix(name, decl);
519 _target->getTargetLowering()->getNameWithPrefix(name, decl, _mangler);
520520
521521 StringMap::value_type &entry =
522522 _undefines.GetOrCreateValue(name);
1515 #include "llvm/MC/MCSectionELF.h"
1616 #include "llvm/Support/Dwarf.h"
1717 #include "llvm/Support/ELF.h"
18 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetLowering.h"
1919 using namespace llvm;
2020 using namespace dwarf;
2121
4242
4343 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
4444 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
45 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
45 const TargetMachine &TM, MachineModuleInfo *MMI,
46 MCStreamer &Streamer) const {
4647 assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
4748
48 return MCSymbolRefExpr::Create(getSymbol(GV, Mang),
49 MCSymbolRefExpr::VK_ARM_TARGET2,
50 getContext());
49 return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),
50 MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
5151 }
5252
5353 const MCExpr *ARMElfTargetObjectFile::
2727
2828 void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE;
2929
30 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
31 unsigned Encoding, Mangler &Mang,
32 MachineModuleInfo *MMI,
33 MCStreamer &Streamer) const
30 const MCExpr *
31 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
32 Mangler &Mang, const TargetMachine &TM,
33 MachineModuleInfo *MMI, MCStreamer &Streamer) const
3434 LLVM_OVERRIDE;
3535
3636 /// \brief Describe a TLS variable address within debug info.
2424 #include "llvm/MC/MCAsmInfo.h"
2525 #include "llvm/MC/MCExpr.h"
2626 #include "llvm/MC/MCInst.h"
27 #include "llvm/Target/TargetMachine.h"
27 #include "llvm/Target/TargetLowering.h"
28 #include "llvm/Target/TargetLoweringObjectFile.h"
2829 using namespace llvm;
2930
3031 static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) {
3334
3435
3536 static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
36 const DataLayout *DL = AP.TM.getDataLayout();
37 const TargetMachine &TM = AP.TM;
38 Mangler *Mang = AP.Mang;
39 const DataLayout *DL = TM.getDataLayout();
3740 MCContext &Ctx = AP.OutContext;
3841
3942 SmallString<128> Name;
5053
5154 if (!MO.isGlobal()) {
5255 assert(MO.isSymbol() && "Isn't a symbol reference");
53 AP.Mang->getNameWithPrefix(Name, MO.getSymbolName());
56 Mang->getNameWithPrefix(Name, MO.getSymbolName());
5457 } else {
5558 const GlobalValue *GV = MO.getGlobal();
56 AP.Mang->getNameWithPrefix(Name, GV);
59 TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang);
5760 }
5861
5962 unsigned OrigLen = Name.size() - PrefixLen;
1010 #include "MCTargetDesc/SparcMCExpr.h"
1111 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
1212 #include "llvm/Support/Dwarf.h"
13 #include "llvm/Target/TargetLowering.h"
1314
1415 using namespace llvm;
1516
1617 const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
1718 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
18 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
19 const TargetMachine &TM, MachineModuleInfo *MMI,
20 MCStreamer &Streamer) const {
1921
2022 if (Encoding & dwarf::DW_EH_PE_pcrel) {
2123 MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo();
2224
23 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
25 MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);
2426
2527 // Add information about the stub reference to ELFMMI so that the stub
2628 // gets emitted by the asmprinter.
2729 MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
2830 if (StubSym.getPointer() == 0) {
29 MCSymbol *Sym = getSymbol(GV, Mang);
31 MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
3032 StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
3133 }
3234
3638 }
3739
3840 return TargetLoweringObjectFileELF::getTTypeGlobalReference(
39 GV, Encoding, Mang, MMI, Streamer);
41 GV, Encoding, Mang, TM, MMI, Streamer);
4042 }
2222 TargetLoweringObjectFileELF()
2323 {}
2424
25 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
26 unsigned Encoding, Mangler &Mang,
27 MachineModuleInfo *MMI,
28 MCStreamer &Streamer) const
25 const MCExpr *
26 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
27 Mangler &Mang, const TargetMachine &TM,
28 MachineModuleInfo *MMI, MCStreamer &Streamer) const
2929 LLVM_OVERRIDE;
3030 };
3131
2727 #include "llvm/Support/ErrorHandling.h"
2828 #include "llvm/Support/raw_ostream.h"
2929 #include "llvm/Target/TargetMachine.h"
30 #include "llvm/Target/TargetLowering.h"
3031 #include "llvm/Target/TargetOptions.h"
3132 using namespace llvm;
3233
9899 return false;
99100 }
100101
101 /// Return the MCSymbol for the specified global value. This
102 /// symbol is the main label that is the address of the global.
103 MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,
104 Mangler &M) const {
105 SmallString<60> NameStr;
106 M.getNameWithPrefix(NameStr, GV);
107 return Ctx->GetOrCreateSymbol(NameStr.str());
108 }
109
110102 MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
111 const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
103 const GlobalValue *GV, StringRef Suffix, Mangler &Mang,
104 const TargetMachine &TM) const {
112105 assert(!Suffix.empty());
113106
114107 SmallString<60> NameStr;
115108 NameStr += DL->getPrivateGlobalPrefix();
116 M.getNameWithPrefix(NameStr, GV);
109 TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang);
117110 NameStr.append(Suffix.begin(), Suffix.end());
118111 return Ctx->GetOrCreateSymbol(NameStr.str());
119112 }
120113
121 MCSymbol *TargetLoweringObjectFile::
122 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
123 MachineModuleInfo *MMI) const {
124 return getSymbol(GV, Mang);
114 MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
115 const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
116 MachineModuleInfo *MMI) const {
117 return TM.getTargetLowering()->getSymbol(GV, Mang);
125118 }
126119
127120 void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
274267 return SelectSectionForGlobal(GV, Kind, Mang, TM);
275268 }
276269
270 bool TargetLoweringObjectFile::isSectionAtomizableBySymbols(
271 const MCSection &Section) const {
272 return false;
273 }
277274
278275 // Lame default implementation. Calculate the section name for global.
279276 const MCSection *
311308 /// handling information.
312309 const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
313310 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
314 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
311 const TargetMachine &TM, MachineModuleInfo *MMI,
312 MCStreamer &Streamer) const {
315313 const MCSymbolRefExpr *Ref =
316 MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
314 MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),
315 getContext());
317316
318317 return getTTypeReference(Ref, Encoding, Streamer);
319318 }
9797
9898 if (MO.isGlobal()) {
9999 const GlobalValue *GV = MO.getGlobal();
100 getMang()->getNameWithPrefix(Name, GV);
100 AsmPrinter.getNameWithPrefix(Name, GV);
101101 } else if (MO.isSymbol()) {
102102 getMang()->getNameWithPrefix(Name, MO.getSymbolName());
103103 } else if (MO.isMBB()) {
1313 #include "llvm/MC/MCExpr.h"
1414 #include "llvm/MC/MCSectionELF.h"
1515 #include "llvm/Support/Dwarf.h"
16 #include "llvm/Target/TargetLowering.h"
1617
1718 using namespace llvm;
1819 using namespace dwarf;
1920
2021 const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
2122 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
22 MachineModuleInfo *MMI, MCStreamer &Streamer) const {
23 const TargetMachine &TM, MachineModuleInfo *MMI,
24 MCStreamer &Streamer) const {
2325
2426 // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
2527 // is an indirect pc-relative reference.
2628 if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
27 const MCSymbol *Sym = getSymbol(GV, Mang);
29 const MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
2830 const MCExpr *Res =
2931 MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
3032 const MCExpr *Four = MCConstantExpr::Create(4, getContext());
3234 }
3335
3436 return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
35 GV, Encoding, Mang, MMI, Streamer);
37 GV, Encoding, Mang, TM, MMI, Streamer);
3638 }
3739
38 MCSymbol *X86_64MachoTargetObjectFile::
39 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
40 MachineModuleInfo *MMI) const {
41 return getSymbol(GV, Mang);
40 MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol(
41 const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
42 MachineModuleInfo *MMI) const {
43 return TM.getTargetLowering()->getSymbol(GV, Mang);
4244 }
4345
4446 void
5355 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
5456 }
5557
56 const MCExpr *
57 X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE,
58 Mangler &Mang) const {
58 const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
59 const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const {
5960 // We are looking for the difference of two symbols, need a subtraction
6061 // operation.
6162 const SubOperator *Sub = dyn_cast(CE);
100101 if (GVLHS->isThreadLocal())
101102 return 0;
102103
103 return MCSymbolRefExpr::Create(
104 getSymbol(GVLHS, Mang), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());
104 return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GVLHS, Mang),
105 MCSymbolRefExpr::VK_COFF_IMGREL32,
106 getContext());
105107 }
1919 /// x86-64.
2020 class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
2121 public:
22 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
23 unsigned Encoding, Mangler &Mang,
24 MachineModuleInfo *MMI,
25 MCStreamer &Streamer) const
22 const MCExpr *
23 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
24 Mangler &Mang, const TargetMachine &TM,
25 MachineModuleInfo *MMI, MCStreamer &Streamer) const
2626 LLVM_OVERRIDE;
2727
2828 // getCFIPersonalitySymbol - The symbol that gets passed to
2929 // .cfi_personality.
3030 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
31 const TargetMachine &TM,
3132 MachineModuleInfo *MMI) const
3233 LLVM_OVERRIDE;
3334 };
4546 /// \brief This implementation is used for Windows targets on x86 and x86-64.
4647 class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
4748 const MCExpr *getExecutableRelativeSymbol(const ConstantExpr *CE,
48 Mangler &Mang) const
49 Mangler &Mang,
50 const TargetMachine &TM) const
4951 LLVM_OVERRIDE;
5052 };
5153
117117 return Flags;
118118 }
119119
120 const MCSection *XCoreTargetObjectFile::
121 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
122 Mangler &Mang, const TargetMachine &TM) const {
120 const MCSection *
121 XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,
122 SectionKind Kind, Mangler &Mang,
123 const TargetMachine &TM) const {
123124 StringRef SectionName = GV->getSection();
124125 // Infer section flags from the section name if we can.
125126 bool IsCPRel = SectionName.startswith(".cp.");
66 ; RUN: FileCheck --check-prefix=OSX %s
77
88 ; LINUX: .Lfoo:
9 ; OSX: L_foo:
9 ; OSX: l_foo:
1010 define private void @foo() nounwind {
1111 ret void
1212 }
1313
1414 define i32 @bar() nounwind {
1515 ; LINUX: bl{{.*}}.Lfoo
16 ; OSX: bl{{.*}}L_foo
16 ; OSX: bl{{.*}}l_foo
1717 call void @foo()
1818
1919 ; LINUX: lis{{.*}}.Lbaz
20 ; OSX: lis{{.*}}L_baz
20 ; OSX: lis{{.*}}l_baz
2121 %1 = load i32* @baz, align 4
2222 ret i32 %1
2323 }
2424
2525 ; LINUX: .Lbaz:
26 ; OSX: L_baz:
26 ; OSX: l_baz:
2727 @baz = private global i32 4
0 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s
11 ; rdar://7396984
22
3 @str = private constant [28 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 1
3 @str = private unnamed_addr constant [28 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 1
44
55 define void @t(i32 %count) ssp nounwind {
66 entry:
0 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
1 ; Test all the cases where a L label is safe. Removing any entry from
2 ; TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols should cause
3 ; this to fail.
4 ; We also test some noteworthy cases that require an l label.
5
6 @private1 = private unnamed_addr constant [4 x i8] c"zed\00"
7 ; CHECK: .section __TEXT,__cstring,cstring_literals
8 ; CHECK-NEXT: L_private1:
9
10 @private2 = private unnamed_addr constant [5 x i16] [i16 116, i16 101,
11 i16 115, i16 116, i16 0]
12 ; CHECK: .section __TEXT,__ustring
13 ; CHECK-NEXT: .align 1
14 ; CHECK-NEXT: l_private2:
15
16 ; There is no dedicated 4 byte strings on MachO.
17
18 %struct.NSConstantString = type { i32*, i32, i8*, i32 }
19 @private3 = private constant %struct.NSConstantString { i32* null, i32 1992, i8* null, i32 0 }, section "__DATA,__cfstring"
20 ; CHECK: .section __DATA,__cfstring
21 ; CHECK-NEXT: .align 4
22 ; CHECK-NEXT: L_private3:
23
24 ; There is no dedicated 1 or 2 byte constant section on MachO.
25
26 @private4 = private unnamed_addr constant i32 42
27 ; CHECK: .section __TEXT,__literal4,4byte_literals
28 ; CHECK-NEXT: .align 2
29 ; CHECK-NEXT: L_private4:
30
31 @private5 = private unnamed_addr constant i64 42
32 ; CHECK: .section __TEXT,__literal8,8byte_literals
33 ; CHECK-NEXT: .align 3
34 ; CHECK-NEXT: L_private5:
35
36 @private6 = private unnamed_addr constant i128 42
37 ; CHECK: .section __TEXT,__literal16,16byte_literals
38 ; CHECK-NEXT: .align 3
39 ; CHECK-NEXT: L_private6:
40
41 %struct._objc_class = type { i8* }
42 @private7 = private global %struct._objc_class* null, section "__OBJC,__cls_refs,literal_pointers,no_dead_strip"
43 ; CHECK: .section __OBJC,__cls_refs,literal_pointers,no_dead_strip
44 ; CHECK: .align 3
45 ; CHECK: L_private7:
46
47 @private8 = private global i32* null, section "__DATA,__nl_symbol_ptr,non_lazy_symbol_pointers"
48 ; CHECK: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
49 ; CHECK-NEXT: .align 3
50 ; CHECK-NEXT: L_private8:
51
52 @private9 = private global i32* null, section "__DATA,__la_symbol_ptr,lazy_symbol_pointers"
53 ; CHECK: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers
54 ; CHECK-NEXT: .align 3
55 ; CHECK-NEXT: L_private9:
56
57 @private10 = private global i32* null, section "__DATA,__mod_init_func,mod_init_funcs"
58 ; CHECK: .section __DATA,__mod_init_func,mod_init_funcs
59 ; CHECK-NEXT: .align 3
60 ; CHECK-NEXT: L_private10:
61
62 @private11 = private global i32* null, section "__DATA,__mod_term_func,mod_term_funcs"
63 ; CHECK: .section __DATA,__mod_term_func,mod_term_funcs
64 ; CHECK-NEXT: .align 3
65 ; CHECK-NEXT: L_private11:
66
67 @private12 = private global i32* null, section "__DATA,__foobar,interposing"
68 ; CHECK: .section __DATA,__foobar,interposing
69 ; CHECK-NEXT: .align 3
70 ; CHECK-NEXT: L_private12:
1313 ret void;
1414 }
1515
16 ; CHECK: L_foo: ## @foo
16 ; CHECK: l_foo: ## @foo
1717 ; CHECK-NEXT: Ltmp0:
1818
1919 ; CHECK: _bar: ## @bar
3333 ; CHECK-NEXT: {{.quad|.long}} Ltmp[[NUM2]]
3434
3535
36 ; OLD: L_foo: ## @foo
36 ; OLD: l_foo: ## @foo
3737 ; OLD-NEXT: Ltmp0:
3838
3939 ; OLD: _bar: ## @bar
11 ; Quote should be outside of private prefix.
22 ; rdar://6855766x
33
4 ; CHECK: L__ZZ20
4 ; CHECK: "l__ZZ20-[Example1 whatever]E4C.91"
55
66 %struct.A = type { i32*, i32 }
77 @"_ZZ20-[Example1 whatever]E4C.91" = private constant %struct.A { i32* null, i32 1 } ; <%struct.A*> [#uses=1]