<p dir="ltr">Please check the symbol value of bar to see that it matches.</p>
<p dir="ltr">Please factor the base + offset expression. Every relocation is likely to use it. </p>
<p dir="ltr">Lgtm with that.</p>
<div class="gmail_quote">On Aug 28, 2015 12:30 PM, "Davide Italiano" <<a href="mailto:dccitaliano@gmail.com">dccitaliano@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">davide created this revision.<br>
davide added reviewers: rafael, Bigcheese.<br>
davide added a subscriber: llvm-commits.<br>
<br>
More to come.<br>
<br>
<a href="http://reviews.llvm.org/D12436" rel="noreferrer" target="_blank">http://reviews.llvm.org/D12436</a><br>
<br>
Files:<br>
ELF/Writer.cpp<br>
test/elf2/relocation.s<br>
<br>
Index: test/elf2/relocation.s<br>
===================================================================<br>
--- test/elf2/relocation.s<br>
+++ test/elf2/relocation.s<br>
@@ -14,4 +14,13 @@<br>
.global lulz<br>
lulz:<br>
<br>
+.global bar<br>
+.text<br>
+bar:<br>
+ movl $bar, %edx // R_X86_64_32<br>
+<br>
+// R_X86_64_32<br>
+// CHECK: bar:<br>
+// CHECK: 1000: ba 00 10 00 00 movl $4096, %edx<br>
+<br>
// CHECK: e8 04 00 00 00 callq 4<br>
Index: ELF/Writer.cpp<br>
===================================================================<br>
--- ELF/Writer.cpp<br>
+++ ELF/Writer.cpp<br>
@@ -259,6 +259,9 @@<br>
support::endian::write32le(Base + Offset,<br>
SymVA + (RI.r_addend - (P + Offset)));<br>
break;<br>
+ case llvm::ELF::R_X86_64_32:<br>
+ support::endian::write32le(Base + Offset, SymVA + RI.r_addend);<br>
+ break;<br>
default:<br>
llvm::errs() << Twine("unrecognized reloc ") + Twine(Type) << '\n';<br>
break;<br>
<br>
<br>
</blockquote></div>