llvm-project
352fb9a2 - [ELF] Reduce symbol partitions to shim binaries (#198718)

Commit
15 hours ago
[ELF] Reduce symbol partitions to shim binaries (#198718) The experimental symbol partition feature can move arbitrary symbols and input sections out of the main partition into named loadable partitions that consumers extract with `llvm-objcopy --extract-partition`. It is incompatible with many features, has seen no adoption beyond Chromium's `build/extract_partition.py`. Chrome hasn't needed this feature for many years. The partitioning machinery (per-partition `MarkLive` runs, `moveToMain`, cross-partition pull in `InputSection::replace`, per-symbol dynsym/gnuhash/thunk-compat filters, `PartitionIndexSection`, `copySectionsIntoPartitions`, etc.) does not pull its weight for that. Remove the partitioning brain and keep a minimal shim shell. `Symbol::partition` is deleted; every dynsym add goes to `ctx.mainPart`. `ctx.partitions` wraps a `std::vector<Partition>` whose iterator yields only the main partition; shim partitions live in `storage[1..]` and are reached via `shims()`. The two paths that actually emit shim binaries (`createPhdrs` and `pageAlign` in Writer.cpp) name `shims()` directly. Shim partitions carry no per-partition synthetic content; the extracted shim is just an ELF header plus PT_PHDR/PT_LOAD. `llvm-objcopy --extract-partition` keeps working but `--dump-section .note.gnu.build-id` on a shim no longer finds anything. Features that previously used `dlopen()` to lazy-load a feature partition now live in main and are always loaded. Aided by Claude Opus 4.7
Author
Parents
Loading