LLVM 19 will be released. As usual, I maintain lld/ELF and have addedsome notes to https://github.com/llvm/llvm-project/blob/release/19.x/lld/docs/ReleaseNotes.rst.I've meticulously reviewed nearly all the patches that are not authoredby me. I'll delve into some of the key changes.
EI_OSABI
in the output is now inferred from inputobject files. (#97144)--compress-sections <section-glib>={none,zlib,zstd}[:level]
is added to compress matched output sections without theSHF_ALLOC
flag. (#84855) (#90567)Z_BEST_SPEED
).ZSTD_MULITHREAD
build.GNU_PROPERTY_AARCH64_FEATURE_PAUTH
notes,R_AARCH64_AUTH_ABS64
andR_AARCH64_AUTH_RELATIVE
relocations are now supported. (#72714)--no-allow-shlib-undefined
now rejects non-exporteddefinitions in the def-hidden.so ref.so
case. (#86777)--debug-names
is added to create a merged.debug_names
index from input .debug_names
sections. Type units are not handled yet. (#86508)--enable-non-contiguous-regions
option allowsautomatically packing input sections into memory regions byautomatically spilling to later matches if a region would overflow. Thisreduces the toil of manually packing regions (typical for embedded). Italso makes full LTO feasible in such cases, since IR merging currentlyprevents the linker script from referring to input files. (#90007)--default-script
/-dT
is implemented tospecify a default script that is processed if--script
/-T
is not specified. (#89327)--force-group-allocation
is implemented to discardSHT_GROUP
sections and combine relocation sections if theirrelocated section group members are placed to the same output section.(#94704)--build-id
now defaults to generating a 20-byte digest("sha1") instead of 8-byte ("fast"). This improves compatibility withRPM packaging tools. (#93943)-z lrodata-after-bss
is implemented to place.lrodata
after .bss
. (#81224)--export-dynamic
no longer creates dynamic sections for-no-pie
static linking.--lto-emit-asm
is now added as the canonical spellingof --plugin-opt=emit-llvm
.--lto-emit-llvm
now uses the pre-codegen module. (#97480)-z pack-relative-relocs
now encodes R_AARCH64_AUTH_RELATIVE
relocations in.rela.auth.dyn
. (#96496)-z gcs
and -z gcs-report
are now supportedfor AArch64 Guarded Control Stack extension.-r
now forces -Bstatic
.DW_EH_sdata4
of addresses larger than 0x80000000 is nowsupported for MIPS32. (#92438)PROVIDE(lhs = rhs) PROVIDE(rhs = ...)
, lhs
is now defined only if rhs
is needed. (#74771) (#87530)OUTPUT_FORMAT(binary)
is now supported. (#98837)NOCROSSREFS
and NOCRFOSSREFS_TO
commandsnow supported to prohibit cross references between certain outputsections. (#98773)--compress-sections
The --compress-sections
option has been enhanced. Youcan choose between zlib and zstd for compression, along with specifyingthe desired compression level. Looking ahead, zlib is deprecated infavor of zstd. While zstd offers additional tuning options, we onlyprovide the compression level.
My Compressedarbitrary sections has analyzed potential use cases.
Check out Understandingorphan sections.
There are quite a few enhancements to the linker script support.NOCROSSREFS
and--enable-non-contiguous-regions
are noteworthy newfeatures. There is now an increasing demand of features for embeddedprogramming.
The world of embedded programming is a fascinating mix of open andclosed ecosystems. Developers of proprietary hardware and closed-sourcesoftware are increasingly interested in migrating their toolchains tothe LLVM Linker (LLD). The allure of faster link speeds, a cleancodebase, and seamless LTO integration is undeniable. However, as LLD'smaintainer, I must tread carefully. While accommodating these users isnice for LLD's growth, incorporating custom linker extensions riskscompromising the project's code quality and maintainability. Strikingthe right balance between flexibility and code integrity is essential toensure LLD remains a robust and efficient linker for a wide range ofusers.
GNU ld also supports extensions for embedded programming. Icategorize these extensions into two groups: mature and experimental.Many of the established extensions exhibit well-defined semantics andhave been incorporated into LLD. However, some newer extensions in GNUld appear less thoughtfully designed and inflexible.
When considering a specific extension, we should prioritize practicalneeds over arbitrary adherence to GNU ld's implementation. If compellingreasons justify a particular feature and GNU ld's approach provesrestrictive, we should feel empowered to innovate within LLD.
Conversely, when developing new extensions, it's essential to engagewith the broader community. I often submit feature requests to GNU ld toinform decisions we are going to make. I believe this collaborativeapproach fosters knowledge sharing.
I've developed CREL (compact relocations) to reduce relocatable filetremendously for LLVM 19. LLD now supports CREL with explicit addends.See Integratedassembler improvements in LLVM 19 for details.
Link: lld 18 ELFchanges