github wild-linker/wild 0.11.0

3 hours ago

Lots of porting work has happened this release. The Wasm feature is now enabled by default, so Wild
can be used to link Wasm with the caveat that debug info isn't yet supported.

Support for GNU linker scripts is greatly enhanced. Wild now supports enough of the linker script
syntax that it can link Linux kernel modules and is close to being able to link the Linux kernel
itself.

The Mac port has made significant progress. The feature isn't yet to the point where we're prepared
to enable it by default, but Wild is able to link itself on Mac and at least one of the maintainers
is now using Wild as their default linker for Rust on Mac.

We've also fixed some performance issues that were affecting various filesystems and made a few
general performance improvements. We also got a bit slower due to implementing proper ELF COMDAT
support.

We now cap the number of threads to at most 32 unless overridden by --threads. This avoids bad
performance that occurs with larger numbers of threads due to contention on a Linux per-inode mutex.

Our benchmarks have been expanded to include a wider range of scenarios such as different
filesystems and whether the output file already exists.

Build requirements

  • Minimum rust version for building Wild is now 1.99.0

🚀 Features

  • Implement FILEHDR and PHDRS commands in a linker script (#2314)
  • Implement setting section attributes in linker scripts (#2342)
  • Support redefining linker script and defsym symbols (#2350)
  • Support compound assignment operators in linker scripts (#2384)
  • Implement ADRP+ADD to NOP+ADR relaxation for AArch64 (#2319)
  • Parse ASSERT in linker script expressions (#2402)
  • Support alignment up to 2^21 (#2409)
  • Support aligning a given expression in linker scripts (#2426)
  • Lookup object symbol values in linker script location counters (#2418)
  • Fetch symbols defined in a linker script in a location counter (#2475)
  • Support LDEMULATION environment variable (#2497)
  • (args) Implement --image-base flag (#2513)
  • (args) Implement -z force-ibt and -z cet-report flags (#2529)
  • Support --[no-]warn-execstack, --warn-execstack-objects, and --[no-]error-execstack (#2559)
  • (x86_64) Support SIZE32 and SIZE64 relocations (#2553)
  • Add --no-keep-memory (#2584)
  • Support emitting multiple error messages (#2599)
  • Implement --orphan-handling (#2566)
  • Add support for --only-keep-debug (#2472)
  • Support --enable-linker-version and --disable-linker-version (#2645)
  • (aarch64) Support build attributes in relocatable links (#2622)
  • Emit eager PLT stubs for dynamic calls for ppc64le (#2668)
  • Add support for --discard-none/--discard-all/--discard-locals (#2639)
  • (aarch64) Merge build attributes with GNU properties in relocatable links (#2681)
  • (aarch64) Implement --fix-cortex-a53-843419 (#2682)
  • Proper support for COMDAT groups (#2727)
  • Parse constant expressions in section ALIGN commands (#2730)
  • Decode medium-model TLS static relocations in ppc64le (#2724)
  • (aarch64) Implement -z force-bti (#2761)
  • Enable the Wasm feature by default (#2758)

⚡ Performance

  • Parallelize archive member open/parse (#2356)
  • Make OutputSectionPartMap sparse for custom sections (#2437)
  • Use HashMap for CommonGroupState::section_attributes (#2442)
  • Reduce sparse allocation in compute_start_offsets_by_group (#2443)
  • Use fallocate and hugepages on ext4/xfs (#2468)
  • Figure out start/stop section refs before GC phase (#2479)
  • Enable hugepages by default for all filesystems (#2508)
  • Enable mmap on Btrfs with sufficiently new kernel (#2509)
  • Group allocations of partial linking singletons (#2506)
  • Parallelise various partial linking stages (#2510)
  • Reuse non-atomic symbol addresses across RISC-V relaxation passes (#2507)
  • Compute only referenced symbol addresses on later RISC-V relaxation passes (#2518)
  • Release input mappings in parallel on shutdown (#2541)
  • A few microoptimisations in/around apply_relocations (#2548)
  • Shrink RelocationKindInfo struct size (#2603)
  • Apply large debug relocation sections in parallel shards (#2620)
  • Cap at 32 threads by default (#2670)
  • Replace some uses of object::SectionIndex with a 32 bit type (#2680)
  • Don't store erratum padding in section slot (#2736)
  • Make apply_debug_relocation faster with inlining (#2647)

đŸ’ģ CLI

  • Make --verbose affect --version output (#2792)

đŸĒ˛ Bug Fixes

  • Don't use .a from early directory over .so in later directory (#2382)
  • Follow GNU ld mandatory relaxations logic better (#2390)
  • Don't consume the next argument for --trace / -t (#2394)
  • Preserve original definitions for --wrap under linker-plugin LTO (#2393)
  • Apply ADD/SUB relocations correctly when reading debug sections for source info (#2411)
  • Correctly resolve linker script functions that return addresses (#2413)
  • Handle dynamic symbol export with LTO (#2410)
  • Correctly resolve location counter addresses after a section in linker scripts (#2435)
  • (opts) Support and ignore --verbose (#2446)
  • Support LTO with clang -ffat-lto-objects (#2445)
  • Use relaxed size for exported dynsym and allow dynsym debug refs (#2464)
  • Reserve 2 PLT/GOT entries for runtime on loongarch64/riscv64 (#2471)
  • Preserve function identity with canonical PLT entries (#2480)
  • Reject CREL relocations when partial linking (#2489)
  • Emit GLOBAL_OFFSET_TABLE as local hidden symbol (#2498)
  • Define hidden __dso_handle linker symbol (#2503)
  • (elf) Ignore unknown GNU property types instead of erroring (#2526)
  • (MachO) Use got_address for GOT-related relocations (#2536)
  • Error on copy relocations against protected shared-library symbols (#2550)
  • Honour interposition of IFUNC definitions in shared libraries (#2551)
  • Fix general-dynamic TLS offsets for locally bound exported symbols (#2571)
  • Align TLS segment p_vaddr to p_align (#2581)
  • (aarch64) Resolve undefined weak branch relocations (#2575)
  • Don't emit wide dynamic rel when narrow absolute rel requested (#2580)
  • Don't default update-in-place when file is hard linked (#2577)
  • (build) Address build failures with tracing-encoding with serde (#2582)
  • (aarch64) Resolve undefined weak relative relocations (#2591)
  • (aarch64) Resolve undefined weak PLT32 relocations (#2606)
  • (elf) Honor no-as-needed on repeated shared libraries (#2619)
  • Ensure deterministic output when mixing versioned and unversioned symbols with same name (#2637)
  • Apply the final sysroot to library search paths (#2636)
  • Keep allocated section offsets when compressing debug info (#2644)
  • Keep out-of-range RISC-V calls as auipc+jalr (#2649)
  • Only load linker script PROVIDE symbols if referenced (#2633)
  • Ensure unversioned archive symbol can override multiple so versioned syms (#2642)
  • Handle debug sections selected by scripts when compressing (#2652)
  • Don't consume file bytes for non-alloc NOBITS sections (#2657)
  • Map AbsoluteLowPart with DIRECT ValueFlags (#2665)
  • Handle symbol-free debug relocations (#2696)
  • (aarch64) Process build attributes in final links (#2702)
  • Emit PLT stubs for unresolved REL24 calls in ppc64le (#2715)
  • Emit PLT stubs for interposable calls in ppc64le (#2722)
  • Place headers before custom base address (#2709)
  • (aarch64) Warn on malformed build attributes (#2725)
  • (x86_64) Relax only full 64-bit read for R_X86_64_GOTPCREL (#2732)
  • (x86_64) Relax APX TLSDESC references to initial exec (#2741)
  • Align up TLS_MODULE_BASE symbol (#2745)
  • Link fat LTO objects natively when no plugin is supplied (#2737)
  • Support '=' and '$SYSROOT' in linker scripts and inputs (#2720)
  • (x86_64) Respect immediate ranges in GOTPCRELX relaxations (#2753)
  • (aarch64) Reject nonzero addends in ADRP+ADD relaxation (#2760)
  • (elf) Ensure null section has zeroed fields (#2754)
  • Check GOTPCRELX addends (#2773)
  • Properly handle absolute GOTPCREL loads in PIEs (#2772)
  • (thunks) Error if a branch cannot reach its allocated thunk (#2776)
  • (elf) Discard input .note.gnu.build-id sections (#2768)
  • Handle REX2 TLSDESC registers (#2778)
  • Respect absolute symbol interposition on x86_64 (#2779)
  • (elf) Don't emit unreferenced __ehdr_start and __executable_start (#2783)
  • Do not set .rela.plt sh_link without .dynsym (#2750)
  • (elf) Hide .TOC., _DYNAMIC and _TLS_MODULE_BASE_ (#2785)

📚 Documentation

  • Add link to Rui's paper to reading section (#2484)
  • Add REUSE.toml (#2328)
  • Move usage and FAQ out of the README (#2605)

đŸ•šī¸ Porting (Wasm)

  • Add version and help options (#2333)
  • Warn on -mllvm option values (#2340)
  • Synthesize GOT.func globals for R_WASM_GLOBAL_INDEX (#2332)
  • Ignore --no-merge-data-segments (#2357)
  • Support GC for functions, globals, data, and imports (#2353)
  • Redirect defined weak functions to the winning definition (#2377)
  • Support --export-memory (#2381)
  • Support --max-memory (#2387)
  • Speed up name section construction (#2389)
  • Error on undefined strong symbols by default and add --allow-undefined (#2345)
  • Synthesize linker-defined __dso_handle (#2406)
  • Add support for --export-if-defined (#2408)
  • Support --export of linker-defined symbols (#2414)
  • Parallelize layout relocation scan (#2432)
  • Hold relocations as per-object ranges (#2434)
  • Support --(no-)allow-multiple-definition and -z muldefs (#2450)
  • Always emit memory and __stack_pointer (#2457)
  • Support --shared-memory (#2449)
  • Support --extra-features (#2470)
  • Support --demangle and --no-demangle (#2485)
  • Wrap all defined exports with __wasm_call_ctors (#2499)
  • Keep name and flags from linking SegmentInfo (#2501)
  • Support single-threaded TLS (#2524)
  • Support --import-memory (#2505)
  • Support --strip-debug (#2596)
  • Document using Wild as a Wasm linker (#2597)
  • Drop unused function types from the type section (#2417)
  • Emit passive data segments (#2610)
  • Initialize shared-memory TLS with __wasm_init_tls (#2692)
  • Initialize shared data once from __wasm_init_memory (#2695)
  • Support v128 value types (#2710)
  • Support --check-features and --no-check-features (#2711)
  • Concatenate debug sections in the output wasm binary (#2713)
  • Support --whole-archive and --no-whole-archive (#2716)
  • Support --export-dynamic and --no-export-dynamic (#2717)
  • Apply shared-memory TLS template pointers per thread (#2733)
  • Support --strip-all (#2744)
  • Skip decoding bodies without memory.init or data.drop (#2746)
  • Demangle symbol names in parallel (#2747)
  • Set shared-memory TLS GOT slots per thread (#2743)
  • Support --export of data symbols (#2765)
  • Speed up name section encoding (#2755)
  • Support --keep-section (#2780)
  • Allow strong data to override weak data (#2787)

đŸ•šī¸ Porting (Mach-O)

  • Add ld as a reference linker (#2323)
  • Emit only retained section headers (#2330)
  • Propagate input section flags (#2343)
  • Add support for (segment name, section name) identification (#2354)
  • Always page align content in Fat files (#2372)
  • Simplify used types a bit (#2373)
  • Use chained-fixup data types from object crate (#2376)
  • Drop unnecessary CodeSignature alignment (#2378)
  • Add support for arbitrary segments (#2383)
  • Support dynamic export of symbols (#2386)
  • Use UnlinkAndReplace for outputs (#2391)
  • Order TLV template sections (#2420)
  • Align __thread_data and __thread_bss (#2455)
  • Align __thread_vars (#2458)
  • Add TLV pointer ldr relaxation (#2476)
  • Fix TLV descriptor offset (#2488)
  • Support __init_offsets and __dso_handle symbol (#2493)
  • Relax GOT-relative relocations (#2504)
  • Emit bind fixups for non-GOT entries (#2521)
  • Set MH_HAS_TLV_DESCRIPTORS in header flags (#2527)
  • Implement ARM64_RELOC_ADDEND (#2532)
  • Use GOT for imported TLV descriptor (#2539)
  • Implement __compact_unwind section emission (#2535)
  • Support implicit addend for relocations (#2562)
  • Support rebase fixups (#2585)
  • Include new timing_phase notes (#2589)
  • Encode implicit addend in the bind fixups (#2588)
  • Optimize some of the critical functions (#2595)
  • Support ARM64_RELOC_SUBTRACTOR (#2600)
  • Support local GOT entries (#2617)
  • Ignore -dead_strip option now (#2625)
  • Always keep empty section (#2638)
  • Fill up BuildToolVersion (#2632)
  • Support fixups in multiple pages per segment (#2631)
  • Refactor process_relocation (#2660)
  • Add --help and --version options (#2663)
  • Make BufferThenWrite default (#2662)
  • Support local palette in compact unwind (#2669)
  • Add 2 options and ignore unsupported yet (#2673)
  • Ignore -sectcreate option now (#2675)
  • Support -headerpad_max_install_names option (#2672)
  • Emit LC_RPATH load commands (#2679)
  • Use LC_ID_DYLIB when linking against dylibs (#2688)
  • Minimal dylib output support (#2689)
  • Support common symbols (#2690)
  • Resolve unreferenced symbols copied to the symbol table (#2697)
  • Relax local TLS accesses in dylibs (#2694)
  • Emit private extern symbols as locals (#2698)
  • Make UUID based on code signature (#2701)
  • Include allocation stats for some sections (#2712)
  • Make Write data to file more parallel (#2714)
  • Sort trie symbols and fixups in parallel (#2721)
  • Support EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL (#2729)
  • Collect unwind infos as Vec<Vec<_>> (#2728)
  • Support --exported_symbols_list (#2770)
  • Support -framework (#2777)
  • Parse stub sub-libraries in parallel (#2664)
  • Build trie directly (#2594)
  • Just compute exports trie once (#2609)
  • Simplify the calling for validation function (#2788)

đŸ•šī¸ Porting (other)

  • (coff) Add MSVC link.exe-style argument parsing (#2374)

💲 Sponsors

Thanks to everyone who has sponsored davidlattimore, in particular AWS and OpenAI for sponsoring via the Rust Innovation Lab and the following people who have sponsored at least $30 since the last release:

  • wasmerio
  • repi
  • rerun-io
  • rrbutani
  • Rafferty97
  • marxin
  • mati865
  • ArthurBrussee
  • Urgau
  • reivilibre
  • Tudyx
  • +44 others

Don't miss a new wild release

NewReleases is sending notifications on new releases.