[lld] [lld][test] Precommit test for ld -r links with FatLTO PIC objects (PR #92817)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 11:21:59 PDT 2024


================
@@ -4,13 +4,23 @@
 ; RUN: rm -rf %t && split-file %s %t
 
 ;; Ensure that input files contain .llvm.lto section.
-; RUN: llc %t/a-LTO.ll --filetype=obj -o %t/a-fatLTO.o
+; RUN: llc %t/a-LTO.ll --filetype=obj -o %t/a-fatLTO.o --relocation-model=pic
 ; RUN: opt < %t/a-LTO.ll --module-summary -o %t/a-fatLTO.bc
-; RUN: llvm-objcopy --add-section=.llvm.lto=%t/a-fatLTO.bc --set-section-flags=.llvm.lto=exclude %t/a-fatLTO.o
+; RUN: llvm-objcopy --add-section=.llvm.lto=%t/a-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c %t/a-fatLTO.o
----------------
ilovepi wrote:

So, while I'm going to change the test to your preferred format, `LIT_FILTER=` has been a great way to run some subset of tests, and when it fails, I can examine the intermediate outputs by just copying the printed `RUN: ...` command. In the case where there is a directory change at the top of the test, I can't just grab that command and run it without either figuring out which directory to CD into or prepending the correct prefix to every path in the command. To me the directory change is an anti-pattern that blocks a workflow used extensivly by other developers. It was even mentioned recently on discourse when the output from LIT was modified, https://discourse.llvm.org/t/rfc-improving-lits-debug-output/72839.

For me getting something I can copy, like:
```
 /path/to/opt -some-pass -o - < /path/to/test/file | FileCheck /path/to/test/file
```
is really convenient.  While the script you provided seems useful, I'd rather not have to use a script just to run a single shell command that I often want to edit by adding different flags or capturing its output.

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


More information about the llvm-commits mailing list