Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 1 | //===- UnwindInfoSection.h ------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLD_MACHO_UNWIND_INFO_H |
| 10 | #define LLD_MACHO_UNWIND_INFO_H |
| 11 | |
Jez Ng | 3370619 | 2021-05-25 14:57:16 -0400 | [diff] [blame] | 12 | #include "ConcatOutputSection.h" |
Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 13 | #include "SyntheticSections.h" |
Jez Ng | a9353db | 2021-10-26 16:04:06 -0400 | [diff] [blame] | 14 | #include "llvm/ADT/MapVector.h" |
Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 15 | |
Nico Weber | bf20d43 | 2022-08-07 10:37:49 -0400 | [diff] [blame] | 16 | namespace lld::macho { |
Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 17 | |
| 18 | class UnwindInfoSection : public SyntheticSection { |
| 19 | public: |
Jez Ng | a9353db | 2021-10-26 16:04:06 -0400 | [diff] [blame] | 20 | // If all functions are free of unwind info, we can omit the unwind info |
| 21 | // section entirely. |
| 22 | bool isNeeded() const override { return !allEntriesAreOmitted; } |
Jez Ng | a9353db | 2021-10-26 16:04:06 -0400 | [diff] [blame] | 23 | void addSymbol(const Defined *); |
Jez Ng | 7b45dfc | 2022-10-11 23:50:46 -0400 | [diff] [blame] | 24 | virtual void prepare() = 0; |
Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 25 | |
Jez Ng | 1460942 | 2021-04-15 21:14:33 -0400 | [diff] [blame] | 26 | protected: |
Jez Ng | 3a11528 | 2021-07-01 20:33:42 -0400 | [diff] [blame] | 27 | UnwindInfoSection(); |
Greg McGary | 9993071 | 2020-12-06 22:33:38 -0800 | [diff] [blame] | 28 | |
Jez Ng | a9353db | 2021-10-26 16:04:06 -0400 | [diff] [blame] | 29 | llvm::MapVector<std::pair<const InputSection *, uint64_t /*Defined::value*/>, |
| 30 | const Defined *> |
| 31 | symbols; |
Nico Weber | 8a7b5eb | 2021-07-07 11:28:27 -0400 | [diff] [blame] | 32 | bool allEntriesAreOmitted = true; |
Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 33 | }; |
| 34 | |
Jez Ng | 1460942 | 2021-04-15 21:14:33 -0400 | [diff] [blame] | 35 | UnwindInfoSection *makeUnwindInfoSection(); |
Jez Ng | 525bfa1 | 2021-02-08 13:47:33 -0500 | [diff] [blame] | 36 | |
Nico Weber | bf20d43 | 2022-08-07 10:37:49 -0400 | [diff] [blame] | 37 | } // namespace lld::macho |
Greg McGary | 2124ca1 | 2020-08-20 13:05:13 -0700 | [diff] [blame] | 38 | |
| 39 | #endif |