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