[lld] [lld] Warn for missing needed sections by --gdb-index (PR #166626)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 13:08:09 PST 2025


lenary wrote:

Yeah, that guide is good at the higher level, but I can see why you need more guidance :)

I think what we'd want is an assembly + linker test. This would consist of 1 (maybe 2) assembly files, which are assembled with `llvm-mc`, and then linked. These can be written all in the same file using the `split-file` utility, and the approach documented in ["Extra Files"](https://llvm.org/docs/TestingGuide.html#id19) in that document.

The core assertion behind the test would be to invoke LLD, and then run `FileCheck` on its output. `FileCheck` would then check for the warnings in LLD's output. This tends to be done something like:

```
# REQUIRES: <target you chose>

# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=<target you choose> input.s -o input.o

# RUN: ld.lld input.o -o output.exe 2>&1 | FileCheck %s --check-prefix=WARNING --implicit-check-not=warning:

# WARNING: <the text from your warning>

#--- input.s

<contents of your assembly file>

```

It's fine to take a simple C example, and compile it on your own using `clang -S -g file.c -o -` to get some assembly to base your input on - I know assembling dwarf by hand isn't fun/easy.

https://github.com/llvm/llvm-project/pull/166626


More information about the llvm-commits mailing list