Skip to content

Commit cfd36f1

Browse files
author
Wael Yehia
committed
disallow !dbg and !prof metadata on ifuncs
1 parent 28bb942 commit cfd36f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,16 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) {
999999
void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
10001000
visitGlobalValue(GI);
10011001

1002+
SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
1003+
GI.getAllMetadata(MDs);
1004+
for (const auto &I : MDs) {
1005+
CheckDI(I.first != LLVMContext::MD_dbg,
1006+
"an ifunc may not have a !dbg attachment", &GI);
1007+
Check(I.first != LLVMContext::MD_prof,
1008+
"an ifunc may not have a !prof attachment", &GI);
1009+
visitMDNode(*I.second, AreDebugLocsAllowed::No);
1010+
}
1011+
10021012
Check(GlobalIFunc::isValidLinkage(GI.getLinkage()),
10031013
"IFunc should have private, internal, linkonce, weak, linkonce_odr, "
10041014
"weak_odr, or external linkage!",

0 commit comments

Comments
 (0)