packed_simd
packed_simd copied to clipboard
assert_instr fails when using lld as the linker
Tried running ./ci/run.sh
, everything ran smoothly until:
failures:
---- api::ops::vector_rotates::u64x8::assert_rotate_left_vpro stdout ----
disassembly for verify::api::ops::vector_rotates::u64x8::assert_rotate_left_vpro::rotate_left_shim:
0: lea -0x3f307(%rip),%rax # 1000 <anon.c3685bac7e5bc7b153e587724ab9a96a.7.llvm.2311252202702433396+0x80>
1: mov 0xbacda(%rip),%rcx # fafe8 <_DYNAMIC+0x248>
2: mov %rax,(%rcx)
3: movq $0x27,0x8(%rcx)
4:
5: vprolq $0xc,%zmm0,%zmm0
6: retq
7: int3
8: int3
9: int3
10: int3
11: int3
12: int3
13: int3
14: int3
15: int3
16: int3
17: int3
18: int3
19: int3
20: int3
21: int3
thread 'api::ops::vector_rotates::u64x8::assert_rotate_left_vpro' panicked at 'instruction found, but the disassembly contains too many instructions: #instructions = 22 >= 22 (limit)', /home/gabriel/.cargo/git/checkouts/stdsimd-64c3bc0ac1e47113/b3bd07b/crates/stdsimd-test/src/lib.rs:467:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
---- api::ops::vector_rotates::u64x8::assert_rotate_right_vpro stdout ----
disassembly for verify::api::ops::vector_rotates::u64x8::assert_rotate_right_vpro::rotate_right_shim:
0: lea -0x3f71d(%rip),%rax # bba <anon.c3685bac7e5bc7b153e587724ab9a96a.5.llvm.2311252202702433396+0x11>
1: mov 0xbad0a(%rip),%rcx # fafe8 <_DYNAMIC+0x248>
2: mov %rax,(%rcx)
3: movq $0x29,0x8(%rcx)
4:
5: vprolq $0x34,%zmm0,%zmm0
6: retq
7: int3
8: int3
9: int3
10: int3
11: int3
12: int3
13: int3
14: int3
15: int3
16: int3
17: int3
18: int3
19: int3
20: int3
21: int3
thread 'api::ops::vector_rotates::u64x8::assert_rotate_right_vpro' panicked at 'instruction found, but the disassembly contains too many instructions: #instructions = 22 >= 22 (limit)', /home/gabriel/.cargo/git/checkouts/stdsimd-64c3bc0ac1e47113/b3bd07b/crates/stdsimd-test/src/lib.rs:467:9
failures:
api::ops::vector_rotates::u64x8::assert_rotate_left_vpro
api::ops::vector_rotates::u64x8::assert_rotate_right_vpro
test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--lib'
+ return
${TARGET}
: x86_64-unknown-linux-gnu
rustc: rustc 1.30.0-nightly (6e0f1cc15 2018-09-05)
That's weird and wrong, the disassembly should have been truncated after the retq
instruction.
Can you post exactly which system are you on? Which linux, which version of objdump
, etc. ?
Do you have any RUSTFLAGS
or .cargo/config
?
The int3
instruction is 1 byte long so it could be used to align the function but... I've never run into this :/
cc @alexcrichton
@gnzlbg AFAIK int $3
is simply the default padding between functions, will trigger a breakpoint when running under a debugger.
Found the issue: I had enabled LLD as my linker globally
linker = "clang"
rustflags = [ "-C", "link-arg=-fuse-ld=lld" ]
Using ld
instead doesn't break the tests.
LLD version: LLD 6.0.1 (compatible with GNU linkers)
, installed from the ArchLinux package repository
objdump version: GNU objdump (GNU Binutils) 2.31.1
I think we should try to fix assert_instr
to work with lld
. Enabling cross-language inlining for sleef will require using lld
as a linker so this is a problem we'll have to solve anyways. I'm renaming this issue.
Odd! It may be the case that ld
doesn't emit informating saying the padding is part of the function whereas LLD does emit that information? This would also be reasonably easy enough to prune in the assert-instr crate as well