<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I spent a bit of time looking at this.  By default, llvm-ar will automatically generate a symbol table… which suppresses the lld error because lld never looks at unneeded object files in an archive with a symbol table.  However, there’s
 an exception: if the host is not Darwin, and the archive contains no object files, llvm-ar skips generating a symbol table even if one is requested.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Maybe it makes sense to change the behavior of llvm-ar so it’s more consistent… I’m not sure what the history is behind making the symbol table behavior depend on the archive format.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On a sort of related note, maybe we want to change lld so it doesn’t generate the “not an ELF file” error for archives which don’t have a symbol table?  That would be more consistent with the behavior of archives with a symbol table.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Eli<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Rui Ueyama <ruiu@google.com> <br>
<b>Sent:</b> Wednesday, March 13, 2019 4:23 PM<br>
<b>To:</b> Eli Friedman <efriedma@quicinc.com><br>
<b>Cc:</b> llvm-commits <llvm-commits@lists.llvm.org><br>
<b>Subject:</b> [EXT] Re: [lld] r355894 - Fix test to unconditionally create a GNU-format archive.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">lld uses LLVM's libObject to read archive files, and I believe the library supports all variants of archive files, so it is odd that lld can't read some archive variant. Something is not right...<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Mar 11, 2019 at 7:18 PM Eli Friedman via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Author: efriedma<br>
Date: Mon Mar 11 19:20:01 2019<br>
New Revision: 355894<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=355894&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=355894&view=rev</a><br>
Log:<br>
Fix test to unconditionally create a GNU-format archive.<br>
<br>
On Darwin targets, llvm-ar creates a Darwin format archive by default,<br>
which ld.lld can't read, so it was printing an unexpected error.<br>
<br>
<br>
Modified:<br>
    lld/trunk/test/ELF/invalid/invalid-elf.test<br>
<br>
Modified: lld/trunk/test/ELF/invalid/invalid-elf.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/invalid-elf.test?rev=355894&r1=355893&r2=355894&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/invalid-elf.test?rev=355894&r1=355893&r2=355894&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/invalid/invalid-elf.test (original)<br>
+++ lld/trunk/test/ELF/invalid/invalid-elf.test Mon Mar 11 19:20:01 2019<br>
@@ -2,7 +2,7 @@<br>
 # RUN: rm -rf %t && mkdir -p %t<br>
 # RUN: llvm-mc %s -o %t/simple.o -filetype=obj -triple x86_64-pc-linux<br>
 # RUN: echo > %t/empty.o<br>
-# RUN: llvm-ar cr %t/not-elf.a %t/empty.o<br>
+# RUN: llvm-ar --format=gnu cr %t/not-elf.a %t/empty.o<br>
<br>
 # RUN: not ld.lld %t/simple.o %t/not-elf.a -o %t2 2>&1 | \<br>
 # RUN:   FileCheck --check-prefix=NOT-ELF %s<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>