llvm.org GIT mirror llvm / 392b1b2
print weak references git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32276 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 13 years ago
3 changed file(s) with 24 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
6262 : AsmPrinter(O, TM, T) {
6363 }
6464
65 std::set ExtWeakSymbols;
66
6567 /// We name each basic block in a Function with a unique number, so
6668 /// that we can consistently refer to them later. This is cleared
6769 /// at the beginning of each call to runOnMachineFunction().
126128 break;
127129 case Function::WeakLinkage:
128130 case Function::LinkOnceLinkage:
129 O << "\t.weak\t" << CurrentFnName << "\n";
131 O << TAI->getWeakRefDirective() << CurrentFnName << "\n";
130132 break;
131133 }
132134 EmitAlignment(2, F);
243245 GlobalValue *GV = MO.getGlobal();
244246 std::string Name = Mang->getValueName(GV);
245247 O << Name;
248 if (GV->hasExternalWeakLinkage()) {
249 ExtWeakSymbols.insert(Name);
250 }
246251 }
247252 break;
248253 case MachineOperand::MO_ExternalSymbol:
324329 }
325330 }
326331
332 if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
333 SwitchToDataSection("");
334 for (std::set::iterator i = ExtWeakSymbols.begin(),
335 e = ExtWeakSymbols.end(); i != e; ++i) {
336 O << TAI->getWeakRefDirective() << *i << "\n";
337 }
338
327339 AsmPrinter::doFinalization(M);
328340 return false; // success
329341 }
2222 CommentString = "@";
2323 ConstantPoolSection = "\t.text\n";
2424 AlignmentIsInBytes = false;
25 WeakRefDirective = "\t.weak\t";
2526 }
0 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep .weak
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep .weak.*f &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep .weak.*h
23
34 implementation ; Functions:
45
67 entry:
78 unreachable
89 }
10
11 void %g() {
12 entry:
13 tail call void %h( )
14 ret void
15 }
16
17 declare extern_weak void %h()