<div dir="ltr">Thanks for the confirmation. From the assembly that was sent on the other branch of the thread:<div>> .set .L.str, .L.str.hwasan-3458764513820540928<br></div><div><br></div><div>-3458764513820540928 = 0xd0 << 56</div><div>i.e. a "negative" tag.</div><div><br></div><div>So this appears to be the issue exactly.</div><div><br></div><div>Peter</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 22, 2020 at 1:55 PM Derrick McKee <<a href="mailto:derrick.mckee@gmail.com">derrick.mckee@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Using lld fixes this issue.<br>
<br>
On Mon, Jun 22, 2020 at 4:51 PM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>> wrote:<br>
><br>
> I suspect that this is hitting the issue that I mentioned here:<br>
> <a href="https://reviews.llvm.org/D65857#1621335" rel="noreferrer" target="_blank">https://reviews.llvm.org/D65857#1621335</a><br>
><br>
> We may need to do what I suggested there and restrict global tag entropy on non-Android Linux to 7 bits. You can try working around this issue for now by using lld as the linker (-fuse-ld=lld).<br>
><br>
> Peter<br>
><br>
> On Mon, Jun 22, 2020 at 1:37 PM Mitch Phillips via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Hi Derrick,<br>
>><br>
>> Can you send through `test.c`? What does clang's assembly say (`path/to/compiled/clang --target=aarch64-linux-gnu -march=armv8.5-a -fsanitize=hwaddress -S test.c; cat test.s`)?<br>
>><br>
>> - Mitch<br>
>><br>
>> On Mon, Jun 22, 2020 at 12:04 PM Derrick McKee via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> I am trying to execute a simple hello world program compiled like so:<br>
>>><br>
>>> path/to/compiled/clang -o test --target=aarch64-linux-gnu<br>
>>> -march=armv8.5-a -fsanitize=hwaddress<br>
>>> --sysroot=/usr/aarch64-linux-gnu/<br>
>>> -L/usr/lib/gcc/aarch64-linux-gnu/10.1.0/ -g test.c<br>
>>><br>
>>> However, when I look at the disassembly, there is an unknown<br>
>>> instruction listed at 0x2d51c:<br>
>>><br>
>>> 000000000002d4c0 main:<br>
>>> 2d4c0: ff c3 00 d1 sub sp, sp, #48<br>
>>> 2d4c4: fd 7b 02 a9 stp x29, x30, [sp, #32]<br>
>>> 2d4c8: fd 83 00 91 add x29, sp, #32<br>
>>> 2d4cc: 08 01 00 d0 adrp x8, #139264<br>
>>> 2d4d0: 08 49 47 f9 ldr x8, [x8, #3728]<br>
>>> 2d4d4: 49 d0 3b d5 mrs x9, TPIDR_EL0<br>
>>> 2d4d8: 28 69 68 f8 ldr x8, [x9, x8]<br>
>>> 2d4dc: 08 7d 40 b2 orr x8, x8, #0xffffffff<br>
>>> 2d4e0: 08 05 00 91 add x8, x8, #1<br>
>>> 2d4e4: a2 13 00 d1 sub x2, x29, #4<br>
>>> 2d4e8: e9 03 08 aa mov x9, x8<br>
>>> 2d4ec: df 64 ff 97 bl #-158852<br>
>>> <__hwasan_check_x2_18_short><br>
>>> 2d4f0: ea 03 1f 2a mov w10, wzr<br>
>>> 2d4f4: aa c3 1f b8 stur w10, [x29, #-4]<br>
>>> 2d4f8: a2 23 00 d1 sub x2, x29, #8<br>
>>> 2d4fc: e9 03 08 aa mov x9, x8<br>
>>> 2d500: da 64 ff 97 bl #-158872<br>
>>> <__hwasan_check_x2_18_short><br>
>>> 2d504: a0 83 1f b8 stur w0, [x29, #-8]<br>
>>> 2d508: e2 43 00 91 add x2, sp, #16<br>
>>> 2d50c: e9 03 08 aa mov x9, x8<br>
>>> 2d510: ec 64 ff 97 bl #-158800<br>
>>> <__hwasan_check_x2_19_short><br>
>>> 2d514: e1 0b 00 f9 str x1, [sp, #16]<br>
>>> 2d518: 40 00 00 d0 adrp x0, #40960<br>
>>> 2d51c: e0 ff e5 b2 <unknown><br>
>>> 2d520: 00 40 35 91 add x0, x0, #3408<br>
>>> 2d524: ea 0f 00 b9 str w10, [sp, #12]<br>
>>> 2d528: c2 64 ff 97 bl #-158968 <printf@plt><br>
>>> 2d52c: ea 0f 40 b9 ldr w10, [sp, #12]<br>
>>> 2d530: e0 0b 00 b9 str w0, [sp, #8]<br>
>>> 2d534: e0 03 0a 2a mov w0, w10<br>
>>> 2d538: fd 7b 42 a9 ldp x29, x30, [sp, #32]<br>
>>> 2d53c: ff c3 00 91 add sp, sp, #48<br>
>>> 2d540: c0 03 5f d6 ret<br>
>>><br>
>>><br>
>>> Am I compiling the program incorrectly? For reference, here's my clang version<br>
>>><br>
>>> # llvm-project/build-10.x/install/bin/clang --version<br>
>>> [1]<br>
>>> clang version 10.0.1 (git@github.com:llvm/llvm-project.git<br>
>>> a634a80615b1e012f1a61aa0cd1e2e67ef77d0bd)<br>
>>> Target: x86_64-unknown-linux-gnu<br>
>>> Thread model: posix<br>
>>><br>
>>> --<br>
>>> Derrick McKee<br>
>>> Phone: (703) 957-9362<br>
>>> Email: <a href="mailto:derrick.mckee@gmail.com" target="_blank">derrick.mckee@gmail.com</a><br>
>>> _______________________________________________<br>
>>> LLVM Developers mailing list<br>
>>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
><br>
><br>
> --<br>
> --<br>
> Peter<br>
<br>
<br>
<br>
-- <br>
Derrick McKee<br>
Phone: (703) 957-9362<br>
Email: <a href="mailto:derrick.mckee@gmail.com" target="_blank">derrick.mckee@gmail.com</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>