[Flang][OpenMP] SPEC CPU 2017 603.bwaves crashes when linked using lld
Using the most recent Flang + OpenMP on AArch64, 603.bwaves (fpspeed) segfaults in a __kmpc_global_thread_num call.
This happens in an OMP PARALLEL DO PRIVATE clause.
Looking at the disassemble, looks like a wrong relocation:
(gdb) disassemble
Dump of assembler code for function __kmpc_global_thread_num@plt:
0x0000aaaaaaac8fe0 <+0>: adrp x16, 0xaaaaaaae9000
0x0000aaaaaaac8fe4 <+4>: ldr x17, [x16, #2752]
=> 0x0000aaaaaaac8fe8 <+8>: add x16, x16, #0xac0
0x0000aaaaaaac8fec <+12>: br x17
It's branching to an invalid address. So I'm not sure if this is an OpenMP or lld bug.
I'm trying to create a small reproducer for this and will update this issue if I can manage that.
Correction: this also fails with GNU ld, but at a different point (much earlier). It is still a wrong relocation, though:
Dump of assembler code for function __kmpc_global_thread_num@plt:
=> 0x0000aaaaaaaab6c0 <+0>: adrp x16, 0xaaaaaaad8000 <[email protected]>
0x0000aaaaaaaab6c4 <+4>: ldr x17, [x16, #48]
0x0000aaaaaaaab6c8 <+8>: add x16, x16, #0x30
0x0000aaaaaaaab6cc <+12>: br x17
603.bwaves_s used to pass. And passes for me with a build from commit 3c6efe5fdbca07ada9a2710d68efdb07064044c2. I have built with -O3 optimisation.
603.bwaves_s used to pass. And passes for me with a build from commit 3c6efe5. I have built with
-O3optimisation.
AArch64 or X86?
AArch64
I'm closing this. It was a linking issue in my environment.