<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in macho-valid-0-nsyms</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>1829c686 - Fix the code that leads to the incorrect trigger of the report_fatal_error()</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/llvm/test/Object/Inputs/macho-valid-0-nsyms#1829c686</link>
        <description>Fix the code that leads to the incorrect trigger of the report_fatal_error()in MachOObjectFile::getSymbolByIndex() when a Mach-O file hasa symbol table load command but the number of symbols are zero.The code in MachOObjectFile::symbol_begin_impl() should not beassuming there is a symbol at index 0, in cases there is no symboltable load command or the count of symbol is zero.  So I also fixedthat.  And needed to fix MachOObjectFile::symbol_end_impl() toalso do the same thing for no symbol table or one with zero entries.The code in MachOObjectFile::getSymbolByIndex() should triggerthe report_fatal_error() for programmatic errors for any index whenthere is no symbol table load command and not return the end iterator.So also fixed that. Note there is no test case as this is a programmaticerror.The test case using the file macho-invalid-bad-symbol-index hasa symbol table load command with its number of symbols (nsyms)is zero. Which was incorrectly testing the bad triggering of thereport_fatal_error() in in MachOObjectFile::getSymbolByIndex().This test case is an invalid Mach-O file but not for that reason.It appears this Mach-O file use to have an nsyms value of 11,and what makes this Mach-O file invalid is the counts andindexes into the symbol table of the dynamic load commandare now invalid because the number of symbol table entries(nsyms) is now zero.  Which can be seen with the existingllvm-obdump:% llvm-objdump -private-headers macho-invalid-bad-symbol-index&#8230;Load command 4     cmd LC_SYMTAB cmdsize 24  symoff 4216   nsyms 0  stroff 4392 strsize 144Load command 5            cmd LC_DYSYMTAB        cmdsize 80      ilocalsym 0      nlocalsym 8 (past the end of the symbol table)     iextdefsym 8 (greater than the number of symbols)     nextdefsym 2 (past the end of the symbol table)      iundefsym 10 (greater than the number of symbols)      nundefsym 1 (past the end of the symbol table)...And the native darwin tools generates an error for this file:% nm macho-invalid-bad-symbol-indexnm: object: macho-invalid-bad-symbol-index truncated or malformed object (ilocalsym plus nlocalsym in LC_DYSYMTAB load command extends past the end of the symbol table)I added new checks for the indexes and sizes for these in theconstructor of MachOObjectFile.  And added comments for whatwould be a proper diagnostic messages.And changed the test case using macho-invalid-bad-symbol-indexto test for the new error now produced.Also added a test with a valid Mach-O file with a symbol tableload command where the number of symbols is zero that showsthe report_fatal_error() is not called.llvm-svn: 258576

            List of files:
            /llvm-project-15.0.7/llvm/test/Object/Inputs/macho-valid-0-nsyms</description>
        <pubDate>Fri, 22 Jan 2016 22:49:55 +0000</pubDate>
        <dc:creator>Kevin Enderby &lt;enderby@apple.com&gt;</dc:creator>
    </item>
</channel>
</rss>
