================
@@ -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);
----------------
Lukasdoe wrote:

You are entirely correct, the 
[Overview.md](https://github.com/WebAssembly/branch-hinting/blob/main/proposals/branch-hinting/Overview.md)
 file of the branch-hinting proposal mentions "The branch hints section should 
appear only once in a module, and only before the code section." However (what 
I based the implementation on), the [final code metadata 
specification](https://webassembly.github.io/branch-hinting/metadata/code/_download/WebAssembly-Metadata-Code.pdf)
 does not mention this require any longer. 

It does not specify any other placement requirement though and I see the appeal 
of having the branch hints before the code section for fast baseline 
compilation in a streaming setup.

So, following your suggestion, I'll amend lld to insert the combined 
branch-hint section at the appropriate place. Thanks for spotting this!

https://github.com/llvm/llvm-project/pull/146230
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to