Skip to content

Commit

Permalink
Put the global initialization function in wasm section
Browse files Browse the repository at this point in the history
  • Loading branch information
DutChen18 authored and yuri91 committed Oct 10, 2024
1 parent 719d1f4 commit 6dfb6ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/CodeGen/CGDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,9 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
llvm::Function *Fn = CreateGlobalInitOrCleanUpFunction(
FTy, "_GLOBAL__I_" + getPrioritySuffix(Priority), FI);

if (Context.getTargetInfo().getTriple().getEnvironment() == llvm::Triple::WebAssembly)
Fn->setSection("asmjs");

// Prepend the module inits to the highest priority set.
if (!ModuleInits.empty()) {
for (auto *F : ModuleInits)
Expand Down

0 comments on commit 6dfb6ea

Please sign in to comment.