<div dir="ltr">This commit might help motivate the warnings we've discussed surrounding MSVC record layout...</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">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>