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
25 lines
701 B
C++
25 lines
701 B
C++
//===- Writer.h -------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLD_ELF_WRITER_H
|
|
#define LLD_ELF_WRITER_H
|
|
|
|
#include "Config.h"
|
|
|
|
namespace lld::elf {
|
|
class OutputSection;
|
|
template <class ELFT> void writeResult(Ctx &ctx);
|
|
|
|
void addReservedSymbols(Ctx &ctx);
|
|
bool includeInSymtab(Ctx &, const Symbol &);
|
|
unsigned getSectionRank(Ctx &, OutputSection &osec);
|
|
|
|
} // namespace lld::elf
|
|
|
|
#endif
|