https://bugs.llvm.org/show_bug.cgi?id=51161

            Bug ID: 51161
           Summary: `-mattr` should be encoded in the IR for LTO's sake
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedb...@nondot.org
          Reporter: twd2...@gmail.com
                CC: llvm-bugs@lists.llvm.org, smithp...@googlemail.com

Created attachment 25046
  --> https://bugs.llvm.org/attachment.cgi?id=25046&action=edit
The diagnostic information.

When compiling the following code with LTO:

```
$ cat test.c
void _start()
{
    asm volatile (
        ".balign 4\n\t"
        "c.nop\n\t"
        ".balign 4\n\t"
        "c.nop"
    );
}

$ clang -march=rv64imac -O2 -flto -mno-relax -c test.c
$ ld.lld test.o
```

lld fails with `unable to write nop sequence of 2 bytes`.
The diagnostic information is attached.

It looks like to be due to the `HasStdExtC` check failure in
`RISCVAsmBackend::writeNopData`.
And, if I use `ld.lld -mllvm -mattr=+c test.o`, lld can generate proper machine
code.
According to Nick Desaulniers [1], `-mattr` should be encoded in the IR for
LTO's sake.

My LLVM version: commit 1b61d837b9d0 ("[Inline] Add test for PR50589 (NFC)")
[1]
https://lore.kernel.org/linux-riscv/cakwvodmnji0abyuiosfb5cld+g7ycpxk4odupa8gtfgzymx...@mail.gmail.com/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to