[Driver] Error for -gsplit-dwarf with RISC-V linker relaxation
authorFangrui Song <i@maskray.me>
Sat, 23 Jul 2022 00:16:41 +0000 (17:16 -0700)
committerFangrui Song <i@maskray.me>
Sat, 23 Jul 2022 00:16:41 +0000 (17:16 -0700)
commit80a4e6fd31a06143b83947785ea3bd5c04344ea6
tree9ae85bf1f4ff550e1eaa6d8585d895ced45275cb
parente03664d40c707017dc5bab16be19d6939b5719d2
[Driver] Error for -gsplit-dwarf with RISC-V linker relaxation

-gsplit-dwarf produces a .dwo file which will not be processed by the linker. If
.dwo files contain relocations, they will not be resolved. Therefore the
practice is that .dwo files do not contain relocations.

Address ranges and location description need to use forms/entry kinds indexing
into .debug_addr (DW_FORM_addrx/DW_RLE_startx_endx/etc), which is currently not
implemented.

There is a difficult-to-read MC error with -gsplit-dwarf with RISC-V for both -mrelax and -mno-relax.
```
% clang --target=riscv64-linux-gnu -g -gsplit-dwarf -c a.c
error: A dwo section may not contain relocations
```

We expect to fix -mno-relax soon, so report a driver error for -mrelax for now.

Link: https://github.com/llvm/llvm-project/issues/56642
Reviewed By: compnerd, kito-cheng

Differential Revision: https://reviews.llvm.org/D130190
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/Clang.h
clang/test/Driver/riscv-features.c