[libcxx-commits] [PATCH] D86805: [lld-macho] create __TEXT, __unwind_info from __LD, __compact_unwind
Jez Ng via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 1 20:24:23 PDT 2020
int3 added inline comments.
================
Comment at: lld/MachO/UnwindInfo.h:51-66
+ mutable std::map<uint32_t, size_t> commonEncodingIndexes;
+ mutable std::vector<std::pair<compact_unwind_encoding_t, size_t>>
+ commonEncodings;
+ mutable std::vector<uint32_t> personalities;
+ mutable std::vector<unwind_info_section_header_lsda_entry> lsdaEntries;
+ mutable std::vector<compact_unwind_entry> cuVector;
+ mutable std::vector<compact_unwind_entry *> cuPtrVector;
----------------
int3 wrote:
> gkm wrote:
> > int3 wrote:
> > > why the need to mark everything as mutable?
> > The work of morphing `__LD,__compact_unwind` into `__TEXT,__unwind_info` happens in `uint64_t getSize() const` and `void writeTo(uint8_t *buf) const`, which can only be logically `const`, but not physically.
> I would much prefer if we could have a method that explicitly computes the unwind info... but first let me see if I understand the constraints here.
>
> From what I understand, the size of the unwind info depends on the values of `CompactUnwindEntry64::functionAddress`, or more precisely, their relative offsets. So we need to assign addresses to our functions before computing the unwind info size. After addresses are assigned, the `cuSection->writeTo()` call below will update the `functionAddress` entries to point to the final addresses, after which we can compute the needed size. Does all that sound right?
>
> From what I can tell, ld64 calculates unwind info size based on "tentative addresses", which I think have the right relative offsets, though their final values have yet to be fixed. I wonder if we could do something similar with our current design...
Also -- do you know if it's possible for unwind info to point to functions that reside in sections other than `__text`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86805/new/
https://reviews.llvm.org/D86805
More information about the libcxx-commits
mailing list