[PATCH] D154602: [clang][clangd] Don't crash/assert on -gsplit-dwarf=single without output

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 13:00:58 PDT 2023


MaskRay accepted this revision.
MaskRay added inline comments.


================
Comment at: clang/unittests/Driver/ToolChainTest.cpp:371
+TEST(CompilerInvocation, SplitSwarfSingleCrash) {
+  static constexpr const char *Args[] = {"clang", "-gdwarf-4", "-gsplit-dwarf=single", "-c", "foo.cpp"};
+  CreateInvocationOptions CIOpts;
----------------
DmitryPolukhin wrote:
> MaskRay wrote:
> > Without a concrete target triple, the default is used. If the default target triple uses an object file format not supporting -gsplit-dwarf, this will fail.
> Oh, could you please advise how to select right target triple for the test or limit it to the case when triple I specify here is supported? I had issue in the past with triples and it was tricky to select something that makes all llvm bots happy. I added `-target arm-linux-gnueabi` and test seems to be working if only x86 arch is enabled.
`-target ` has been deprecated since Clang 3.4. Use `--target=arm-linux-gnueabi`.

If you just run the driver, you don't need a target in `LLVM_TARGETS_TO_BUILD`.
If you do code generation, `LLVM_TARGETS_TO_BUILD` is needed.
This is tricky, you likely need two build directories to check this...

```
% /tmp/out/custom1/bin/clang --target=aarch64 -c a.cc
error: unable to create target: 'No available targets are compatible with triple "aarch64"'
1 error generated.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154602/new/

https://reviews.llvm.org/D154602



More information about the cfe-commits mailing list