<div dir="ltr">On Sun, Nov 10, 2013 at 12:15 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Sun, Nov 10, 2013 at 12:06 AM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@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">What was proposed? Is that something that might have helped me find the issue? It actually took a whole day to find it and workaround, so any help would have been appreciated...</div>



</blockquote><div><br></div></div><div>I'm not sure we have looked at anything that would have helped in this specific case. =/</div><div><br></div><div>Essentially, when Warren was working on the record layout in Clang to be compatible with MSVC he found a lot of cases where the behavior might be "buggy" from the perspective of the application developer. We'd like to have warnings in Clang for when these situations arise, but haven't yet implemented them.</div>

</div></div></div></blockquote><div><br></div><div>Sounds like a plan. And I'd think having an ABI compatible compiler itself would have helped me figure out whether this is a bug of a specific compiler or not. :)</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span style="color:rgb(80,0,80)"> </span></div>

<div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Sat, Nov 9, 2013 at 11:56 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@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">This commit might help motivate the warnings we've discussed surrounding MSVC record layout...</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 9, 2013 at 11:48 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ruiu<br>
Date: Sun Nov 10 01:48:33 2013<br>
New Revision: 194349<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=194349&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=194349&view=rev</a><br>
Log:<br>
[ELF] Un-break undef-from-main-dso.test on MSVC 2012.<br>
<br>
The result of sizeof(SymbolTable<ELFT>::SymbolEntry) in DynamicSymbolTable<br>
<ELFT>::write() was different from the same expression in RelocationTable<br>
<ELFT>::write(), although the same template parameters were passed. They were<br>
40 and 32, respectively. As a result, the same vector was treated as a<br>
vector of 40 byte values in some places and a vector of 32 values in other<br>
places. That caused an weird issue, resulting in collapse of the rela.dyn<br>
section.<br>
<br>
I suspect that this is a padding size calculation bug in MSVC 2012, but I<br>
may be wrong. Reordering the fields to eliminate padding seems to fix the<br>
issue.<br>
<br>
Modified:<br>
    lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=194349&r1=194348&r2=194349&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=194349&r1=194348&r2=194349&view=diff</a><br>







==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Sun Nov 10 01:48:33 2013<br>
@@ -614,12 +614,12 @@ class SymbolTable : public Section<ELFT><br>
   struct SymbolEntry {<br>
     SymbolEntry(const Atom *a, const Elf_Sym &sym,<br>
                 const lld::AtomLayout *layout)<br>
-        : _atom(a), _symbol(sym), _atomLayout(layout) {}<br>
+        : _atom(a), _atomLayout(layout), _symbol(sym) {}<br>
     SymbolEntry() : _atom(nullptr) {}<br>
<br>
     const Atom *_atom;<br>
-    Elf_Sym _symbol;<br>
     const lld::AtomLayout *_atomLayout;<br>
+    Elf_Sym _symbol;<br>
   };<br>
<br>
 public:<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>