Issue 55411
Summary [s390] integrated assembler miscompiles mvc+clc instructions
Labels new issue
Assignees
Reporter hcahca
    Compiling this simple test program:
```
test:
        mvc     32(8,%r0),.Lsomething
        clc     0(1,%r1),.Lsomething
.Lsomething:
        .quad   0
```
with `clang  --target=s390x-linux-gnu -fintegrated-as -m64 test.S` results in an object file with incorrect relocations for the second displacement of the mvc and clc instructions:
```
> objdump -hdr test.o
Disassembly of section .text:
0000000000000000 <test>:
   0:   d2 07 00 20 00 00       mvc     32(8,%r0),0
                        2: R_390_12     .text+0xc
   6:   d5 00 10 00 00 00       clc     0(1,%r1),0
                        8: R_390_12     .text+0xc
```

Compare this with the result when using gcc/gas `gcc -c test.S`:

```
> objdump -hdr test.o 
Disassembly of section .text:
0000000000000000 <test>:
   0:   d2 07 00 20 00 00       mvc     32(8,%r0),0
                        4: R_390_12     .text+0xc
   6:   d5 00 10 00 00 00       clc     0(1,%r1),0
                        a: R_390_12     .text+0xc
```

FWIW, as reference: this causes a miscompile for the Linux Kernel on s390: https://lore.kernel.org/linux-s390/Ynwh%[email protected]/T/#m57bd178adca225e8822d65d796dbec33c7ac0de6

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to