[PATCH] D104995: [BitCode] Add noprofile to getAttrFromCode()

Nathan Chancellor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 27 10:55:05 PDT 2021


nathanchance created this revision.
nathanchance added reviewers: nickdesaulniers, MaskRay, void.
Herald added subscribers: jdoerfert, hiraditya.
nathanchance requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

After D104475 <https://reviews.llvm.org/D104475> / D104658 <https://reviews.llvm.org/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 but it cannot be handled during the linking phase.

Add noprofile to getAttrFromCode() so that disassembly works properly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104995

Files:
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/test/Bitcode/attributes.ll


Index: llvm/test/Bitcode/attributes.ll
===================================================================
--- llvm/test/Bitcode/attributes.ll
+++ llvm/test/Bitcode/attributes.ll
@@ -459,6 +459,12 @@
         ret void;
 }
 
+; CHECK: define void @f78() #49
+define void @f78() noprofile
+{
+        ret void;
+}
+
 ; CHECK: attributes #0 = { noreturn }
 ; CHECK: attributes #1 = { nounwind }
 ; CHECK: attributes #2 = { readnone }
@@ -508,4 +514,5 @@
 ; CHECK: attributes #46 = { vscale_range(1,8) }
 ; CHECK: attributes #47 = { vscale_range(1,0) }
 ; CHECK: attributes #48 = { nosanitize_coverage }
+; CHECK: attributes #49 = { noprofile }
 ; CHECK: attributes #[[NOBUILTIN]] = { nobuiltin }
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1439,6 +1439,8 @@
     return Attribute::NoSync;
   case bitc::ATTR_KIND_NOCF_CHECK:
     return Attribute::NoCfCheck;
+  case bitc::ATTR_KIND_NO_PROFILE:
+    return Attribute::NoProfile;
   case bitc::ATTR_KIND_NO_UNWIND:
     return Attribute::NoUnwind;
   case bitc::ATTR_KIND_NO_SANITIZE_COVERAGE:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104995.354760.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210627/215ce9ea/attachment.bin>


More information about the llvm-commits mailing list