rust/compiler/rustc_codegen_llvm/src
Trevor Gross 986d6bf9fb
Rollup merge of #121533 - ratmice:wasm_init_fini_array, r=nnethercote
Handle .init_array link_section specially on wasm

Given that wasm-ld now has support for [.init_array](8f2bd8ae68/llvm/lib/MC/WasmObjectWriter.cpp (L1852)), it appears we can easily implement that section by falling through to the normal path rather than taking the typical custom_section path for wasm.

The wasm-ld appears to have a bunch of limitations. Only one static with the `link_section` in a crate or else you hit the fatal error in the link above "only one .init_array section fragment supported". They do not get merged.

You can still call multiple constructors by setting it to an array.

```
unsafe extern "C" fn ctor() {
    println!("foo");
}
#[used]
#[link_section = ".init_array"]
static FOO: [unsafe extern "C" fn(); 2] = [ctor, ctor];
```

Another issue appears to be that if crate *A* depends on crate *B*, but *A* doesn't call any symbols from *B* and *B* doesn't `#[export_name = ...]` any symbols, then crate *B*'s constructor will not be called.  The workaround to this is to provide an exported symbol in crate *B*.
2024-07-19 03:27:46 -05:00
..
back Rollup merge of #124033 - bjorn3:ar_archive_writer_0_3_0, r=davidtwco 2024-07-16 16:15:13 -05:00
coverageinfo coverage: Restrict ExpressionUsed simplification to Code mappings 2024-07-15 20:54:28 +10:00
debuginfo Auto merge of #127001 - beetrees:f16-debuginfo, r=michaelwoerister 2024-07-09 09:07:42 +00:00
llvm Rollup merge of #124033 - bjorn3:ar_archive_writer_0_3_0, r=davidtwco 2024-07-16 16:15:13 -05:00
abi.rs Use the aligned size for alloca at args when the pass mode is cast. 2024-07-02 06:33:35 +08:00
allocator.rs Fix unsafe_op_in_unsafe_fn in compiler 2024-07-16 00:02:44 -04:00
asm.rs Rollup merge of #126555 - beetrees:f16-inline-asm-arm, r=Amanieu 2024-06-22 12:57:18 +02:00
attributes.rs Remove extern "wasm" ABI 2024-07-11 12:20:26 +02:00
base.rs compiler: replace cstr macro with c str literals in compiler and few other c str replacements 2023-12-03 14:54:09 +03:00
builder.rs Remove #[macro_use] extern crate tracing from rustc_codegen_llvm. 2024-05-23 18:02:40 +10:00
callee.rs Remove #[macro_use] extern crate tracing from rustc_codegen_llvm. 2024-05-23 18:02:40 +10:00
common.rs Miri function identity hack: account for possible inlining 2024-07-02 21:05:30 +02:00
consts.rs Rollup merge of #121533 - ratmice:wasm_init_fini_array, r=nnethercote 2024-07-19 03:27:46 -05:00
context.rs Fix unsafe_op_in_unsafe_fn in compiler 2024-07-16 00:02:44 -04:00
declare.rs Remove #[macro_use] extern crate tracing from rustc_codegen_llvm. 2024-05-23 18:02:40 +10:00
errors.rs Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
intrinsic.rs Add f16 and f128 as SIMD types in LLVM 2024-07-08 13:59:39 -04:00
lib.rs Fix unsafe_op_in_unsafe_fn in compiler 2024-07-16 00:02:44 -04:00
llvm_util.rs Fix unsafe_op_in_unsafe_fn in compiler 2024-07-16 00:02:44 -04:00
mono_item.rs Fix unsafe_op_in_unsafe_fn in compiler 2024-07-16 00:02:44 -04:00
type_.rs Remove type_i1 and type_struct from cg_ssa 2024-06-21 19:30:26 +00:00
type_of.rs Uplift TypeRelation and Relate 2024-06-01 12:50:58 -04:00
va_arg.rs Add arm64ec-pc-windows-msvc target 2024-03-06 17:49:37 -08:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00