1 //===- UnwindInfoSection.cpp ----------------------------------------------===//
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 #include "UnwindInfoSection.h"
10 #include "Config.h"
11 #include "InputSection.h"
12 #include "MergedOutputSection.h"
13 #include "OutputSection.h"
14 #include "OutputSegment.h"
15 #include "SymbolTable.h"
16 #include "Symbols.h"
17 #include "SyntheticSections.h"
18 #include "Target.h"
19 
20 #include "lld/Common/ErrorHandler.h"
21 #include "lld/Common/Memory.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/BinaryFormat/MachO.h"
24 
25 using namespace llvm;
26 using namespace llvm::MachO;
27 using namespace lld;
28 using namespace lld::macho;
29 
30 #define COMMON_ENCODINGS_MAX 127
31 #define COMPACT_ENCODINGS_MAX 256
32 
33 #define SECOND_LEVEL_PAGE_BYTES 4096
34 #define SECOND_LEVEL_PAGE_WORDS (SECOND_LEVEL_PAGE_BYTES / sizeof(uint32_t))
35 #define REGULAR_SECOND_LEVEL_ENTRIES_MAX                                       \
36   ((SECOND_LEVEL_PAGE_BYTES -                                                  \
37     sizeof(unwind_info_regular_second_level_page_header)) /                    \
38    sizeof(unwind_info_regular_second_level_entry))
39 #define COMPRESSED_SECOND_LEVEL_ENTRIES_MAX                                    \
40   ((SECOND_LEVEL_PAGE_BYTES -                                                  \
41     sizeof(unwind_info_compressed_second_level_page_header)) /                 \
42    sizeof(uint32_t))
43 
44 #define COMPRESSED_ENTRY_FUNC_OFFSET_BITS 24
45 #define COMPRESSED_ENTRY_FUNC_OFFSET_MASK                                      \
46   UNWIND_INFO_COMPRESSED_ENTRY_FUNC_OFFSET(~0)
47 
48 // Compact Unwind format is a Mach-O evolution of DWARF Unwind that
49 // optimizes space and exception-time lookup.  Most DWARF unwind
50 // entries can be replaced with Compact Unwind entries, but the ones
51 // that cannot are retained in DWARF form.
52 //
53 // This comment will address macro-level organization of the pre-link
54 // and post-link compact unwind tables. For micro-level organization
55 // pertaining to the bitfield layout of the 32-bit compact unwind
56 // entries, see libunwind/include/mach-o/compact_unwind_encoding.h
57 //
58 // Important clarifying factoids:
59 //
60 // * __LD,__compact_unwind is the compact unwind format for compiler
61 // output and linker input. It is never a final output. It could be
62 // an intermediate output with the `-r` option which retains relocs.
63 //
64 // * __TEXT,__unwind_info is the compact unwind format for final
65 // linker output. It is never an input.
66 //
67 // * __TEXT,__eh_frame is the DWARF format for both linker input and output.
68 //
69 // * __TEXT,__unwind_info entries are divided into 4 KiB pages (2nd
70 // level) by ascending address, and the pages are referenced by an
71 // index (1st level) in the section header.
72 //
73 // * Following the headers in __TEXT,__unwind_info, the bulk of the
74 // section contains a vector of compact unwind entries
75 // `{functionOffset, encoding}` sorted by ascending `functionOffset`.
76 // Adjacent entries with the same encoding can be folded to great
77 // advantage, achieving a 3-order-of-magnitude reduction in the
78 // number of entries.
79 //
80 // * The __TEXT,__unwind_info format can accommodate up to 127 unique
81 // encodings for the space-efficient compressed format. In practice,
82 // fewer than a dozen unique encodings are used by C++ programs of
83 // all sizes. Therefore, we don't even bother implementing the regular
84 // non-compressed format. Time will tell if anyone in the field ever
85 // overflows the 127-encodings limit.
86 //
87 // Refer to the definition of unwind_info_section_header in
88 // compact_unwind_encoding.h for an overview of the format we are encoding
89 // here.
90 
91 // TODO(gkm): prune __eh_frame entries superseded by __unwind_info
92 // TODO(gkm): how do we align the 2nd-level pages?
93 
94 using EncodingMap = llvm::DenseMap<compact_unwind_encoding_t, size_t>;
95 
96 template <class Ptr> struct CompactUnwindEntry {
97   Ptr functionAddress;
98   uint32_t functionLength;
99   compact_unwind_encoding_t encoding;
100   Ptr personality;
101   Ptr lsda;
102 };
103 
104 struct SecondLevelPage {
105   uint32_t kind;
106   size_t entryIndex;
107   size_t entryCount;
108   size_t byteCount;
109   std::vector<compact_unwind_encoding_t> localEncodings;
110   EncodingMap localEncodingIndexes;
111 };
112 
113 template <class Ptr> class UnwindInfoSectionImpl : public UnwindInfoSection {
114 public:
115   void prepareRelocations(InputSection *) override;
116   void finalize() override;
117   void writeTo(uint8_t *buf) const override;
118 
119 private:
120   std::vector<std::pair<compact_unwind_encoding_t, size_t>> commonEncodings;
121   EncodingMap commonEncodingIndexes;
122   // Indices of personality functions within the GOT.
123   std::vector<uint32_t> personalities;
124   SmallDenseMap<std::pair<InputSection *, uint64_t /* addend */>, Symbol *>
125       personalityTable;
126   std::vector<unwind_info_section_header_lsda_index_entry> lsdaEntries;
127   // Map of function offset (from the image base) to an index within the LSDA
128   // array.
129   llvm::DenseMap<uint32_t, uint32_t> functionToLsdaIndex;
130   std::vector<CompactUnwindEntry<Ptr>> cuVector;
131   std::vector<CompactUnwindEntry<Ptr> *> cuPtrVector;
132   std::vector<SecondLevelPage> secondLevelPages;
133   uint64_t level2PagesOffset = 0;
134 };
135 
136 // Compact unwind relocations have different semantics, so we handle them in a
137 // separate code path from regular relocations. First, we do not wish to add
138 // rebase opcodes for __LD,__compact_unwind, because that section doesn't
139 // actually end up in the final binary. Second, personality pointers always
140 // reside in the GOT and must be treated specially.
141 template <class Ptr>
142 void UnwindInfoSectionImpl<Ptr>::prepareRelocations(InputSection *isec) {
143   assert(isec->segname == segment_names::ld &&
144          isec->name == section_names::compactUnwind);
145 
146   for (Reloc &r : isec->relocs) {
147     assert(target->hasAttr(r.type, RelocAttrBits::UNSIGNED));
148     if (r.offset % sizeof(CompactUnwindEntry<Ptr>) !=
149         offsetof(CompactUnwindEntry<Ptr>, personality))
150       continue;
151 
152     if (auto *s = r.referent.dyn_cast<Symbol *>()) {
153       if (auto *undefined = dyn_cast<Undefined>(s)) {
154         treatUndefinedSymbol(*undefined);
155         // treatUndefinedSymbol() can replace s with a DylibSymbol; re-check.
156         if (isa<Undefined>(s))
157           continue;
158       }
159       if (auto *defined = dyn_cast<Defined>(s)) {
160         // Check if we have created a synthetic symbol at the same address.
161         Symbol *&personality =
162             personalityTable[{defined->isec, defined->value}];
163         if (personality == nullptr) {
164           personality = defined;
165           in.got->addEntry(defined);
166         } else if (personality != defined) {
167           r.referent = personality;
168         }
169         continue;
170       }
171       assert(isa<DylibSymbol>(s));
172       in.got->addEntry(s);
173       continue;
174     }
175 
176     if (auto *referentIsec = r.referent.dyn_cast<InputSection *>()) {
177       // Personality functions can be referenced via section relocations
178       // if they live in the same object file. Create placeholder synthetic
179       // symbols for them in the GOT.
180       Symbol *&s = personalityTable[{referentIsec, r.addend}];
181       if (s == nullptr) {
182         s = make<Defined>("<internal>", /*file=*/nullptr, referentIsec,
183                           r.addend, /*size=*/0, /*isWeakDef=*/false,
184                           /*isExternal=*/false, /*isPrivateExtern=*/false);
185         in.got->addEntry(s);
186       }
187       r.referent = s;
188       r.addend = 0;
189     }
190   }
191 }
192 
193 // Unwind info lives in __DATA, and finalization of __TEXT will occur before
194 // finalization of __DATA. Moreover, the finalization of unwind info depends on
195 // the exact addresses that it references. So it is safe for compact unwind to
196 // reference addresses in __TEXT, but not addresses in any other segment.
197 static void checkTextSegment(InputSection *isec) {
198   if (isec->segname != segment_names::text)
199     error("compact unwind references address in " + toString(isec) +
200           " which is not in segment __TEXT");
201 }
202 
203 // We need to apply the relocations to the pre-link compact unwind section
204 // before converting it to post-link form. There should only be absolute
205 // relocations here: since we are not emitting the pre-link CU section, there
206 // is no source address to make a relative location meaningful.
207 template <class Ptr>
208 static void
209 relocateCompactUnwind(MergedOutputSection *compactUnwindSection,
210                       std::vector<CompactUnwindEntry<Ptr>> &cuVector) {
211   for (const InputSection *isec : compactUnwindSection->inputs) {
212     uint8_t *buf =
213         reinterpret_cast<uint8_t *>(cuVector.data()) + isec->outSecFileOff;
214     memcpy(buf, isec->data.data(), isec->data.size());
215 
216     for (const Reloc &r : isec->relocs) {
217       uint64_t referentVA = 0;
218       if (auto *referentSym = r.referent.dyn_cast<Symbol *>()) {
219         if (!isa<Undefined>(referentSym)) {
220           assert(referentSym->isInGot());
221           if (auto *defined = dyn_cast<Defined>(referentSym))
222             checkTextSegment(defined->isec);
223           // At this point in the link, we may not yet know the final address of
224           // the GOT, so we just encode the index. We make it a 1-based index so
225           // that we can distinguish the null pointer case.
226           referentVA = referentSym->gotIndex + 1;
227         }
228       } else if (auto *referentIsec = r.referent.dyn_cast<InputSection *>()) {
229         checkTextSegment(referentIsec);
230         referentVA = referentIsec->getVA() + r.addend;
231       }
232 
233       writeAddress(buf + r.offset, referentVA, r.length);
234     }
235   }
236 }
237 
238 // There should only be a handful of unique personality pointers, so we can
239 // encode them as 2-bit indices into a small array.
240 template <class Ptr>
241 void encodePersonalities(
242     const std::vector<CompactUnwindEntry<Ptr> *> &cuPtrVector,
243     std::vector<uint32_t> &personalities) {
244   for (CompactUnwindEntry<Ptr> *cu : cuPtrVector) {
245     if (cu->personality == 0)
246       continue;
247     // Linear search is fast enough for a small array.
248     auto it = find(personalities, cu->personality);
249     uint32_t personalityIndex; // 1-based index
250     if (it != personalities.end()) {
251       personalityIndex = std::distance(personalities.begin(), it) + 1;
252     } else {
253       personalities.push_back(cu->personality);
254       personalityIndex = personalities.size();
255     }
256     cu->encoding |=
257         personalityIndex << countTrailingZeros(
258             static_cast<compact_unwind_encoding_t>(UNWIND_PERSONALITY_MASK));
259   }
260   if (personalities.size() > 3)
261     error("too many personalities (" + std::to_string(personalities.size()) +
262           ") for compact unwind to encode");
263 }
264 
265 // Scan the __LD,__compact_unwind entries and compute the space needs of
266 // __TEXT,__unwind_info and __TEXT,__eh_frame
267 template <class Ptr> void UnwindInfoSectionImpl<Ptr>::finalize() {
268   if (compactUnwindSection == nullptr)
269     return;
270 
271   // At this point, the address space for __TEXT,__text has been
272   // assigned, so we can relocate the __LD,__compact_unwind entries
273   // into a temporary buffer. Relocation is necessary in order to sort
274   // the CU entries by function address. Sorting is necessary so that
275   // we can fold adjacent CU entries with identical
276   // encoding+personality+lsda. Folding is necessary because it reduces
277   // the number of CU entries by as much as 3 orders of magnitude!
278   compactUnwindSection->finalize();
279   assert(compactUnwindSection->getSize() % sizeof(CompactUnwindEntry<Ptr>) ==
280          0);
281   size_t cuCount =
282       compactUnwindSection->getSize() / sizeof(CompactUnwindEntry<Ptr>);
283   cuVector.resize(cuCount);
284   relocateCompactUnwind(compactUnwindSection, cuVector);
285 
286   // Rather than sort & fold the 32-byte entries directly, we create a
287   // vector of pointers to entries and sort & fold that instead.
288   cuPtrVector.reserve(cuCount);
289   for (CompactUnwindEntry<Ptr> &cuEntry : cuVector)
290     cuPtrVector.emplace_back(&cuEntry);
291   std::sort(
292       cuPtrVector.begin(), cuPtrVector.end(),
293       [](const CompactUnwindEntry<Ptr> *a, const CompactUnwindEntry<Ptr> *b) {
294         return a->functionAddress < b->functionAddress;
295       });
296 
297   // Fold adjacent entries with matching encoding+personality+lsda
298   // We use three iterators on the same cuPtrVector to fold in-situ:
299   // (1) `foldBegin` is the first of a potential sequence of matching entries
300   // (2) `foldEnd` is the first non-matching entry after `foldBegin`.
301   // The semi-open interval [ foldBegin .. foldEnd ) contains a range
302   // entries that can be folded into a single entry and written to ...
303   // (3) `foldWrite`
304   auto foldWrite = cuPtrVector.begin();
305   for (auto foldBegin = cuPtrVector.begin(); foldBegin < cuPtrVector.end();) {
306     auto foldEnd = foldBegin;
307     while (++foldEnd < cuPtrVector.end() &&
308            (*foldBegin)->encoding == (*foldEnd)->encoding &&
309            (*foldBegin)->personality == (*foldEnd)->personality &&
310            (*foldBegin)->lsda == (*foldEnd)->lsda)
311       ;
312     *foldWrite++ = *foldBegin;
313     foldBegin = foldEnd;
314   }
315   cuPtrVector.erase(foldWrite, cuPtrVector.end());
316 
317   encodePersonalities(cuPtrVector, personalities);
318 
319   // Count frequencies of the folded encodings
320   EncodingMap encodingFrequencies;
321   for (const CompactUnwindEntry<Ptr> *cuPtrEntry : cuPtrVector)
322     encodingFrequencies[cuPtrEntry->encoding]++;
323 
324   // Make a vector of encodings, sorted by descending frequency
325   for (const auto &frequency : encodingFrequencies)
326     commonEncodings.emplace_back(frequency);
327   std::sort(commonEncodings.begin(), commonEncodings.end(),
328             [](const std::pair<compact_unwind_encoding_t, size_t> &a,
329                const std::pair<compact_unwind_encoding_t, size_t> &b) {
330               if (a.second == b.second)
331                 // When frequencies match, secondarily sort on encoding
332                 // to maintain parity with validate-unwind-info.py
333                 return a.first > b.first;
334               return a.second > b.second;
335             });
336 
337   // Truncate the vector to 127 elements.
338   // Common encoding indexes are limited to 0..126, while encoding
339   // indexes 127..255 are local to each second-level page
340   if (commonEncodings.size() > COMMON_ENCODINGS_MAX)
341     commonEncodings.resize(COMMON_ENCODINGS_MAX);
342 
343   // Create a map from encoding to common-encoding-table index
344   for (size_t i = 0; i < commonEncodings.size(); i++)
345     commonEncodingIndexes[commonEncodings[i].first] = i;
346 
347   // Split folded encodings into pages, where each page is limited by ...
348   // (a) 4 KiB capacity
349   // (b) 24-bit difference between first & final function address
350   // (c) 8-bit compact-encoding-table index,
351   //     for which 0..126 references the global common-encodings table,
352   //     and 127..255 references a local per-second-level-page table.
353   // First we try the compact format and determine how many entries fit.
354   // If more entries fit in the regular format, we use that.
355   for (size_t i = 0; i < cuPtrVector.size();) {
356     secondLevelPages.emplace_back();
357     SecondLevelPage &page = secondLevelPages.back();
358     page.entryIndex = i;
359     uintptr_t functionAddressMax =
360         cuPtrVector[i]->functionAddress + COMPRESSED_ENTRY_FUNC_OFFSET_MASK;
361     size_t n = commonEncodings.size();
362     size_t wordsRemaining =
363         SECOND_LEVEL_PAGE_WORDS -
364         sizeof(unwind_info_compressed_second_level_page_header) /
365             sizeof(uint32_t);
366     while (wordsRemaining >= 1 && i < cuPtrVector.size()) {
367       const CompactUnwindEntry<Ptr> *cuPtr = cuPtrVector[i];
368       if (cuPtr->functionAddress >= functionAddressMax) {
369         break;
370       } else if (commonEncodingIndexes.count(cuPtr->encoding) ||
371                  page.localEncodingIndexes.count(cuPtr->encoding)) {
372         i++;
373         wordsRemaining--;
374       } else if (wordsRemaining >= 2 && n < COMPACT_ENCODINGS_MAX) {
375         page.localEncodings.emplace_back(cuPtr->encoding);
376         page.localEncodingIndexes[cuPtr->encoding] = n++;
377         i++;
378         wordsRemaining -= 2;
379       } else {
380         break;
381       }
382     }
383     page.entryCount = i - page.entryIndex;
384 
385     // If this is not the final page, see if it's possible to fit more
386     // entries by using the regular format. This can happen when there
387     // are many unique encodings, and we we saturated the local
388     // encoding table early.
389     if (i < cuPtrVector.size() &&
390         page.entryCount < REGULAR_SECOND_LEVEL_ENTRIES_MAX) {
391       page.kind = UNWIND_SECOND_LEVEL_REGULAR;
392       page.entryCount = std::min(REGULAR_SECOND_LEVEL_ENTRIES_MAX,
393                                  cuPtrVector.size() - page.entryIndex);
394       i = page.entryIndex + page.entryCount;
395     } else {
396       page.kind = UNWIND_SECOND_LEVEL_COMPRESSED;
397     }
398   }
399 
400   for (const CompactUnwindEntry<Ptr> *cu : cuPtrVector) {
401     uint32_t functionOffset = cu->functionAddress - in.header->addr;
402     functionToLsdaIndex[functionOffset] = lsdaEntries.size();
403     if (cu->lsda != 0)
404       lsdaEntries.push_back(
405           {functionOffset, static_cast<uint32_t>(cu->lsda - in.header->addr)});
406   }
407 
408   // compute size of __TEXT,__unwind_info section
409   level2PagesOffset =
410       sizeof(unwind_info_section_header) +
411       commonEncodings.size() * sizeof(uint32_t) +
412       personalities.size() * sizeof(uint32_t) +
413       // The extra second-level-page entry is for the sentinel
414       (secondLevelPages.size() + 1) *
415           sizeof(unwind_info_section_header_index_entry) +
416       lsdaEntries.size() * sizeof(unwind_info_section_header_lsda_index_entry);
417   unwindInfoSize =
418       level2PagesOffset + secondLevelPages.size() * SECOND_LEVEL_PAGE_BYTES;
419 }
420 
421 // All inputs are relocated and output addresses are known, so write!
422 
423 template <class Ptr>
424 void UnwindInfoSectionImpl<Ptr>::writeTo(uint8_t *buf) const {
425   // section header
426   auto *uip = reinterpret_cast<unwind_info_section_header *>(buf);
427   uip->version = 1;
428   uip->commonEncodingsArraySectionOffset = sizeof(unwind_info_section_header);
429   uip->commonEncodingsArrayCount = commonEncodings.size();
430   uip->personalityArraySectionOffset =
431       uip->commonEncodingsArraySectionOffset +
432       (uip->commonEncodingsArrayCount * sizeof(uint32_t));
433   uip->personalityArrayCount = personalities.size();
434   uip->indexSectionOffset = uip->personalityArraySectionOffset +
435                             (uip->personalityArrayCount * sizeof(uint32_t));
436   uip->indexCount = secondLevelPages.size() + 1;
437 
438   // Common encodings
439   auto *i32p = reinterpret_cast<uint32_t *>(&uip[1]);
440   for (const auto &encoding : commonEncodings)
441     *i32p++ = encoding.first;
442 
443   // Personalities
444   for (const uint32_t &personality : personalities)
445     *i32p++ =
446         in.got->addr + (personality - 1) * target->wordSize - in.header->addr;
447 
448   // Level-1 index
449   uint32_t lsdaOffset =
450       uip->indexSectionOffset +
451       uip->indexCount * sizeof(unwind_info_section_header_index_entry);
452   uint64_t l2PagesOffset = level2PagesOffset;
453   auto *iep = reinterpret_cast<unwind_info_section_header_index_entry *>(i32p);
454   for (const SecondLevelPage &page : secondLevelPages) {
455     iep->functionOffset =
456         cuPtrVector[page.entryIndex]->functionAddress - in.header->addr;
457     iep->secondLevelPagesSectionOffset = l2PagesOffset;
458     iep->lsdaIndexArraySectionOffset =
459         lsdaOffset + functionToLsdaIndex.lookup(iep->functionOffset) *
460                          sizeof(unwind_info_section_header_lsda_index_entry);
461     iep++;
462     l2PagesOffset += SECOND_LEVEL_PAGE_BYTES;
463   }
464   // Level-1 sentinel
465   const CompactUnwindEntry<Ptr> &cuEnd = cuVector.back();
466   iep->functionOffset = cuEnd.functionAddress + cuEnd.functionLength;
467   iep->secondLevelPagesSectionOffset = 0;
468   iep->lsdaIndexArraySectionOffset =
469       lsdaOffset +
470       lsdaEntries.size() * sizeof(unwind_info_section_header_lsda_index_entry);
471   iep++;
472 
473   // LSDAs
474   size_t lsdaBytes =
475       lsdaEntries.size() * sizeof(unwind_info_section_header_lsda_index_entry);
476   if (lsdaBytes > 0)
477     memcpy(iep, lsdaEntries.data(), lsdaBytes);
478 
479   // Level-2 pages
480   auto *pp = reinterpret_cast<uint32_t *>(reinterpret_cast<uint8_t *>(iep) +
481                                           lsdaBytes);
482   for (const SecondLevelPage &page : secondLevelPages) {
483     if (page.kind == UNWIND_SECOND_LEVEL_COMPRESSED) {
484       uintptr_t functionAddressBase =
485           cuPtrVector[page.entryIndex]->functionAddress;
486       auto *p2p =
487           reinterpret_cast<unwind_info_compressed_second_level_page_header *>(
488               pp);
489       p2p->kind = page.kind;
490       p2p->entryPageOffset =
491           sizeof(unwind_info_compressed_second_level_page_header);
492       p2p->entryCount = page.entryCount;
493       p2p->encodingsPageOffset =
494           p2p->entryPageOffset + p2p->entryCount * sizeof(uint32_t);
495       p2p->encodingsCount = page.localEncodings.size();
496       auto *ep = reinterpret_cast<uint32_t *>(&p2p[1]);
497       for (size_t i = 0; i < page.entryCount; i++) {
498         const CompactUnwindEntry<Ptr> *cuep = cuPtrVector[page.entryIndex + i];
499         auto it = commonEncodingIndexes.find(cuep->encoding);
500         if (it == commonEncodingIndexes.end())
501           it = page.localEncodingIndexes.find(cuep->encoding);
502         *ep++ = (it->second << COMPRESSED_ENTRY_FUNC_OFFSET_BITS) |
503                 (cuep->functionAddress - functionAddressBase);
504       }
505       if (page.localEncodings.size() != 0)
506         memcpy(ep, page.localEncodings.data(),
507                page.localEncodings.size() * sizeof(uint32_t));
508     } else {
509       auto *p2p =
510           reinterpret_cast<unwind_info_regular_second_level_page_header *>(pp);
511       p2p->kind = page.kind;
512       p2p->entryPageOffset =
513           sizeof(unwind_info_regular_second_level_page_header);
514       p2p->entryCount = page.entryCount;
515       auto *ep = reinterpret_cast<uint32_t *>(&p2p[1]);
516       for (size_t i = 0; i < page.entryCount; i++) {
517         const CompactUnwindEntry<Ptr> *cuep = cuPtrVector[page.entryIndex + i];
518         *ep++ = cuep->functionAddress;
519         *ep++ = cuep->encoding;
520       }
521     }
522     pp += SECOND_LEVEL_PAGE_WORDS;
523   }
524 }
525 
526 UnwindInfoSection *macho::makeUnwindInfoSection() {
527   if (target->wordSize == 8)
528     return make<UnwindInfoSectionImpl<uint64_t>>();
529   else
530     return make<UnwindInfoSectionImpl<uint32_t>>();
531 }
532