<div dir="ltr">Revert conflicts with r307730<div>maybe update of arm-mov-relocs.s is enough?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 11, 2017 at 5:32 PM, Vitaly Buka <span dir="ltr"><<a href="mailto:vitalybuka@google.com" target="_blank">vitalybuka@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"><pre><span class="m_4301793706862471373gmail-stdout"><font color="#000000" face="Courier New, courier, monotype, monospace" size="3"><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/6341/steps/check-lld%20asan/logs/stdio" target="_blank">http://lab.llvm.org:8011/<wbr>builders/sanitizer-x86_64-<wbr>linux-fast/builds/6341/steps/<wbr>check-lld%20asan/logs/stdio</a><br></font></span></pre><pre style="font-family:"Courier New",courier,monotype,monospace;color:rgb(0,0,0);font-size:medium"><span class="m_4301793706862471373gmail-stdout">FAIL: lld :: ELF/arm-mov-relocs.s (207 of 1213)
******************** TEST 'lld :: ELF/arm-mov-relocs.s' FAILED ********************
Script:
--
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>llvm-mc -filetype=obj -triple=armv7a-unknown-linux-<wbr>gnueabi /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/tools/lld/test/ELF/<wbr>arm-mov-relocs.s -o /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>ld.lld --full-shutdown /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp -o /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp2
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>llvm-objdump -d /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp2 -triple=armv7a-unknown-linux-<wbr>gnueabi | /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>FileCheck /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/tools/lld/test/ELF/<wbr>arm-mov-relocs.s
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>llvm-mc -filetype=obj -triple=thumbv7a-unknown-<wbr>linux-gnueabi /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/tools/lld/test/ELF/<wbr>arm-mov-relocs.s -o /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp3
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>ld.lld --full-shutdown /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp3 -o /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp4
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>llvm-objdump -d /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/tools/<wbr>lld/test/ELF/Output/arm-mov-<wbr>relocs.s.tmp4 -triple=thumbv7a-unknown-<wbr>linux-gnueabi | /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_msan/./bin/<wbr>FileCheck /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/tools/lld/test/ELF/<wbr>arm-mov-relocs.s
--
Exit Code: 1

Command Output (stderr):
--
/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/tools/lld/test/ELF/<wbr>arm-mov-relocs.s:42:11: error: expected string not found in input
// CHECK: movt r4, #3
          ^
<stdin>:17:2: note: scanning from here
 11024: 02 40 40 e3 movt r4, #2
 ^
<stdin>:17:21: note: possible intended match here
 11024: 02 40 40 e3 movt r4, #2
                    ^</span></pre></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 11, 2017 at 2:07 PM, Martin Storsjo via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mstorsjo<br>
Date: Tue Jul 11 14:07:10 2017<br>
New Revision: 307713<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=307713&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=307713&view=rev</a><br>
Log:<br>
[ARM, ELF] Don't shift movt relocation offsets<br>
<br>
For ELF, a movw+movt pair is handled as two separate relocations.<br>
If an offset should be applied to the symbol address, this offset is<br>
stored as an immediate in the instruction (as opposed to stored as an<br>
offset in the relocation itself).<br>
<br>
Even though the actual value stored in the movt immediate after linking<br>
is the top half of the value, we need to store the unshifted offset<br>
prior to linking. When the relocation is made during linking, the offset<br>
gets added to the target symbol value, and the upper half of the value<br>
is stored in the instruction.<br>
<br>
This makes sure that movw+movt with offset symbols get properly<br>
handled, in case the offset addition in the lower half should be<br>
carried over to the upper half.<br>
<br>
This makes the output from the additions to the test case match<br>
the output from GNU binutils.<br>
<br>
For COFF and MachO, the movw/movt relocations are handled as a pair,<br>
and the overflow from the lower half gets carried over to the movt,<br>
so they should keep the shifted offset just as before.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D35242" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3524<wbr>2</a><br>
<br>
Modified:<br>
    llvm/trunk/lib/Target/ARM/MCTa<wbr>rgetDesc/ARMAsmBackend.cpp<br>
    llvm/trunk/test/MC/ARM/elf-mov<wbr>t.s<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/MCTa<wbr>rgetDesc/ARMAsmBackend.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=307713&r1=307712&r2=307713&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Target/AR<wbr>M/MCTargetDesc/ARMAsmBackend.<wbr>cpp?rev=307713&r1=307712&r2=<wbr>307713&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/ARM/MCTa<wbr>rgetDesc/ARMAsmBackend.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/MCTa<wbr>rgetDesc/ARMAsmBackend.cpp Tue Jul 11 14:07:10 2017<br>
@@ -392,7 +392,7 @@ unsigned ARMAsmBackend::adjustFixupValu<wbr>e<br>
   case FK_SecRel_4:<br>
     return Value;<br>
   case ARM::fixup_arm_movt_hi16:<br>
-    if (!IsPCRel)<br>
+    if (!IsPCRel && !STI->getTargetTriple().isOSBi<wbr>nFormatELF())<br>
       Value >>= 16;<br>
     LLVM_FALLTHROUGH;<br>
   case ARM::fixup_arm_movw_lo16: {<br>
@@ -404,7 +404,7 @@ unsigned ARMAsmBackend::adjustFixupValu<wbr>e<br>
     return Value;<br>
   }<br>
   case ARM::fixup_t2_movt_hi16:<br>
-    if (!IsPCRel)<br>
+    if (!IsPCRel && !STI->getTargetTriple().isOSBi<wbr>nFormatELF())<br>
       Value >>= 16;<br>
     LLVM_FALLTHROUGH;<br>
   case ARM::fixup_t2_movw_lo16: {<br>
<br>
Modified: llvm/trunk/test/MC/ARM/elf-mov<wbr>t.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-movt.s?rev=307713&r1=307712&r2=307713&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/MC/ARM/<wbr>elf-movt.s?rev=307713&r1=30771<wbr>2&r2=307713&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/MC/ARM/elf-mov<wbr>t.s (original)<br>
+++ llvm/trunk/test/MC/ARM/elf-mov<wbr>t.s Tue Jul 11 14:07:10 2017<br>
@@ -14,8 +14,12 @@ barf:<br>
        movw    r0, :lower16:GOT-(.LPC0_2+8)<br>
        movt    r0, :upper16:GOT-(.LPC0_2+8)<br>
 .LPC0_2:<br>
+       movw    r0, :lower16:extern_symbol+1234<br>
+       movt    r0, :upper16:extern_symbol+1234<br>
 @ ASM:          movw    r0, :lower16:(GOT-(.LPC0_2+8))<br>
 @ ASM-NEXT:     movt    r0, :upper16:(GOT-(.LPC0_2+8))<br>
+@ ASM:          movw    r0, :lower16:(extern_symbol+1234)<br>
+@ ASM-NEXT:     movt    r0, :upper16:(extern_symbol+1234)<br>
<br>
 @OBJ:      Disassembly of section .text:<br>
 @OBJ-NEXT: barf:<br>
@@ -23,6 +27,10 @@ barf:<br>
 @OBJ-NEXT: 00000000:         R_ARM_MOVW_PREL_NC   GOT<br>
 @OBJ-NEXT: 4:             f4 0f 4f e3     movt    r0, #65524<br>
 @OBJ-NEXT: 00000004:         R_ARM_MOVT_PREL      GOT<br>
+@OBJ-NEXT: 8:             d2 04 00 e3     movw    r0, #1234<br>
+@OBJ-NEXT: 00000008:         R_ARM_MOVW_ABS_NC    extern_symbol<br>
+@OBJ-NEXT: c:             d2 04 40 e3     movt    r0, #1234<br>
+@OBJ-NEXT: 0000000c:         R_ARM_MOVT_ABS       extern_symbol<br>
<br>
 @THUMB:      Disassembly of section .text:<br>
 @THUMB-NEXT: barf:<br>
@@ -30,3 +38,7 @@ barf:<br>
 @THUMB-NEXT: 00000000:         R_ARM_THM_MOVW_PREL_NC GOT<br>
 @THUMB-NEXT: 4:             cf f6 f4 70     movt    r0, #65524<br>
 @THUMB-NEXT: 00000004:         R_ARM_THM_MOVT_PREL    GOT<br>
+@THUMB-NEXT: 8:             40 f2 d2 40     movw    r0, #1234<br>
+@THUMB-NEXT: 00000008:         R_ARM_THM_MOVW_ABS_NC  extern_symbol<br>
+@THUMB-NEXT: c:             c0 f2 d2 40     movt    r0, #1234<br>
+@THUMB-NEXT: 0000000c:         R_ARM_THM_MOVT_ABS     extern_symbol<br>
<br>
<br>
______________________________<wbr>_________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>