<div dir="ltr">Hi Mike,<div><br></div><div>Looks like the UBSan issue was due to a missing storage specifier on the MachO::NListType enum. I've fixed that in r277251, and the lld tests appear to be UB clean now.</div><div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 1:55 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Mike,<div><br></div><div>The warning you attached is due to a missing constructor call that was added back in r276935. If you're still seeing it please let me know - I'll need to do further investigation.</div><div><br></div><div>The warning at <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/12551/steps/check-lld%20asan/logs/stdio" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/12551/steps/check-lld%20asan/logs/stdio</a> is for memory leaks from BumpPtr-allocated std::strings. I've fixed these in r277208.</div><div><br></div><div>The warning at <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/12551/steps/check-lld%20ubsan/logs/stdio" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/12551/steps/check-lld%20ubsan/logs/stdio</a> has me confused though: That's an OR of two enums of different underlying types, where the resulting value is representable in both types but doesn't correspond to a value in either. I'm surprised that this doesn't come up elsewhere in LLVM. Is there a canonical way to deal with this? Should I cast one or the other (or both) to the desired result type?</div><div><br></div><div>Cheers,</div><div>Lang.</div><div> </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 11:44 AM, Mike Aizatsky <span dir="ltr"><<a href="mailto:aizatsky@google.com" target="_blank">aizatsky@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, I'm sorry I was writing lots of "build broken" emails this morning and my copypaste-fu has failed me.<div>Yours should be this. Does it look familiar?</div><div><br></div><div><pre style="font-family:"courier new",courier,monotype,monospace;font-size:medium;line-height:normal"><span>warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version
==9741==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xaadc40 in clear /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/libcxx_build_msan/include/c++/v1/string:2695:9
    #1 0xaadc40 in __move_assign /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/libcxx_build_msan/include/c++/v1/string:1978
    #2 0xaadc40 in operator= /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/libcxx_build_msan/include/c++/v1/string:1991
    #3 0xaadc40 in lld::mach_o::(anonymous namespace)::copyDebugString(llvm::StringRef, llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp:706
    #4 0xa7ab76 in lld::mach_o::(anonymous namespace)::parseDebugInfo(lld::mach_o::MachOFile&, lld::mach_o::normalized::NormalizedFile const&, bool) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp:974:23
    #5 0xa6e20a in lld::mach_o::normalized::normalizedObjectToAtoms(lld::mach_o::MachOFile*, lld::mach_o::normalized::NormalizedFile const&, bool) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp:1550:18
    #6 0xa8192f in objectToAtoms /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp:1401:17
    #7 0xa8192f in lld::mach_o::normalized::normalizedToAtoms(lld::mach_o::normalized::NormalizedFile const&, llvm::StringRef, bool) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp:1623
    #8 0xab2823 in lld::mach_o::MachOYamlIOTaggedDocumentHandler::handledDocTag(llvm::yaml::IO&, lld::File const*&) const /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp:771:22
    #9 0xbd8978 in lld::Registry::handleTaggedDoc(llvm::yaml::IO&, lld::File const*&) const /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/Core/Reader.cpp:61:12
    #10 0xba6ae1 in mapping /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp:693:45
    #11 0xba6ae1 in std::__1::enable_if<unvalidatedMappingTraits<lld::File const*>::value, void>::type llvm::yaml::yamlize<lld::File const*>(llvm::yaml::IO&, lld::File const*&, bool) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/YAMLTraits.h:729
    #12 0xba6912 in std::__1::enable_if<has_DocumentListTraits<std::__1::vector<lld::File const*, std::__1::allocator<lld::File const*> > >::value, llvm::yaml::Input&>::type llvm::yaml::operator>><std::__1::vector<lld::File const*, std::__1::allocator<lld::File const*> > >(llvm::yaml::Input&, std::__1::vector<lld::File const*, std::__1::allocator<lld::File const*> >&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/YAMLTraits.h:1245:5
    #13 0xba62ad in lld::(anonymous namespace)::YAMLReader::loadFile(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, lld::Registry const&) const /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp:1365:9
    #14 0xbd85b7 in lld::Registry::loadFile(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >) const /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/Core/Reader.cpp:41:20
    #15 0x560c1e in loadFile /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/Driver/DarwinLdDriver.cpp:100:22
    #16 0x560c1e in addFile(llvm::StringRef, lld::MachOLinkingContext&, bool, bool, llvm::raw_ostream&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/Driver/DarwinLdDriver.cpp:138
    #17 0x55965c in lld::mach_o::parse(llvm::ArrayRef<char const*>, lld::MachOLinkingContext&, llvm::raw_ostream&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/Driver/DarwinLdDriver.cpp:1065:7
    #18 0x562682 in lld::mach_o::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/lib/Driver/DarwinLdDriver.cpp:1143:8
    #19 0x549085 in main /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/lld/tools/lld/lld.cpp:110:13
    #20 0x7f378ccb1f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #21 0x4c54f6 in _start (/mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm_build_msan/bin/lld+0x4c54f6)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/libcxx_build_msan/include/c++/v1/string:2695:9 in clear
Exiting

--
</span></pre><br></div><div><br></div><div>  </div></div><div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 29, 2016 at 11:41 AM Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Mike,<div><br></div><div>Thanks for the heads up - I see an LLD failure in there that I'm investigating. The backtrace you've attached in your email looks like it's for something else though - should someone else be investigating that?</div></div><div dir="ltr"><div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 11:32 AM, Mike Aizatsky <span dir="ltr"><<a href="mailto:aizatsky@google.com" target="_blank">aizatsky@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Lang,<div><br></div><div>Some builds still fail because of this change:</div><div><br></div><div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/12551" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/12551</a><br></div><div><br></div><div><pre style="font-family:"courier new",courier,monotype,monospace;font-size:medium;line-height:normal"><span>--
==18233==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x73291d7 in clang::Parser::ParseOptionalCXX11VirtSpecifierSeq(clang::VirtSpecifiers&, bool, clang::SourceLocation) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2050:9
    #1 0x73296ce in clang::Parser::ParseCXXMemberDeclaratorBeforeInitializer(clang::Declarator&, clang::VirtSpecifiers&, clang::ActionResult<clang::Expr*, true>&, clang::Parser::LateParsedAttrList&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2119:5
    #2 0x732ec48 in clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2475:7
    #3 0x7335dba in clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType, clang::Decl*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2943:10
    #4 0x732401f in clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) /</span><span>mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:3113:7
</span><span>    #5 0x731ded6 in clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:1775:7
    #6 0x72be36b in clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:3413:7
    #7 0x7461aa3 in clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseTemplate.cpp:207:3
    #8 0x74604bb in clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseTemplate.cpp:152:10
    #9 0x745ef0a in clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseTemplate.cpp:38:10
    #10 0x72bb7a0 in clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:1492:18
    #11 0x7275301 in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/Parser.cpp:749:14
    #12 0x730a217 in clang::Parser::ParseInnerNamespace(std::__1::vector<clang::SourceLocation, std::__1::allocator<clang::SourceLocation> >&, std::__1::vector<clang::IdentifierInfo*, std::__1::allocator<clang::IdentifierInfo*> >&, std::__1::vector<clang::SourceLocation, std::__1::allocator<clang::SourceLocation> >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:221:7
    #13 0x7308ba8 in clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:195:3
    #14 0x72bba08 in clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:1505:12
    #15 0x7275301 in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/Parser.cpp:749:14
    #16 0x72749ed in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/Parser.cpp:594:12
    #17 0x7266802 in clang::ParseAST(clang::Sema&, bool, bool) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseAST.cpp:160:17
    #18 0x59bf627 in clang::FrontendAction::Execute() /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:458:8
    #19 0x591779b in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:868:11
    #20 0x5bd7950 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:241:25
    #21 0x8a20b5 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/cc1_main.cpp:116:13
    #22 0x89ce3a in ExecuteCC1Tool /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/driver.cpp:299:12
    #23 0x89ce3a in main /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/driver.cpp:380
    #24 0x7fa3f6ad2f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #25 0x80db4d in _start (/mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm_build_msan/bin/clang-4.0+0x80db4d)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /mnt/b/sanitizer-buildbot2/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2050:9 in clang::Parser::ParseOptionalCXX11VirtSpecifierSeq(clang::VirtSpecifiers&, bool, clang::SourceLocation)
Exiting
</span></pre><br></div></div><div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 28, 2016 at 2:45 PM Galina Kistanova via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 2:03 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Galina,<div><br></div><div>These issues should have been fixed by r276935 and r<span style="font-size:12.800000190734863px">276999, and Rafael's change in r</span><span style="font-size:12.800000190734863px">277022</span><span style="font-size:12.800000190734863px">.</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">Cheers,</span></div><div><span style="font-size:12.800000190734863px">Lang.</span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 11:02 AM, Galina Kistanova <span dir="ltr"><<a href="mailto:gkistanova@gmail.com" target="_blank">gkistanova@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello Lang,<br><br></div>This revision broke at least two builders:<br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/9027" target="_blank">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/9027</a><br><a href="http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/37314" target="_blank">http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/37314</a><br><br></div>Please have a look at this?<br><br></div>Thanks<span><font color="#888888"><br><br></font></span></div><span><font color="#888888">Galina <br></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 27, 2016 at 2:31 PM, Lang Hames via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: lhames<br>
Date: Wed Jul 27 16:31:25 2016<br>
New Revision: 276921<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=276921&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=276921&view=rev</a><br>
Log:<br>
[lld][MachO] Add debug info support for MachO.<br>
<br>
This patch causes LLD to build stabs debugging symbols for files containing<br>
DWARF debug info, and to propagate existing stabs symbols for object files<br>
built using '-r' mode. This enables debugging of binaries generated by LLD<br>
from MachO objects.<br>
<br>
<br>
Added:<br>
    lld/trunk/lib/ReaderWriter/MachO/DebugInfo.h<br>
    lld/trunk/test/mach-o/debug-syms.yaml<br>
Modified:<br>
    lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp<br>
    lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt<br>
    lld/trunk/lib/ReaderWriter/MachO/File.h<br>
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h<br>
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp<br>
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp<br>
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp<br>
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp Wed Jul 27 16:31:25 2016<br>
@@ -463,7 +463,10 @@ ArchHandler_x86_64::getPairReferenceInfo<br>
       return ec;<br>
     uint64_t encodedAddend = (int64_t)*(const little64_t *)fixupContent;<br>
     if (inAtom == fromTarget) {<br>
-      *kind = delta64;<br>
+      if (inAtom->contentType() == DefinedAtom::typeCFI)<br>
+        *kind = unwindFDEToFunction;<br>
+      else<br>
+        *kind = delta64;<br>
       *addend = encodedAddend + offsetInAtom;<br>
     } else if (inAtom == *target) {<br>
       *kind = negDelta64;<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt Wed Jul 27 16:31:25 2016<br>
@@ -21,6 +21,7 @@ add_lld_library(lldMachO<br>
   LINK_LIBS<br>
     lldCore<br>
     lldYAML<br>
+    LLVMDebugInfoDWARF<br>
     LLVMObject<br>
     LLVMSupport<br>
     ${PTHREAD_LIB}<br>
<br>
Added: lld/trunk/lib/ReaderWriter/MachO/DebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/DebugInfo.h?rev=276921&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/DebugInfo.h?rev=276921&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/DebugInfo.h (added)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/DebugInfo.h Wed Jul 27 16:31:25 2016<br>
@@ -0,0 +1,310 @@<br>
+//===- lib/ReaderWriter/MachO/File.h ----------------------------*- C++ -*-===//<br>
+//<br>
+//                             The LLVM Linker<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+#define LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+<br>
+#include "lld/Core/Atom.h"<br>
+#include <vector><br>
+<br>
+#include "llvm/Support/Format.h"<br>
+#include "llvm/Support/raw_ostream.h"<br>
+<br>
+<br>
+namespace lld {<br>
+namespace mach_o {<br>
+<br>
+class DebugInfo {<br>
+public:<br>
+  enum class Kind {<br>
+    Dwarf,<br>
+    Stabs<br>
+  };<br>
+<br>
+  Kind kind() const { return _kind; }<br>
+<br>
+  void setAllocator(std::unique_ptr<llvm::BumpPtrAllocator> allocator) {<br>
+    _allocator = std::move(allocator);<br>
+  }<br>
+<br>
+protected:<br>
+  DebugInfo(Kind kind) : _kind(kind) {}<br>
+<br>
+private:<br>
+  std::unique_ptr<llvm::BumpPtrAllocator> _allocator;<br>
+  Kind _kind;<br>
+};<br>
+<br>
+struct TranslationUnitSource {<br>
+  StringRef name;<br>
+  StringRef path;<br>
+};<br>
+<br>
+class DwarfDebugInfo : public DebugInfo {<br>
+public:<br>
+  DwarfDebugInfo(TranslationUnitSource tu)<br>
+    : DebugInfo(Kind::Dwarf), _tu(std::move(tu)) {}<br>
+<br>
+  static inline bool classof(const DebugInfo *di) {<br>
+    return di->kind() == Kind::Dwarf;<br>
+  }<br>
+<br>
+  const TranslationUnitSource &translationUnitSource() const { return _tu; }<br>
+<br>
+private:<br>
+  TranslationUnitSource _tu;<br>
+};<br>
+<br>
+struct Stab {<br>
+  Stab(const Atom* atom, uint8_t type, uint8_t other, uint16_t desc,<br>
+       uint32_t value, StringRef str)<br>
+    : atom(atom), type(type), other(other), desc(desc), value(value),<br>
+      str(str) {}<br>
+<br>
+  const class Atom*   atom;<br>
+  uint8_t             type;<br>
+  uint8_t             other;<br>
+  uint16_t            desc;<br>
+  uint32_t            value;<br>
+  StringRef           str;<br>
+};<br>
+<br>
+inline raw_ostream& operator<<(raw_ostream &os, Stab &s) {<br>
+  os << "Stab -- atom: " << llvm::format("%p", s.atom) << ", type: " << (uint32_t)s.type<br>
+     << ", other: " << (uint32_t)s.other << ", desc: " << s.desc << ", value: " << s.value<br>
+     << ", str: '" << s.str << "'";<br>
+  return os;<br>
+}<br>
+<br>
+class StabsDebugInfo : public DebugInfo {<br>
+public:<br>
+<br>
+  typedef std::vector<Stab> StabsList;<br>
+<br>
+  StabsDebugInfo(StabsList stabs)<br>
+    : DebugInfo(Kind::Stabs), _stabs(std::move(stabs)) {}<br>
+<br>
+  static inline bool classof(const DebugInfo *di) {<br>
+    return di->kind() == Kind::Stabs;<br>
+  }<br>
+<br>
+  const StabsList& stabs() const { return _stabs; }<br>
+<br>
+public:<br>
+  StabsList _stabs;<br>
+};<br>
+<br>
+} // end namespace mach_o<br>
+} // end namespace lld<br>
+<br>
+#endif // LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+//===- lib/ReaderWriter/MachO/File.h ----------------------------*- C++ -*-===//<br>
+//<br>
+//                             The LLVM Linker<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+#define LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+<br>
+#include "lld/Core/Atom.h"<br>
+#include <vector><br>
+<br>
+#include "llvm/Support/Format.h"<br>
+#include "llvm/Support/raw_ostream.h"<br>
+<br>
+<br>
+namespace lld {<br>
+namespace mach_o {<br>
+<br>
+class DebugInfo {<br>
+public:<br>
+  enum class Kind {<br>
+    Dwarf,<br>
+    Stabs<br>
+  };<br>
+<br>
+  Kind kind() const { return _kind; }<br>
+<br>
+protected:<br>
+  DebugInfo(Kind kind) : _kind(kind) {}<br>
+<br>
+private:<br>
+  Kind _kind;<br>
+};<br>
+<br>
+<br>
+struct TranslationUnitSource {<br>
+  StringRef name;<br>
+  StringRef path;<br>
+};<br>
+<br>
+class DwarfDebugInfo : public DebugInfo {<br>
+public:<br>
+  DwarfDebugInfo(TranslationUnitSource tu)<br>
+    : DebugInfo(Kind::Dwarf), _tu(std::move(tu)) {}<br>
+<br>
+  static inline bool classof(const DebugInfo *di) {<br>
+    return di->kind() == Kind::Dwarf;<br>
+  }<br>
+<br>
+  const TranslationUnitSource &translationUnitSource() const { return _tu; }<br>
+<br>
+private:<br>
+  TranslationUnitSource _tu;<br>
+};<br>
+<br>
+struct Stab {<br>
+  Stab(const Atom* atom, uint8_t type, uint8_t other, uint16_t desc,<br>
+       uint32_t value, StringRef str)<br>
+    : atom(atom), type(type), other(other), desc(desc), value(value),<br>
+      str(str) {}<br>
+<br>
+  const class Atom*   atom;<br>
+  uint8_t             type;<br>
+  uint8_t             other;<br>
+  uint16_t            desc;<br>
+  uint32_t            value;<br>
+  StringRef           str;<br>
+};<br>
+<br>
+inline raw_ostream& operator<<(raw_ostream &os, Stab &s) {<br>
+  os << "Stab -- atom: " << llvm::format("%p", s.atom) << ", type: " << (uint32_t)s.type<br>
+     << ", other: " << (uint32_t)s.other << ", desc: " << s.desc << ", value: " << s.value<br>
+     << ", str: '" << s.str << "'";<br>
+  return os;<br>
+}<br>
+<br>
+class StabsDebugInfo : public DebugInfo {<br>
+public:<br>
+<br>
+  typedef std::vector<Stab> StabsList;<br>
+<br>
+  StabsDebugInfo(StabsList stabs)<br>
+    : DebugInfo(Kind::Stabs), _stabs(std::move(stabs)) {}<br>
+<br>
+  static inline bool classof(const DebugInfo *di) {<br>
+    return di->kind() == Kind::Stabs;<br>
+  }<br>
+<br>
+  const StabsList& stabs() const { return _stabs; }<br>
+<br>
+public:<br>
+  StabsList _stabs;<br>
+};<br>
+<br>
+} // end namespace mach_o<br>
+} // end namespace lld<br>
+<br>
+#endif // LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+//===- lib/ReaderWriter/MachO/File.h ----------------------------*- C++ -*-===//<br>
+//<br>
+//                             The LLVM Linker<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+#define LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
+<br>
+#include "lld/Core/Atom.h"<br>
+#include <vector><br>
+<br>
+#include "llvm/Support/Format.h"<br>
+#include "llvm/Support/raw_ostream.h"<br>
+<br>
+<br>
+namespace lld {<br>
+namespace mach_o {<br>
+<br>
+class DebugInfo {<br>
+public:<br>
+  enum class Kind {<br>
+    Dwarf,<br>
+    Stabs<br>
+  };<br>
+<br>
+  Kind kind() const { return _kind; }<br>
+<br>
+protected:<br>
+  DebugInfo(Kind kind) : _kind(kind) {}<br>
+<br>
+private:<br>
+  Kind _kind;<br>
+};<br>
+<br>
+<br>
+struct TranslationUnitSource {<br>
+  StringRef name;<br>
+  StringRef path;<br>
+};<br>
+<br>
+class DwarfDebugInfo : public DebugInfo {<br>
+public:<br>
+  DwarfDebugInfo(TranslationUnitSource tu)<br>
+    : DebugInfo(Kind::Dwarf), _tu(std::move(tu)) {}<br>
+<br>
+  static inline bool classof(const DebugInfo *di) {<br>
+    return di->kind() == Kind::Dwarf;<br>
+  }<br>
+<br>
+  const TranslationUnitSource &translationUnitSource() const { return _tu; }<br>
+<br>
+private:<br>
+  TranslationUnitSource _tu;<br>
+};<br>
+<br>
+struct Stab {<br>
+  Stab(const Atom* atom, uint8_t type, uint8_t other, uint16_t desc,<br>
+       uint32_t value, StringRef str)<br>
+    : atom(atom), type(type), other(other), desc(desc), value(value),<br>
+      str(str) {}<br>
+<br>
+  const class Atom*   atom;<br>
+  uint8_t             type;<br>
+  uint8_t             other;<br>
+  uint16_t            desc;<br>
+  uint32_t            value;<br>
+  StringRef           str;<br>
+};<br>
+<br>
+inline raw_ostream& operator<<(raw_ostream &os, Stab &s) {<br>
+  os << "Stab -- atom: " << llvm::format("%p", s.atom) << ", type: " << (uint32_t)s.type<br>
+     << ", other: " << (uint32_t)s.other << ", desc: " << s.desc << ", value: " << s.value<br>
+     << ", str: '" << s.str << "'";<br>
+  return os;<br>
+}<br>
+<br>
+class StabsDebugInfo : public DebugInfo {<br>
+public:<br>
+<br>
+  typedef std::vector<Stab> StabsList;<br>
+<br>
+  StabsDebugInfo(StabsList stabs)<br>
+    : DebugInfo(Kind::Stabs), _stabs(std::move(stabs)) {}<br>
+<br>
+  static inline bool classof(const DebugInfo *di) {<br>
+    return di->kind() == Kind::Stabs;<br>
+  }<br>
+<br>
+  const StabsList& stabs() const { return _stabs; }<br>
+<br>
+public:<br>
+  StabsList _stabs;<br>
+};<br>
+<br>
+} // end namespace mach_o<br>
+} // end namespace lld<br>
+<br>
+#endif // LLD_READER_WRITER_MACHO_DEBUGINFO_H<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/File.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/File.h?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/File.h?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/File.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/File.h Wed Jul 27 16:31:25 2016<br>
@@ -11,11 +11,13 @@<br>
 #define LLD_READER_WRITER_MACHO_FILE_H<br>
<br>
 #include "Atoms.h"<br>
+#include "DebugInfo.h"<br>
 #include "MachONormalizedFile.h"<br>
 #include "lld/Core/SharedLibraryFile.h"<br>
 #include "lld/Core/Simple.h"<br>
 #include "llvm/ADT/DenseMap.h"<br>
 #include "llvm/ADT/StringMap.h"<br>
+#include "llvm/Support/Format.h"<br>
 #include <unordered_map><br>
<br>
 namespace lld {<br>
@@ -25,11 +27,15 @@ using lld::mach_o::normalized::Section;<br>
<br>
 class MachOFile : public SimpleFile {<br>
 public:<br>
+<br>
+  /// Real file constructor - for on-disk files.<br>
   MachOFile(std::unique_ptr<MemoryBuffer> mb, MachOLinkingContext *ctx)<br>
     : SimpleFile(mb->getBufferIdentifier(), File::kindMachObject),<br>
       _mb(std::move(mb)), _ctx(ctx) {}<br>
<br>
-  MachOFile(StringRef path) : SimpleFile(path, File::kindMachObject) {}<br>
+  /// Dummy file constructor - for virtual files.<br>
+  MachOFile(StringRef path)<br>
+    : SimpleFile(path, File::kindMachObject) {}<br>
<br>
   void addDefinedAtom(StringRef name, Atom::Scope scope,<br>
                       DefinedAtom::ContentType type, DefinedAtom::Merge merge,<br>
@@ -225,6 +231,13 @@ public:<br>
     return F->kind() == File::kindMachObject;<br>
   }<br>
<br>
+  void setDebugInfo(std::unique_ptr<DebugInfo> debugInfo) {<br>
+    _debugInfo = std::move(debugInfo);<br>
+  }<br>
+<br>
+  DebugInfo* debugInfo() const { return _debugInfo.get(); }<br>
+  std::unique_ptr<DebugInfo> takeDebugInfo() { return std::move(_debugInfo); }<br>
+<br>
 protected:<br>
   std::error_code doParse() override {<br>
     // Convert binary file to normalized mach-o.<br>
@@ -265,6 +278,7 @@ private:<br>
       MachOLinkingContext::objc_unknown;<br>
   uint32_t                       _swiftVersion = 0;<br>
   normalized::FileFlags        _flags = llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS;<br>
+  std::unique_ptr<DebugInfo>   _debugInfo;<br>
 };<br>
<br>
 class MachODylibFile : public SharedLibraryFile {<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h Wed Jul 27 16:31:25 2016<br>
@@ -42,6 +42,7 @@<br>
 #ifndef LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H<br>
 #define LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H<br>
<br>
+#include "DebugInfo.h"<br>
 #include "lld/Core/Error.h"<br>
 #include "lld/Core/LLVM.h"<br>
 #include "lld/ReaderWriter/MachOLinkingContext.h"<br>
@@ -91,8 +92,22 @@ struct Relocation {<br>
   bool                isExtern;<br>
   Hex32               value;<br>
   uint32_t            symbol;<br>
+<br>
+#ifndef NDEBUG<br>
+  raw_ostream& operator<<(raw_ostream &OS) const {<br>
+    dump(OS);<br>
+    return OS;<br>
+  }<br>
+<br>
+  void dump(raw_ostream &OS = llvm::dbgs()) const;<br>
+#endif<br>
 };<br>
<br>
+inline raw_ostream& operator<<(raw_ostream &OS, const Relocation &R) {<br>
+  R.dump(OS);<br>
+  return OS;<br>
+}<br>
+<br>
 /// A typedef so that YAML I/O can treat this vector as a sequence.<br>
 typedef std::vector<Relocation> Relocations;<br>
<br>
@@ -226,7 +241,6 @@ struct DataInCode {<br>
   DataRegionType  kind;<br>
 };<br>
<br>
-<br>
 /// A typedef so that YAML I/O can encode/decode mach_header.flags.<br>
 LLVM_YAML_STRONG_TYPEDEF(uint32_t, FileFlags)<br>
<br>
@@ -242,6 +256,7 @@ struct NormalizedFile {<br>
   std::vector<Symbol>         localSymbols;<br>
   std::vector<Symbol>         globalSymbols;<br>
   std::vector<Symbol>         undefinedSymbols;<br>
+  std::vector<Symbol>         stabsSymbols;<br>
<br>
   // Maps to load commands with no LINKEDIT content (final linked images only).<br>
   std::vector<DependentDylib> dependentDylibs;<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp Wed Jul 27 16:31:25 2016<br>
@@ -390,12 +390,14 @@ readBinary(std::unique_ptr<MemoryBuffer><br>
           if (sin->n_strx > strSize)<br>
             return true;<br>
           <a href="http://sout.name" rel="noreferrer" target="_blank">sout.name</a>  = &strings[sin->n_strx];<br>
-          sout.type  = (NListType)(sin->n_type & N_TYPE);<br>
+          sout.type = static_cast<NListType>(sin->n_type & (N_STAB|N_TYPE));<br>
           sout.scope = (sin->n_type & (N_PEXT|N_EXT));<br>
           sout.sect  = sin->n_sect;<br>
           sout.desc  = sin->n_desc;<br>
           sout.value = sin->n_value;<br>
-          if (sout.type == N_UNDF)<br>
+          if (sin->n_type & N_STAB)<br>
+            f->stabsSymbols.push_back(sout);<br>
+          else if (sout.type == N_UNDF)<br>
             f->undefinedSymbols.push_back(sout);<br>
           else if (sin->n_type & N_EXT)<br>
             f->globalSymbols.push_back(sout);<br>
@@ -429,6 +431,8 @@ readBinary(std::unique_ptr<MemoryBuffer><br>
             f->undefinedSymbols.push_back(sout);<br>
           else if (sout.scope == (SymbolScope)N_EXT)<br>
             f->globalSymbols.push_back(sout);<br>
+          else if (sin->n_type & N_STAB)<br>
+            f->stabsSymbols.push_back(sout);<br>
           else<br>
             f->localSymbols.push_back(sout);<br>
         }<br>
@@ -535,7 +539,7 @@ public:<br>
   loadFile(std::unique_ptr<MemoryBuffer> mb,<br>
            const Registry &registry) const override {<br>
     std::unique_ptr<File> ret =<br>
-        llvm::make_unique<MachOFile>(std::move(mb), &_ctx);<br>
+      llvm::make_unique<MachOFile>(std::move(mb), &_ctx);<br>
     return std::move(ret);<br>
   }<br>
<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp Wed Jul 27 16:31:25 2016<br>
@@ -789,8 +789,8 @@ llvm::Error MachOFileLayout::writeLoadCo<br>
     st->cmd     = LC_SYMTAB;<br>
     st->cmdsize = sizeof(symtab_command);<br>
     st->symoff  = _startOfSymbols;<br>
-    st->nsyms   = _file.localSymbols.size() + _file.globalSymbols.size()<br>
-                                            + _file.undefinedSymbols.size();<br>
+    st->nsyms   = _file.stabsSymbols.size() + _file.localSymbols.size() +<br>
+                  _file.globalSymbols.size() + _file.undefinedSymbols.size();<br>
     st->stroff  = _startOfSymbolStrings;<br>
     st->strsize = _endOfSymbolStrings - _startOfSymbolStrings;<br>
     if (_swap)<br>
@@ -876,8 +876,8 @@ llvm::Error MachOFileLayout::writeLoadCo<br>
     st->cmd     = LC_SYMTAB;<br>
     st->cmdsize = sizeof(symtab_command);<br>
     st->symoff  = _startOfSymbols;<br>
-    st->nsyms   = _file.localSymbols.size() + _file.globalSymbols.size()<br>
-                                            + _file.undefinedSymbols.size();<br>
+    st->nsyms   = _file.stabsSymbols.size() + _file.localSymbols.size() +<br>
+                  _file.globalSymbols.size() + _file.undefinedSymbols.size();<br>
     st->stroff  = _startOfSymbolStrings;<br>
     st->strsize = _endOfSymbolStrings - _startOfSymbolStrings;<br>
     if (_swap)<br>
@@ -890,7 +890,8 @@ llvm::Error MachOFileLayout::writeLoadCo<br>
       dst->cmd            = LC_DYSYMTAB;<br>
       dst->cmdsize        = sizeof(dysymtab_command);<br>
       dst->ilocalsym      = _symbolTableLocalsStartIndex;<br>
-      dst->nlocalsym      = _file.localSymbols.size();<br>
+      dst->nlocalsym      = _file.stabsSymbols.size() +<br>
+                            _file.localSymbols.size();<br>
       dst->iextdefsym     = _symbolTableGlobalsStartIndex;<br>
       dst->nextdefsym     = _file.globalSymbols.size();<br>
       dst->iundefsym      = _symbolTableUndefinesStartIndex;<br>
@@ -1102,6 +1103,7 @@ void MachOFileLayout::writeSymbolTable()<br>
   uint32_t symOffset = _startOfSymbols;<br>
   uint32_t strOffset = _startOfSymbolStrings;<br>
   _buffer[strOffset++] = '\0'; // Reserve n_strx offset of zero to mean no name.<br>
+  appendSymbols(_file.stabsSymbols, symOffset, strOffset);<br>
   appendSymbols(_file.localSymbols, symOffset, strOffset);<br>
   appendSymbols(_file.globalSymbols, symOffset, strOffset);<br>
   appendSymbols(_file.undefinedSymbols, symOffset, strOffset);<br>
@@ -1414,10 +1416,14 @@ void MachOFileLayout::buildExportTrie()<br>
 void MachOFileLayout::computeSymbolTableSizes() {<br>
   // MachO symbol tables have three ranges: locals, globals, and undefines<br>
   const size_t nlistSize = (_is64 ? sizeof(nlist_64) : sizeof(nlist));<br>
-  _symbolTableSize = nlistSize * (_file.localSymbols.size()<br>
+  _symbolTableSize = nlistSize * (_file.stabsSymbols.size()<br>
+                                + _file.localSymbols.size()<br>
                                 + _file.globalSymbols.size()<br>
                                 + _file.undefinedSymbols.size());<br>
   _symbolStringPoolSize = 1; // Always reserve 1-byte for the empty string.<br>
+  for (const Symbol &sym : _file.stabsSymbols) {<br>
+    _symbolStringPoolSize += (sym.name.size()+1);<br>
+  }<br>
   for (const Symbol &sym : _file.localSymbols) {<br>
     _symbolStringPoolSize += (sym.name.size()+1);<br>
   }<br>
@@ -1428,7 +1434,8 @@ void MachOFileLayout::computeSymbolTable<br>
     _symbolStringPoolSize += (sym.name.size()+1);<br>
   }<br>
   _symbolTableLocalsStartIndex = 0;<br>
-  _symbolTableGlobalsStartIndex = _file.localSymbols.size();<br>
+  _symbolTableGlobalsStartIndex = _file.stabsSymbols.size() +<br>
+                                  _file.localSymbols.size();<br>
   _symbolTableUndefinesStartIndex = _symbolTableGlobalsStartIndex<br>
                                     + _file.globalSymbols.size();<br>
<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Wed Jul 27 16:31:25 2016<br>
@@ -22,6 +22,7 @@<br>
<br>
 #include "MachONormalizedFile.h"<br>
 #include "ArchHandler.h"<br>
+#include "DebugInfo.h"<br>
 #include "MachONormalizedFileBinaryUtils.h"<br>
 #include "lld/Core/Error.h"<br>
 #include "lld/Core/LLVM.h"<br>
@@ -34,6 +35,7 @@<br>
 #include "llvm/Support/MachO.h"<br>
 #include <map><br>
 #include <system_error><br>
+#include <unordered_set><br>
<br>
 using llvm::StringRef;<br>
 using llvm::isa;<br>
@@ -120,6 +122,7 @@ public:<br>
   void      copySectionInfo(NormalizedFile &file);<br>
   void      updateSectionInfo(NormalizedFile &file);<br>
   void      buildAtomToAddressMap();<br>
+  llvm::Error synthesizeDebugNotes(NormalizedFile &file);<br>
   llvm::Error addSymbols(const lld::File &atomFile, NormalizedFile &file);<br>
   void      addIndirectSymbols(const lld::File &atomFile, NormalizedFile &file);<br>
   void      addRebaseAndBindingInfo(const lld::File &, NormalizedFile &file);<br>
@@ -201,6 +204,7 @@ private:<br>
   bool                          _allSourceFilesHaveMinVersions = true;<br>
   LoadCommandType               _minVersionCommandType = (LoadCommandType)0;<br>
   uint32_t                      _minVersion = 0;<br>
+  std::vector<lld::mach_o::Stab> _stabs;<br>
 };<br>
<br>
 Util::~Util() {<br>
@@ -785,6 +789,156 @@ void Util::buildAtomToAddressMap() {<br>
   }<br>
 }<br>
<br>
+llvm::Error Util::synthesizeDebugNotes(NormalizedFile &file) {<br>
+<br>
+  // Bail out early if we don't need to generate a debug map.<br>
+  if (_ctx.debugInfoMode() == MachOLinkingContext::DebugInfoMode::noDebugMap)<br>
+    return llvm::Error::success();<br>
+<br>
+  std::vector<const DefinedAtom*> atomsNeedingDebugNotes;<br>
+  std::set<const mach_o::MachOFile*> filesWithStabs;<br>
+  bool objFileHasDwarf = false;<br>
+  const File *objFile = nullptr;<br>
+<br>
+  for (SectionInfo *sect : _sectionInfos) {<br>
+    for (const AtomInfo &info : sect->atomsAndOffsets) {<br>
+      if (const DefinedAtom *atom = dyn_cast<DefinedAtom>(info.atom)) {<br>
+<br>
+        // FIXME: No stabs/debug-notes for symbols that wouldn't be in the<br>
+        //        symbol table.<br>
+        // FIXME: No stabs/debug-notes for kernel dtrace probes.<br>
+<br>
+        if (atom->contentType() == DefinedAtom::typeCFI ||<br>
+            atom->contentType() == DefinedAtom::typeCString)<br>
+          continue;<br>
+<br>
+        // Whenever we encounter a new file, update the 'objfileHasDwarf' flag.<br>
+        if (&info.atom->file() != objFile) {<br>
+          objFileHasDwarf = false;<br>
+          if (const mach_o::MachOFile *atomFile =<br>
+              dyn_cast<mach_o::MachOFile>(&info.atom->file())) {<br>
+            if (atomFile->debugInfo()) {<br>
+              if (isa<mach_o::DwarfDebugInfo>(atomFile->debugInfo()))<br>
+                objFileHasDwarf = true;<br>
+              else if (isa<mach_o::StabsDebugInfo>(atomFile->debugInfo()))<br>
+                filesWithStabs.insert(atomFile);<br>
+            }<br>
+          }<br>
+        }<br>
+<br>
+        // If this atom is from a file that needs dwarf, add it to the list.<br>
+        if (objFileHasDwarf)<br>
+          atomsNeedingDebugNotes.push_back(info.atom);<br>
+      }<br>
+    }<br>
+  }<br>
+<br>
+  // Sort atoms needing debug notes by file ordinal, then atom ordinal.<br>
+  std::sort(atomsNeedingDebugNotes.begin(), atomsNeedingDebugNotes.end(),<br>
+            [](const DefinedAtom *lhs, const DefinedAtom *rhs) {<br>
+              if (lhs->file().ordinal() != rhs->file().ordinal())<br>
+                return (lhs->file().ordinal() < rhs->file().ordinal());<br>
+              return (lhs->ordinal() < rhs->ordinal());<br>
+            });<br>
+<br>
+  // FIXME: Handle <rdar://problem/17689030>: Add -add_ast_path option to \<br>
+  //        linker which add N_AST stab entry to output<br>
+  // See OutputFile::synthesizeDebugNotes in ObjectFile.cpp in ld64.<br>
+<br>
+  StringRef oldFileName = "";<br>
+  StringRef oldDirPath = "";<br>
+  bool wroteStartSO = false;<br>
+  std::unordered_set<std::string> seenFiles;<br>
+  for (const DefinedAtom *atom : atomsNeedingDebugNotes) {<br>
+    const auto &atomFile = cast<mach_o::MachOFile>(atom->file());<br>
+    assert(dyn_cast_or_null<lld::mach_o::DwarfDebugInfo>(atomFile.debugInfo())<br>
+           && "file for atom needing debug notes does not contain dwarf");<br>
+    auto &dwarf = cast<lld::mach_o::DwarfDebugInfo>(*atomFile.debugInfo());<br>
+<br>
+    auto &tu = dwarf.translationUnitSource();<br>
+    StringRef newFileName = <a href="http://tu.name" rel="noreferrer" target="_blank">tu.name</a>;<br>
+    StringRef newDirPath = tu.path;<br>
+<br>
+    // Add an SO whenever the TU source file changes.<br>
+    if (newFileName != oldFileName || newDirPath != oldDirPath) {<br>
+      // Translation unit change, emit ending SO<br>
+      if (oldFileName != "")<br>
+        _stabs.push_back(mach_o::Stab(nullptr, N_SO, 1, 0, 0, ""));<br>
+<br>
+      oldFileName = newFileName;<br>
+      oldDirPath = newDirPath;<br>
+<br>
+      // If newDirPath doesn't end with a '/' we need to add one:<br>
+      if (newDirPath.back() != '/') {<br>
+        std::string *p = file.ownedAllocations.Allocate<std::string>();<br>
+        new (p) std::string();<br>
+        *p = (newDirPath + "/").str();<br>
+        newDirPath = *p;<br>
+      }<br>
+<br>
+      // New translation unit, emit start SOs:<br>
+      _stabs.push_back(mach_o::Stab(nullptr, N_SO, 0, 0, 0, newDirPath));<br>
+      _stabs.push_back(mach_o::Stab(nullptr, N_SO, 0, 0, 0, newFileName));<br>
+<br>
+      // Synthesize OSO for start of file.<br>
+      std::string *fullPath = file.ownedAllocations.Allocate<std::string>();<br>
+      new (fullPath) std::string();<br>
+      {<br>
+        SmallString<1024> pathBuf(atomFile.path());<br>
+        if (auto EC = llvm::sys::fs::make_absolute(pathBuf))<br>
+          return llvm::errorCodeToError(EC);<br>
+        *fullPath = pathBuf.str();<br>
+      }<br>
+<br>
+      // Get mod time.<br>
+      uint32_t modTime = 0;<br>
+      llvm::sys::fs::file_status stat;<br>
+      if (!llvm::sys::fs::status(*fullPath, stat))<br>
+        if (llvm::sys::fs::exists(stat))<br>
+          modTime = stat.getLastModificationTime().toEpochTime();<br>
+<br>
+      _stabs.push_back(mach_o::Stab(nullptr, N_OSO, _ctx.getCPUSubType(), 1,<br>
+                                    modTime, *fullPath));<br>
+      // <rdar://problem/6337329> linker should put cpusubtype in n_sect field<br>
+      // of nlist entry for N_OSO debug note entries.<br>
+      wroteStartSO = true;<br>
+    }<br>
+<br>
+    if (atom->contentType() == DefinedAtom::typeCode) {<br>
+      // Synthesize BNSYM and start FUN stabs.<br>
+      _stabs.push_back(mach_o::Stab(atom, N_BNSYM, 1, 0, 0, ""));<br>
+      _stabs.push_back(mach_o::Stab(atom, N_FUN, 1, 0, 0, atom->name()));<br>
+      // Synthesize any SOL stabs needed<br>
+      // FIXME: add SOL stabs.<br>
+      _stabs.push_back(mach_o::Stab(nullptr, N_FUN, 0, 0,<br>
+                                    atom->rawContent().size(), ""));<br>
+      _stabs.push_back(mach_o::Stab(nullptr, N_ENSYM, 1, 0,<br>
+                                    atom->rawContent().size(), ""));<br>
+    } else {<br>
+      if (atom->scope() == Atom::scopeTranslationUnit)<br>
+        _stabs.push_back(mach_o::Stab(atom, N_STSYM, 1, 0, 0, atom->name()));<br>
+      else<br>
+        _stabs.push_back(mach_o::Stab(nullptr, N_GSYM, 1, 0, 0, atom->name()));<br>
+    }<br>
+  }<br>
+<br>
+  // Emit ending SO if necessary.<br>
+  if (wroteStartSO)<br>
+    _stabs.push_back(mach_o::Stab(nullptr, N_SO, 1, 0, 0, ""));<br>
+<br>
+  // Copy any stabs from .o file.<br>
+  for (const auto *objFile : filesWithStabs) {<br>
+    const auto &stabsList =<br>
+      cast<mach_o::StabsDebugInfo>(objFile->debugInfo())->stabs();<br>
+    for (auto &stab : stabsList) {<br>
+      // FIXME: Drop stabs whose atoms have been dead-stripped.<br>
+      _stabs.push_back(stab);<br>
+    }<br>
+  }<br>
+<br>
+  return llvm::Error::success();<br>
+}<br>
+<br>
 uint16_t Util::descBits(const DefinedAtom* atom) {<br>
   uint16_t desc = 0;<br>
   switch (atom->merge()) {<br>
@@ -868,10 +1022,27 @@ llvm::Error Util::getSymbolTableRegion(c<br>
   llvm_unreachable("atom->scope() unknown enum value");<br>
 }<br>
<br>
+<br>
+<br>
 llvm::Error Util::addSymbols(const lld::File &atomFile,<br>
                              NormalizedFile &file) {<br>
   bool rMode = (_ctx.outputMachOType() == llvm::MachO::MH_OBJECT);<br>
-  // Mach-O symbol table has three regions: locals, globals, undefs.<br>
+  // Mach-O symbol table has four regions: stabs, locals, globals, undefs.<br>
+<br>
+  // Add all stabs.<br>
+  for (auto &stab : _stabs) {<br>
+    Symbol sym;<br>
+    sym.type = static_cast<NListType>(stab.type);<br>
+    sym.scope = 0;<br>
+    sym.sect = stab.other;<br>
+    sym.desc = stab.desc;<br>
+    if (stab.atom)<br>
+      sym.value = _atomToAddress[stab.atom];<br>
+    else<br>
+      sym.value = stab.value;<br>
+    <a href="http://sym.name" rel="noreferrer" target="_blank">sym.name</a> = stab.str;<br>
+    file.stabsSymbols.push_back(sym);<br>
+  }<br>
<br>
   // Add all local (non-global) symbols in address order<br>
   std::vector<AtomAndIndex> globals;<br>
@@ -1404,6 +1575,8 @@ normalizedFromAtoms(const lld::File &ato<br>
   util.copySectionInfo(normFile);<br>
   util.assignAddressesToSections(normFile);<br>
   util.buildAtomToAddressMap();<br>
+  if (auto err = util.synthesizeDebugNotes(normFile))<br>
+    return std::move(err);<br>
   util.updateSectionInfo(normFile);<br>
   util.copySectionContent(normFile);<br>
   if (auto ec = util.addSymbols(atomFile, normFile)) {<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp?rev=276921&r1=276920&r2=276921&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp?rev=276921&r1=276920&r2=276921&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp Wed Jul 27 16:31:25 2016<br>
@@ -27,7 +27,11 @@<br>
 #include "MachONormalizedFileBinaryUtils.h"<br>
 #include "lld/Core/Error.h"<br>
 #include "lld/Core/LLVM.h"<br>
+#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"<br>
+#include "llvm/Support/DataExtractor.h"<br>
 #include "llvm/Support/Debug.h"<br>
+#include "llvm/Support/Dwarf.h"<br>
+#include "llvm/Support/Error.h"<br>
 #include "llvm/Support/Format.h"<br>
 #include "llvm/Support/MachO.h"<br>
 #include "llvm/Support/LEB128.h"<br>
@@ -499,7 +503,7 @@ const Section* findSectionCoveringAddres<br>
<br>
 const MachODefinedAtom *<br>
 findAtomCoveringAddress(const NormalizedFile &normalizedFile, MachOFile &file,<br>
-                        uint64_t addr, Reference::Addend *addend) {<br>
+                        uint64_t addr, Reference::Addend &addend) {<br>
   const Section *sect = nullptr;<br>
   sect = findSectionCoveringAddress(normalizedFile, addr);<br>
   if (!sect)<br>
@@ -509,7 +513,7 @@ findAtomCoveringAddress(const Normalized<br>
   uint64_t offsetInSect = addr - sect->address;<br>
   auto atom =<br>
       file.findAtomCoveringAddress(*sect, offsetInSect, &offsetInTarget);<br>
-  *addend = offsetInTarget;<br>
+  addend = offsetInTarget;<br>
   return atom;<br>
 }<br>
<br>
@@ -548,19 +552,23 @@ llvm::Error convertRelocs(const Section<br>
                            -> llvm::Error {<br>
     // Find symbol from index.<br>
     const Symbol *sym = nullptr;<br>
+    uint32_t numStabs  = normalizedFile.stabsSymbols.size();<br>
     uint32_t numLocal  = normalizedFile.localSymbols.size();<br>
     uint32_t numGlobal = normalizedFile.globalSymbols.size();<br>
     uint32_t numUndef  = normalizedFile.undefinedSymbols.size();<br>
-    if (symbolIndex < numLocal) {<br>
-      sym = &normalizedFile.localSymbols[symbolIndex];<br>
-    } else if (symbolIndex < numLocal+numGlobal) {<br>
-      sym = &normalizedFile.globalSymbols[symbolIndex-numLocal];<br>
-    } else if (symbolIndex < numLocal+numGlobal+numUndef) {<br>
-      sym = &normalizedFile.undefinedSymbols[symbolIndex-numLocal-numGlobal];<br>
+    assert(symbolIndex >= numStabs && "Searched for stab via atomBySymbol?");<br>
+    if (symbolIndex < numStabs+numLocal) {<br>
+      sym = &normalizedFile.localSymbols[symbolIndex-numStabs];<br>
+    } else if (symbolIndex < numStabs+numLocal+numGlobal) {<br>
+      sym = &normalizedFile.globalSymbols[symbolIndex-numStabs-numLocal];<br>
+    } else if (symbolIndex < numStabs+numLocal+numGlobal+numUndef) {<br>
+      sym = &normalizedFile.undefinedSymbols[symbolIndex-numStabs-numLocal-<br>
+                                             numGlobal];<br>
     } else {<br>
       return llvm::make_error<GenericError>(Twine("symbol index (")<br>
                                      + Twine(symbolIndex) + ") out of range");<br>
     }<br>
+<br>
     // Find atom from symbol.<br>
     if ((sym->type & N_TYPE) == N_SECT) {<br>
       if (sym->sect > normalizedFile.sections.size())<br>
@@ -685,6 +693,296 @@ bool isDebugInfoSection(const Section &s<br>
   return section.segmentName.equals("__DWARF");<br>
 }<br>
<br>
+static const Atom* findDefinedAtomByName(MachOFile &file, Twine name) {<br>
+  std::string strName = name.str();<br>
+  for (auto *atom : file.defined())<br>
+    if (atom->name() == strName)<br>
+      return atom;<br>
+  return nullptr;<br>
+}<br>
+<br>
+static StringRef copyDebugString(StringRef str, BumpPtrAllocator &alloc) {<br>
+  std::string *strCopy = alloc.Allocate<std::string>();<br>
+  *strCopy = str;<br>
+  return *strCopy;<br>
+}<br>
+<br>
+llvm::Error parseStabs(MachOFile &file,<br>
+                       const NormalizedFile &normalizedFile,<br>
+                       bool copyRefs) {<br>
+<br>
+  if (normalizedFile.stabsSymbols.empty())<br>
+    return llvm::Error::success();<br>
+<br>
+  // FIXME: Kill this off when we can move to sane yaml parsing.<br>
+  std::unique_ptr<BumpPtrAllocator> allocator;<br>
+  if (copyRefs)<br>
+    allocator = llvm::make_unique<BumpPtrAllocator>();<br>
+<br>
+  enum { start, inBeginEnd } state = start;<br>
+<br>
+  const Atom *currentAtom = nullptr;<br>
+  uint64_t currentAtomAddress = 0;<br>
+  StabsDebugInfo::StabsList stabsList;<br>
+  for (const auto &stabSym : normalizedFile.stabsSymbols) {<br>
+    Stab stab(nullptr, stabSym.type, stabSym.sect, stabSym.desc,<br>
+              stabSym.value, stabSym.name);<br>
+    switch (state) {<br>
+    case start:<br>
+      switch (static_cast<StabType>(stabSym.type)) {<br>
+      case N_BNSYM:<br>
+        state = inBeginEnd;<br>
+        currentAtomAddress = stabSym.value;<br>
+        Reference::Addend addend;<br>
+        currentAtom = findAtomCoveringAddress(normalizedFile, file,<br>
+                                              currentAtomAddress, addend);<br>
+        if (addend != 0)<br>
+          return llvm::make_error<GenericError>(<br>
+                   "Non-zero addend for BNSYM '" + stabSym.name + "' in " +<br>
+                   file.path());<br>
+        if (currentAtom)<br>
+          stab.atom = currentAtom;<br>
+        else {<br>
+          // FIXME: ld64 just issues a warning here - should we match that?<br>
+          return llvm::make_error<GenericError>(<br>
+                   "can't find atom for stabs BNSYM at " +<br>
+                   Twine::utohexstr(stabSym.value) + " in " + file.path());<br>
+        }<br>
+        break;<br>
+      case N_SO:<br>
+      case N_OSO:<br>
+        // Not associated with an atom, just copy.<br>
+        if (copyRefs)<br>
+          stab.str = copyDebugString(stabSym.name, *allocator);<br>
+        else<br>
+          stab.str = stabSym.name;<br>
+        break;<br>
+      case N_GSYM: {<br>
+        auto colonIdx = stabSym.name.find(':');<br>
+        if (colonIdx != StringRef::npos) {<br>
+          StringRef name = stabSym.name.substr(0, colonIdx);<br>
+          currentAtom = findDefinedAtomByName(file, "_" + name);<br>
+          stab.atom = currentAtom;<br>
+          if (copyRefs)<br>
+            stab.str = copyDebugString(stabSym.name, *allocator);<br>
+          else<br>
+            stab.str = stabSym.name;<br>
+        } else {<br>
+          currentAtom = findDefinedAtomByName(file, stabSym.name);<br>
+          stab.atom = currentAtom;<br>
+          if (copyRefs)<br>
+            stab.str = copyDebugString(stabSym.name, *allocator);<br>
+          else<br>
+            stab.str = stabSym.name;<br>
+        }<br>
+        if (stab.atom == nullptr)<br>
+          return llvm::make_error<GenericError>(<br>
+                   "can't find atom for N_GSYM stabs" + stabSym.name +<br>
+                   " in " + file.path());<br>
+        break;<br>
+      }<br>
+      case N_FUN:<br>
+        return llvm::make_error<GenericError>(<br>
+                 "old-style N_FUN stab '" + stabSym.name + "' unsupported");<br>
+      default:<br>
+        return llvm::make_error<GenericError>(<br>
+                 "unrecognized stab symbol '" + stabSym.name + "'");<br>
+      }<br>
+      break;<br>
+    case inBeginEnd:<br>
+      stab.atom = currentAtom;<br>
+      switch (static_cast<StabType>(stabSym.type)) {<br>
+      case N_ENSYM:<br>
+        state = start;<br>
+        currentAtom = nullptr;<br>
+        break;<br>
+      case N_FUN:<br>
+        // Just copy the string.<br>
+        if (copyRefs)<br>
+          stab.str = copyDebugString(stabSym.name, *allocator);<br>
+        else<br>
+          stab.str = stabSym.name;<br>
+        break;<br>
+      default:<br>
+        return llvm::make_error<GenericError>(<br>
+                 "unrecognized stab symbol '" + stabSym.name + "'");<br>
+      }<br>
+    }<br>
+    llvm::dbgs() << "Adding to stabsList: " << stab << "\n";<br>
+    stabsList.push_back(stab);<br>
+  }<br>
+<br>
+  file.setDebugInfo(llvm::make_unique<StabsDebugInfo>(std::move(stabsList)));<br>
+<br>
+  // FIXME: Kill this off when we fix YAML memory ownership.<br>
+  file.debugInfo()->setAllocator(std::move(allocator));<br>
+<br>
+  return llvm::Error::success();<br>
+}<br>
+<br>
+static llvm::DataExtractor<br>
+dataExtractorFromSection(const NormalizedFile &normalizedFile,<br>
+                         const Section &S) {<br>
+  const bool is64 = MachOLinkingContext::is64Bit(normalizedFile.arch);<br>
+  const bool isBig = MachOLinkingContext::isBigEndian(normalizedFile.arch);<br>
+  StringRef SecData(reinterpret_cast<const char*>(S.content.data()),<br>
+                    S.content.size());<br>
+  return llvm::DataExtractor(SecData, !isBig, is64 ? 8 : 4);<br>
+}<br>
+<br>
+// FIXME: Cribbed from llvm-dwp -- should share "lightweight CU DIE<br>
+//        inspection" code if possible.<br>
+static uint32_t getCUAbbrevOffset(llvm::DataExtractor abbrevData,<br>
+                                  uint64_t abbrCode) {<br>
+  uint64_t curCode;<br>
+  uint32_t offset = 0;<br>
+  while ((curCode = abbrevData.getULEB128(&offset)) != abbrCode) {<br>
+    // Tag<br>
+    abbrevData.getULEB128(&offset);<br>
+    // DW_CHILDREN<br>
+    abbrevData.getU8(&offset);<br>
+    // Attributes<br>
+    while (abbrevData.getULEB128(&offset) | abbrevData.getULEB128(&offset))<br>
+      ;<br>
+  }<br>
+  return offset;<br>
+}<br>
+<br>
+// FIXME: Cribbed from llvm-dwp -- should share "lightweight CU DIE<br>
+//        inspection" code if possible.<br>
+static Expected<const char *><br>
+getIndexedString(const NormalizedFile &normalizedFile,<br>
+                 uint32_t form, llvm::DataExtractor infoData,<br>
+                 uint32_t &infoOffset, const Section &stringsSection) {<br>
+  if (form == llvm::dwarf::DW_FORM_string)<br>
+   return infoData.getCStr(&infoOffset);<br>
+  if (form != llvm::dwarf::DW_FORM_strp)<br>
+    return llvm::make_error<GenericError>(<br>
+        "string field encoded without DW_FORM_strp");<br>
+  uint32_t stringOffset = infoData.getU32(&infoOffset);<br>
+  llvm::DataExtractor stringsData =<br>
+    dataExtractorFromSection(normalizedFile, stringsSection);<br>
+  return stringsData.getCStr(&stringOffset);<br>
+}<br>
+<br>
+// FIXME: Cribbed from llvm-dwp -- should share "lightweight CU DIE<br>
+//        inspection" code if possible.<br>
+static llvm::Expected<TranslationUnitSource><br>
+readCompUnit(const NormalizedFile &normalizedFile,<br>
+             const Section &info,<br>
+             const Section &abbrev,<br>
+             const Section &strings,<br>
+             StringRef path) {<br>
+  // FIXME: Cribbed from llvm-dwp -- should share "lightweight CU DIE<br>
+  //        inspection" code if possible.<br>
+  uint32_t offset = 0;<br>
+  auto infoData = dataExtractorFromSection(normalizedFile, info);<br>
+  uint32_t length = infoData.getU32(&offset);<br>
+  if (length == 0xffffffff)<br>
+    infoData.getU64(&offset);<br>
+  else if (length > 0xffffff00)<br>
+    return llvm::make_error<GenericError>("Malformed DWARF in " + path);<br>
+<br>
+  uint16_t version = infoData.getU16(&offset);<br>
+<br>
+  if (version < 2 || version > 4)<br>
+    return llvm::make_error<GenericError>("Unsupported DWARF version in " +<br>
+                                          path);<br>
+<br>
+  infoData.getU32(&offset); // Abbrev offset (should be zero)<br>
+  uint8_t addrSize = infoData.getU8(&offset);<br>
+<br>
+  uint32_t abbrCode = infoData.getULEB128(&offset);<br>
+  auto abbrevData = dataExtractorFromSection(normalizedFile, abbrev);<br>
+  uint32_t abbrevOffset = getCUAbbrevOffset(abbrevData, abbrCode);<br>
+  uint64_t tag = abbrevData.getULEB128(&abbrevOffset);<br>
+  if (tag != llvm::dwarf::DW_TAG_compile_unit)<br>
+    return llvm::make_error<GenericError>("top level DIE is not a compile unit");<br>
+  // DW_CHILDREN<br>
+  abbrevData.getU8(&abbrevOffset);<br>
+  uint32_t name;<br>
+  uint32_t form;<br>
+  TranslationUnitSource tu;<br>
+  while ((name = abbrevData.getULEB128(&abbrevOffset)) |<br>
+             (form = abbrevData.getULEB128(&abbrevOffset)) &&<br>
+         (name != 0 || form != 0)) {<br>
+    switch (name) {<br>
+    case llvm::dwarf::DW_AT_name: {<br>
+      if (auto eName = getIndexedString(normalizedFile, form, infoData, offset,<br>
+                                        strings))<br>
+          <a href="http://tu.name" rel="noreferrer" target="_blank">tu.name</a> = *eName;<br>
+      else<br>
+        return eName.takeError();<br>
+      break;<br>
+    }<br>
+    case llvm::dwarf::DW_AT_comp_dir: {<br>
+      if (auto eName = getIndexedString(normalizedFile, form, infoData, offset,<br>
+                                        strings))<br>
+        tu.path = *eName;<br>
+      else<br>
+        return eName.takeError();<br>
+      break;<br>
+    }<br>
+    default:<br>
+      llvm::DWARFFormValue::skipValue(form, infoData, &offset, version,<br>
+                                      addrSize);<br>
+    }<br>
+  }<br>
+  return tu;<br>
+}<br>
+<br>
+llvm::Error parseDebugInfo(MachOFile &file,<br>
+                           const NormalizedFile &normalizedFile, bool copyRefs) {<br>
+<br>
+  // Find the interesting debug info sections.<br>
+  const Section *debugInfo = nullptr;<br>
+  const Section *debugAbbrev = nullptr;<br>
+  const Section *debugStrings = nullptr;<br>
+<br>
+  for (auto &s : normalizedFile.sections) {<br>
+    if (s.segmentName == "__DWARF") {<br>
+      if (s.sectionName == "__debug_info")<br>
+        debugInfo = &s;<br>
+      else if (s.sectionName == "__debug_abbrev")<br>
+        debugAbbrev = &s;<br>
+      else if (s.sectionName == "__debug_str")<br>
+        debugStrings = &s;<br>
+    }<br>
+  }<br>
+<br>
+  if (!debugInfo)<br>
+    return parseStabs(file, normalizedFile, copyRefs);<br>
+<br>
+  if (debugInfo->content.size() == 0)<br>
+    return llvm::Error::success();<br>
+<br>
+  if (debugInfo->content.size() < 12)<br>
+    return llvm::make_error<GenericError>("Malformed __debug_info section in " +<br>
+                                          file.path() + ": too small");<br>
+<br>
+  if (!debugAbbrev)<br>
+    return llvm::make_error<GenericError>("Missing __dwarf_abbrev section in " +<br>
+                                          file.path());<br>
+<br>
+  if (auto tuOrErr = readCompUnit(normalizedFile, *debugInfo, *debugAbbrev,<br>
+                                  *debugStrings, file.path())) {<br>
+    // FIXME: Kill of allocator and code under 'copyRefs' when we fix YAML<br>
+    //        memory ownership.<br>
+    std::unique_ptr<BumpPtrAllocator> allocator;<br>
+    if (copyRefs) {<br>
+      allocator = llvm::make_unique<BumpPtrAllocator>();<br>
+      tuOrErr->name = copyDebugString(tuOrErr->name, *allocator);<br>
+      tuOrErr->path = copyDebugString(tuOrErr->path, *allocator);<br>
+    }<br>
+    file.setDebugInfo(llvm::make_unique<DwarfDebugInfo>(std::move(*tuOrErr)));<br>
+    if (copyRefs)<br>
+      file.debugInfo()->setAllocator(std::move(allocator));<br>
+  } else<br>
+    return tuOrErr.takeError();<br>
+<br>
+  return llvm::Error::success();<br>
+}<br>
+<br>
 static int64_t readSPtr(bool is64, bool isBig, const uint8_t *addr) {<br>
   if (is64)<br>
     return read64(addr, isBig);<br>
@@ -853,7 +1151,7 @@ static llvm::Error processCIE(const Norm<br>
       const MachODefinedAtom *func = nullptr;<br>
       Reference::Addend addend;<br>
       func = findAtomCoveringAddress(normalizedFile, file, funcAddress,<br>
-                                     &addend);<br>
+                                     addend);<br>
       atom->addReference(Reference::KindNamespace::mach_o, handler.kindArch(),<br>
                          handler.unwindRefToPersonalityFunctionKind(),<br>
                          PersonalityFunctionField, func, addend);<br>
@@ -936,7 +1234,7 @@ static llvm::Error processFDE(const Norm<br>
     }<br>
     Reference::Addend addend;<br>
     auto *target = findAtomCoveringAddress(normalizedFile, file,<br>
-                                           targetAddress, &addend);<br>
+                                           targetAddress, addend);<br>
     atom->addReference(Reference::KindNamespace::mach_o, handler.kindArch(),<br>
                        refKind, refAddress, target, addend);<br>
<br>
@@ -1095,7 +1393,6 @@ llvm::Error parseObjCImageInfo(const Sec<br>
   return llvm::Error();<br>
 }<br>
<br>
-<br>
 /// Converts normalized mach-o file into an lld::File and lld::Atoms.<br>
 llvm::Expected<std::unique_ptr<lld::File>><br>
 objectToAtoms(const NormalizedFile &normalizedFile, StringRef path,<br>
@@ -1136,10 +1433,11 @@ normalizedObjectToAtoms(MachOFile *file,<br>
   // Create atoms from each section.<br>
   for (auto &sect : normalizedFile.sections) {<br>
     DEBUG(llvm::dbgs() << "Creating atoms: "; sect.dump());<br>
+<br>
+    // If this is a debug-info section parse it specially.<br>
     if (isDebugInfoSection(sect))<br>
       continue;<br>
<br>
-<br>
     // If the file contains an objc_image_info struct, then we should parse the<br>
     // ObjC flags and Swift version.<br>
     if (isObjCImageInfo(sect)) {<br>
@@ -1248,6 +1546,10 @@ normalizedObjectToAtoms(MachOFile *file,<br>
   for (const DefinedAtom* defAtom : file->defined()) {<br>
     reinterpret_cast<const SimpleDefinedAtom*>(defAtom)->sortReferences();<br>
   }<br>
+<br>
+  if (auto err = parseDebugInfo(*file, normalizedFile, copyRefs))<br>
+    return err;<br>
+<br>
   return llvm::Error();<br>
 }<br>
<br>
@@ -1325,6 +1627,13 @@ normalizedToAtoms(const NormalizedFile &<br>
 }<br>
<br>
 #ifndef NDEBUG<br>
+void Relocation::dump(llvm::raw_ostream &OS) const {<br>
+  OS << "Relocation (offset=" << llvm::format_hex(offset, 8, true)<br>
+     << ", scatered=" << scattered << ", type=" << type << ", length=" << length<br>
+     << ", pcrel=" << pcRel << ", isExtern=" << isExtern << ", value="<br>
+     << llvm::format_hex(value, 8, true) << ", symbol=" << symbol << ")\n";<br>
+}<br>
+<br>
 void Section::dump(llvm::raw_ostream &OS) const {<br>
   OS << "Section (\"" << segmentName << ", " << sectionName << "\"";<br>
   OS << ", addr: " << llvm::format_hex(address, 16, true);<br>
<br>
Added: lld/trunk/test/mach-o/debug-syms.yaml<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/debug-syms.yaml?rev=276921&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/debug-syms.yaml?rev=276921&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/mach-o/debug-syms.yaml (added)<br>
+++ lld/trunk/test/mach-o/debug-syms.yaml Wed Jul 27 16:31:25 2016<br>
@@ -0,0 +1,249 @@<br>
+# RUN: lld -flavor darwin -arch x86_64 -o %t %s -lSystem && \<br>
+# RUN:   llvm-nm -no-sort -debug-syms %t | FileCheck %s<br>
+<br>
+# CHECK:      0000000000000000 - 00 0000    SO /Users/lhames/Projects/lld/lld-svn-tot/scratch/<br>
+# CHECK-NEXT: 0000000000000000 - 00 0000    SO hw.c<br>
+# CHECK-NEXT:    {{[0-9a-f]+}} - 03 0001   OSO {{.*}}/test/mach-o/debug-syms.yaml<br>
+# CHECK-NEXT: 0000000100000fa0 - 01 0000 BNSYM<br>
+# CHECK-NEXT: 0000000100000fa0 - 01 0000   FUN _main<br>
+# CHECK-NEXT: 0000000000000016 - 00 0000   FUN<br>
+# CHECK-NEXT: 0000000000000016 - 01 0000 ENSYM<br>
+# CHECK-NEXT: 0000000000000000 - 01 0000    SO<br>
+<br>
+--- !mach-o<br>
+arch:            x86_64<br>
+file-type:       MH_OBJECT<br>
+flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]<br>
+compat-version:  0.0<br>
+current-version: 0.0<br>
+has-UUID:        false<br>
+OS:              unknown<br>
+min-os-version-kind: LC_VERSION_MIN_MACOSX<br>
+sections:<br>
+  - segment:         __TEXT<br>
+    section:         __text<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]<br>
+    alignment:       16<br>
+    address:         0x0000000000000000<br>
+    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x31, 0xC0, 0xC7, 0x45,<br>
+                       0xFC, 0x00, 0x00, 0x00, 0x00, 0x89, 0x7D, 0xF8,<br>
+                       0x48, 0x89, 0x75, 0xF0, 0x5D, 0xC3 ]<br>
+  - segment:         __DWARF<br>
+    section:         __debug_str<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x0000000000000016<br>
+    content:         [ 0x41, 0x70, 0x70, 0x6C, 0x65, 0x20, 0x4C, 0x4C,<br>
+                       0x56, 0x4D, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,<br>
+                       0x6F, 0x6E, 0x20, 0x38, 0x2E, 0x30, 0x2E, 0x30,<br>
+                       0x20, 0x28, 0x63, 0x6C, 0x61, 0x6E, 0x67, 0x2D,<br>
+                       0x38, 0x30, 0x30, 0x2E, 0x30, 0x2E, 0x32, 0x34,<br>
+                       0x2E, 0x31, 0x29, 0x00, 0x68, 0x77, 0x2E, 0x63,<br>
+                       0x00, 0x2F, 0x55, 0x73, 0x65, 0x72, 0x73, 0x2F,<br>
+                       0x6C, 0x68, 0x61, 0x6D, 0x65, 0x73, 0x2F, 0x50,<br>
+                       0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x73, 0x2F,<br>
+                       0x6C, 0x6C, 0x64, 0x2F, 0x6C, 0x6C, 0x64, 0x2D,<br>
+                       0x73, 0x76, 0x6E, 0x2D, 0x74, 0x6F, 0x74, 0x2F,<br>
+                       0x73, 0x63, 0x72, 0x61, 0x74, 0x63, 0x68, 0x00,<br>
+                       0x6D, 0x61, 0x69, 0x6E, 0x00, 0x69, 0x6E, 0x74,<br>
+                       0x00, 0x61, 0x72, 0x67, 0x63, 0x00, 0x61, 0x72,<br>
+                       0x67, 0x76, 0x00, 0x63, 0x68, 0x61, 0x72, 0x00 ]<br>
+  - segment:         __DWARF<br>
+    section:         __debug_loc<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x000000000000008E<br>
+  - segment:         __DWARF<br>
+    section:         __debug_abbrev<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x000000000000008E<br>
+    content:         [ 0x01, 0x11, 0x01, 0x25, 0x0E, 0x13, 0x05, 0x03,<br>
+                       0x0E, 0x10, 0x06, 0x1B, 0x0E, 0x11, 0x01, 0x12,<br>
+                       0x01, 0x00, 0x00, 0x02, 0x2E, 0x01, 0x11, 0x01,<br>
+                       0x12, 0x01, 0x40, 0x0A, 0x03, 0x0E, 0x3A, 0x0B,<br>
+                       0x3B, 0x0B, 0x27, 0x0C, 0x49, 0x13, 0x3F, 0x0C,<br>
+                       0x00, 0x00, 0x03, 0x05, 0x00, 0x02, 0x0A, 0x03,<br>
+                       0x0E, 0x3A, 0x0B, 0x3B, 0x0B, 0x49, 0x13, 0x00,<br>
+                       0x00, 0x04, 0x24, 0x00, 0x03, 0x0E, 0x3E, 0x0B,<br>
+                       0x0B, 0x0B, 0x00, 0x00, 0x05, 0x0F, 0x00, 0x49,<br>
+                       0x13, 0x00, 0x00, 0x00 ]<br>
+  - segment:         __DWARF<br>
+    section:         __debug_info<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x00000000000000DA<br>
+    content:         [ 0x7F, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x0C, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,<br>
+                       0x56, 0x60, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,<br>
+                       0x6A, 0x00, 0x00, 0x00, 0x01, 0x03, 0x02, 0x91,<br>
+                       0x78, 0x69, 0x00, 0x00, 0x00, 0x01, 0x01, 0x6A,<br>
+                       0x00, 0x00, 0x00, 0x03, 0x02, 0x91, 0x70, 0x6E,<br>
+                       0x00, 0x00, 0x00, 0x01, 0x01, 0x71, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x04, 0x65, 0x00, 0x00, 0x00, 0x05,<br>
+                       0x04, 0x05, 0x76, 0x00, 0x00, 0x00, 0x05, 0x7B,<br>
+                       0x00, 0x00, 0x00, 0x04, 0x73, 0x00, 0x00, 0x00,<br>
+                       0x06, 0x01, 0x00 ]<br>
+    relocations:<br>
+      - offset:          0x00000037<br>
+        type:            X86_64_RELOC_UNSIGNED<br>
+        length:          3<br>
+        pc-rel:          false<br>
+        extern:          false<br>
+        symbol:          1<br>
+      - offset:          0x0000002F<br>
+        type:            X86_64_RELOC_UNSIGNED<br>
+        length:          3<br>
+        pc-rel:          false<br>
+        extern:          false<br>
+        symbol:          1<br>
+      - offset:          0x00000026<br>
+        type:            X86_64_RELOC_UNSIGNED<br>
+        length:          3<br>
+        pc-rel:          false<br>
+        extern:          false<br>
+        symbol:          1<br>
+      - offset:          0x0000001E<br>
+        type:            X86_64_RELOC_UNSIGNED<br>
+        length:          3<br>
+        pc-rel:          false<br>
+        extern:          false<br>
+        symbol:          1<br>
+  - segment:         __DWARF<br>
+    section:         __debug_ranges<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x000000000000015D<br>
+  - segment:         __DWARF<br>
+    section:         __debug_macinfo<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x000000000000015D<br>
+    content:         [ 0x00 ]<br>
+  - segment:         __DWARF<br>
+    section:         __apple_names<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x000000000000015E<br>
+    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x6A, 0x7F, 0x9A, 0x7C,<br>
+                       0x2C, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00 ]<br>
+  - segment:         __DWARF<br>
+    section:         __apple_objc<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x000000000000019A<br>
+    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,<br>
+                       0xFF, 0xFF, 0xFF, 0xFF ]<br>
+  - segment:         __DWARF<br>
+    section:         __apple_namespac<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x00000000000001BE<br>
+    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,<br>
+                       0xFF, 0xFF, 0xFF, 0xFF ]<br>
+  - segment:         __DWARF<br>
+    section:         __apple_types<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x00000000000001E2<br>
+    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,<br>
+                       0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,<br>
+                       0x03, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0B, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x30, 0x80, 0x88, 0x0B, 0x63, 0x20, 0x95, 0x7C,<br>
+                       0x40, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00,<br>
+                       0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x6A, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01,<br>
+                       0x00, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x24,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]<br>
+  - segment:         __DWARF<br>
+    section:         __apple_exttypes<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x0000000000000248<br>
+    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x06, 0x00,<br>
+                       0xFF, 0xFF, 0xFF, 0xFF ]<br>
+  - segment:         __LD<br>
+    section:         __compact_unwind<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    alignment:       8<br>
+    address:         0x0000000000000270<br>
+    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]<br>
+    relocations:<br>
+      - offset:          0x00000000<br>
+        type:            X86_64_RELOC_UNSIGNED<br>
+        length:          3<br>
+        pc-rel:          false<br>
+        extern:          false<br>
+        symbol:          1<br>
+  - segment:         __TEXT<br>
+    section:         __eh_frame<br>
+    type:            S_COALESCED<br>
+    attributes:      [  ]<br>
+    alignment:       8<br>
+    address:         0x0000000000000290<br>
+    content:         [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01,<br>
+                       0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,<br>
+                       0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,<br>
+                       0x50, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,<br>
+                       0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,<br>
+                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]<br>
+  - segment:         __DWARF<br>
+    section:         __debug_line<br>
+    type:            S_REGULAR<br>
+    attributes:      [ S_ATTR_DEBUG ]<br>
+    address:         0x00000000000002D0<br>
+    content:         [ 0x37, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1B, 0x00,<br>
+                       0x00, 0x00, 0x01, 0x01, 0xFB, 0x0E, 0x0D, 0x00,<br>
+                       0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01,<br>
+                       0x00, 0x00, 0x01, 0x00, 0x68, 0x77, 0x2E, 0x63,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x02,<br>
+                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
+                       0x01, 0x05, 0x03, 0x0A, 0x08, 0x3D, 0x02, 0x02,<br>
+                       0x00, 0x01, 0x01 ]<br>
+    relocations:<br>
+      - offset:          0x00000028<br>
+        type:            X86_64_RELOC_UNSIGNED<br>
+        length:          3<br>
+        pc-rel:          false<br>
+        extern:          false<br>
+        symbol:          1<br>
+global-symbols:<br>
+  - name:            _main<br>
+    type:            N_SECT<br>
+    scope:           [ N_EXT ]<br>
+    sect:            1<br>
+    value:           0x0000000000000000<br>
+page-size:       0x00000000<br>
+...<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div><span><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature">Mike<br>Sent from phone</div>
</font></span></blockquote></div><br></div>
</blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature">Mike<br>Sent from phone</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>