<div dir="ltr">I'm not opposed to remove the assertion from the file, as I believe a symbol with empty name is a valid symbol. Not 100% sure what the ELF spec says, though.</div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Tue, Feb 4, 2014 at 2:19 PM, Simon Atanasyan <span dir="ltr"><<a href="mailto:simon@atanasyan.com" target="_blank">simon@atanasyan.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi,<br>
<br>
Method RefNameBuilder::buildDuplicateNameMap() has an assert which<br>
blocks atoms with empty name. In general it looks reasonable but some<br>
toolchains (for example Sourcery CodeBench in both MIPS and ARM<br>
editions) can generate an object file contains absolute STT_FILE<br>
symbols with empty name. Moreover crt1.o object file from this<br>
toolchain has such symbol. I do not know is it a feature or bug but<br>
that behavior exists for a long time.<br>
<br>
Here is the reproduction script:<br>
[[<br>
  $ cat test.c<br>
  void foo() {}<br>
  $ mips-linux-gnu-gcc -c test.c<br>
  $ mips-linux-gnu-gcc -r -nostdlib test.o<br>
  $ readelf -s a.out | grep FILE<br>
       9: 00000000     0 FILE    LOCAL  DEFAULT  ABS test.c<br>
      10: 00000000     0 FILE    LOCAL  DEFAULT  ABS<br>
]]<br>
<br>
I suggest to remove assert from the<br>
RefNameBuilder::buildDuplicateNameMap() method. I think we do not<br>
break anything in that case.<br>
<br>
Any objections, comments, suggestions?<br>
<br>
[[<br>
--- a/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp<br>
+++ b/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp<br>
@@ -101,7 +101,6 @@ public:<br>
   }<br>
<br>
   void buildDuplicateNameMap(const lld::Atom &atom) {<br>
-    assert(!<a href="http://atom.name" target="_blank">atom.name</a>().empty());<br>
     NameToAtom::iterator pos = _nameMap.find(<a href="http://atom.name" target="_blank">atom.name</a>());<br>
     if (pos != _nameMap.end()) {<br>
       // Found name collision, give each a unique ref-name.<br>
]]<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Simon Atanasyan<br>
</font></span></blockquote></div><br></div>