[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

Alon Zakai via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 1 08:33:48 PDT 2025


================
@@ -165,14 +165,17 @@ void Writer::createCustomSections() {
   for (auto &pair : customSectionMapping) {
     StringRef name = pair.first;
     LLVM_DEBUG(dbgs() << "createCustomSection: " << name << "\n");
-
-    OutputSection *sec = make<CustomSection>(std::string(name), pair.second);
+    OutputSection *Sec;
+    if (name == "metadata.code.branch_hint")
+      Sec = make<CodeMetaDataSection>(std::string(name), pair.second);
----------------
kripken wrote:

Interesting, that might be a missing point in the spec, then - @yuri91 , should the spec mention that the branch hint section goes before the code?

Or, if the order is intentionally not constrained in the spec then this would be a bug in V8, as atm it only works if branch hints appear earlier.

https://github.com/llvm/llvm-project/pull/146230


More information about the cfe-commits mailing list