diff options
| author | Daniel Thornburgh <dthorn@google.com> | 2024-08-05 13:06:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-05 13:06:45 -0700 |
| commit | 7e8a9020b1ae3dea28c19f0cd68743482dca13d9 (patch) | |
| tree | c56b216f7eec1c04d1a03c29eaf7faf6b6167626 /lld/ELF/InputSection.cpp | |
| parent | 88d288489e09a261f6740972dcaf6fedaf87a762 (diff) | |
[LLD] Add CLASS syntax to SECTIONS (#95323)
This allows the input section matching algorithm to be separated from
output section descriptions. This allows a group of sections to be
assigned to multiple output sections, providing an explicit version of
--enable-non-contiguous-regions's spilling that doesn't require altering
global linker script matching behavior with a flag. It also makes the
linker script language more expressive even if spilling is not intended,
since input section matching can be done in a different order than
sections are placed in an output section.
The implementation reuses the backend mechanism provided by
--enable-non-contiguous-regions, so it has roughly similar semantics and
limitations. In particular, sections cannot be spilled into or out of
INSERT, OVERWRITE_SECTIONS, or /DISCARD/. The former two aren't
intrinsic, so it may be possible to relax those restrictions later.
Diffstat (limited to 'lld/ELF/InputSection.cpp')
| -rw-r--r-- | lld/ELF/InputSection.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index da4c90516ec3..cf34a814fed4 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -194,6 +194,8 @@ uint64_t SectionBase::getOffset(uint64_t offset) const { // For output sections we treat offset -1 as the end of the section. return offset == uint64_t(-1) ? os->size : offset; } + case Class: + llvm_unreachable("section classes do not have offsets"); case Regular: case Synthetic: case Spill: |
