[PATCH] [lld] [mach-o] implement minimal __unwind_info support

Tim Northover t.p.northover at gmail.com
Wed Sep 10 02:56:51 PDT 2014


Hi Nick,

Thanks for the comments. The writeN one makes me sad, it's a fairly clunky interface, but they all seem sensible. I'll work on an updated patch.

Cheers.

Tim.

================
Comment at: lib/ReaderWriter/MachO/CompactUnwindPass.cpp:229-234
@@ +228,8 @@
+  mach_o::ArchHandler &_archHandler;
+  std::vector<uint8_t> contents;
+  uint32_t commonEncodingsOffset;
+  uint32_t personalityArrayOffset;
+  uint32_t topLevelIndexOffset;
+  uint32_t lsdaIndexOffset;
+  uint32_t firstPageOffset;
+};
----------------
kledzik wrote:
> These ivars need a leading underscore.
That's a really dodgy convention, by the way. As soon as you want a member that starts with a capital (say from an acronym or proper name) you get undefined behaviour. There are already multiple instances of this in the lld source.

But it makes no sense to change it piecemeal, I meant to go back and do that actually, but forgot.

================
Comment at: lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp:452
@@ -447,3 +451,3 @@
                                                                uint64_t &addr) {
-  seg->address = addr;
+  seg->address = _imageBase = addr;
   // Walks sections starting at end to calculate padding for start.
----------------
kledzik wrote:
> _imageBase should be initialized in the constructor from a new method MachOLinkingContext::baseAddress().
> 
> Then in assignAddressesToSections(), the FIXME for the initial value for "address" can be changed to be _imageBase.
Certainly, but I think that's a completely separate issue to __unwind_info (it's basically implementing "-image_base"). I'll do that today; I should be able to get a commit in before this one lands and make use of the infrastructure.

http://reviews.llvm.org/D5261






More information about the llvm-commits mailing list