[llvm] [WebAssembly] Support multiple `.init_array` fragments when writing Wasm objects (PR #111008)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 09:52:33 PST 2024


================
@@ -1769,6 +1769,11 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
       WS.setIndex(InvalidIndex);
       continue;
     }
+    // Contents of .init_array sections are handled elsewhere.
+    if (WS.isDefined() &&
+        WS.getSection().getName().starts_with(".init_array")) {
----------------
sbc100 wrote:

> ```rust
> unsafe extern "C" fn __ctor() {
>     [...]
> }
> #[cfg_attr(link_section = ".init_array")]
> static __CTOR: unsafe extern "C" fn() = __ctor;
> ```

In this example which is the symbol that lives in the `.init_array` section?  I guess it would be `__CTOR`?

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


More information about the llvm-commits mailing list