diff options
| author | Rui Ueyama <ruiu@google.com> | 2014-06-05 07:37:20 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2014-06-05 07:37:20 +0000 |
| commit | f3cb9d1d57a763d46d4e7e46e660f06c9fb8ad55 (patch) | |
| tree | a6e1a1e9b068a2be81376f3319d557d871d01cb8 /lld/lib/ReaderWriter/PECOFF/Atoms.h | |
| parent | ff114dae5afadfc95ab8f670402ba8f141d52de2 (diff) | |
| download | bcm5719-llvm-f3cb9d1d57a763d46d4e7e46e660f06c9fb8ad55.tar.gz bcm5719-llvm-f3cb9d1d57a763d46d4e7e46e660f06c9fb8ad55.zip | |
[PECOFF] Support COMDAT associative sections.
COFF supports a feature similar to ELF's section groups. This
patch implements it.
In ELF, section groups are identified by their names, and they are
treated somewhat differently from regular symbols. In COFF, the
feature is realized in a more straightforward way. A section can
have an annotation saying "if Nth section is linked, link this
section too."
Implementing such feature is easy. We can add a reference from a
target atom to an original atom, so that if the target is linked,
the original atom is also linked. If not linked, both will be
dead-stripped. So they are treated as a group.
I added a new reference type, kindAssociate. It does nothing except
preventing referenced atoms from being dead-stripped.
No change to the Resolver is needed.
Reviewers: Bigcheese, shankarke, atanasyan
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D3946
llvm-svn: 210240
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/Atoms.h')
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/Atoms.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/Atoms.h b/lld/lib/ReaderWriter/PECOFF/Atoms.h index c4ae1271c0b..7cd74951c0c 100644 --- a/lld/lib/ReaderWriter/PECOFF/Atoms.h +++ b/lld/lib/ReaderWriter/PECOFF/Atoms.h @@ -167,6 +167,13 @@ public: uint64_t ordinal() const override { return _ordinal; } Alignment alignment() const override { return _alignment; } + void associate(COFFDefinedFileAtom *other) { + auto *r = new COFFReference(other, 0, Reference::kindAssociate, + Reference::KindNamespace::all, + Reference::KindArch::all); + addReference(std::unique_ptr<COFFReference>(r)); + } + private: StringRef _sectionName; Scope _scope; |

