1e8d8bef9SDimitry Andric //===- UnwindInfoSection.h ------------------------------------------------===// 2e8d8bef9SDimitry Andric // 3e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e8d8bef9SDimitry Andric // 7e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===// 8e8d8bef9SDimitry Andric 9e8d8bef9SDimitry Andric #ifndef LLD_MACHO_UNWIND_INFO_H 10e8d8bef9SDimitry Andric #define LLD_MACHO_UNWIND_INFO_H 11e8d8bef9SDimitry Andric 12fe6060f1SDimitry Andric #include "ConcatOutputSection.h" 13e8d8bef9SDimitry Andric #include "SyntheticSections.h" 14349cc55cSDimitry Andric #include "llvm/ADT/MapVector.h" 15e8d8bef9SDimitry Andric 16*bdd1243dSDimitry Andric namespace lld::macho { 17e8d8bef9SDimitry Andric 18e8d8bef9SDimitry Andric class UnwindInfoSection : public SyntheticSection { 19e8d8bef9SDimitry Andric public: 20349cc55cSDimitry Andric // If all functions are free of unwind info, we can omit the unwind info 21349cc55cSDimitry Andric // section entirely. isNeeded()22349cc55cSDimitry Andric bool isNeeded() const override { return !allEntriesAreOmitted; } 23349cc55cSDimitry Andric void addSymbol(const Defined *); 24f3fd488fSDimitry Andric virtual void prepare() = 0; 25e8d8bef9SDimitry Andric 26fe6060f1SDimitry Andric protected: 27fe6060f1SDimitry Andric UnwindInfoSection(); 28e8d8bef9SDimitry Andric 29349cc55cSDimitry Andric llvm::MapVector<std::pair<const InputSection *, uint64_t /*Defined::value*/>, 30349cc55cSDimitry Andric const Defined *> 31349cc55cSDimitry Andric symbols; 32fe6060f1SDimitry Andric bool allEntriesAreOmitted = true; 33e8d8bef9SDimitry Andric }; 34e8d8bef9SDimitry Andric 35fe6060f1SDimitry Andric UnwindInfoSection *makeUnwindInfoSection(); 36fe6060f1SDimitry Andric 37*bdd1243dSDimitry Andric } // namespace lld::macho 38e8d8bef9SDimitry Andric 39e8d8bef9SDimitry Andric #endif 40