Skip to content

Commit 4ae0ab0

Browse files
committed
[BitCode] Add noprofile to getAttrFromCode()
After D104475 / D104658, building the Linux kernel with ThinLTO is broken: ld.lld: error: Unknown attribute kind (73) (Producer: 'LLVM13.0.0git' Reader: 'LLVM 13.0.0git') getAttrFromCode() has never handled this attribute so it is written during the ThinLTO phase but it cannot be handled during the linking phase. Add noprofile to getAttrFromCode() so that disassembly works properly. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D104995
1 parent e817029 commit 4ae0ab0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
14391439
return Attribute::NoSync;
14401440
case bitc::ATTR_KIND_NOCF_CHECK:
14411441
return Attribute::NoCfCheck;
1442+
case bitc::ATTR_KIND_NO_PROFILE:
1443+
return Attribute::NoProfile;
14421444
case bitc::ATTR_KIND_NO_UNWIND:
14431445
return Attribute::NoUnwind;
14441446
case bitc::ATTR_KIND_NO_SANITIZE_COVERAGE:

llvm/test/Bitcode/attributes.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,12 @@ define void @f77() nosanitize_coverage
459459
ret void;
460460
}
461461

462+
; CHECK: define void @f78() #49
463+
define void @f78() noprofile
464+
{
465+
ret void;
466+
}
467+
462468
; CHECK: attributes #0 = { noreturn }
463469
; CHECK: attributes #1 = { nounwind }
464470
; CHECK: attributes #2 = { readnone }
@@ -508,4 +514,5 @@ define void @f77() nosanitize_coverage
508514
; CHECK: attributes #46 = { vscale_range(1,8) }
509515
; CHECK: attributes #47 = { vscale_range(1,0) }
510516
; CHECK: attributes #48 = { nosanitize_coverage }
517+
; CHECK: attributes #49 = { noprofile }
511518
; CHECK: attributes #[[NOBUILTIN]] = { nobuiltin }

0 commit comments

Comments
 (0)