Issue 52807
Summary Compiling and linking in one step fails when using `-flto` and `-fuse-ld=lld` for baremetal arm targets.
Labels new issue
Assignees
Reporter StevenvdSchoot
    Compiling for armv7m-none-eabi (or any other baremetal arm target) with lto seems to be possible only when compiling and linking are done in two separate commands. A minimal test case:

test.c:
```c
void _start(void) {
  return;
}
```

Compiling like this works:
```bash
clang -target armv7m-none-eabi -mfloat-abi=soft -nostdlib -flto -c test.c -o test.o
clang -target armv7m-none-eabi -mfloat-abi=soft -nostdlib -flto -fuse-ld=lld test.o -o test.elf
```

Compiling like this fails:
```bash
clang -target armv7m-none-eabi -mfloat-abi=soft -nostdlib -flto -fuse-ld=lld test.c -o test.elf
```
with output:
```
clang-13: error: 'armv7m-none-unknown-eabi': unable to pass LLVM bit-code files to linker
```

This is a problem particularly since meson sanity checks the compiler by compiling and linking using a single command.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to