[lld] Support finding pdb files from outputpath (PR #94153)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 04:25:11 PDT 2024


================
@@ -0,0 +1,34 @@
+Replicate this scenario:
+
+$ cat a.c
+struct Foo { int x; };
+int g(struct Foo *p);
+int main() {
+  struct Foo f = {42};
+  return g(&f);
+}
+
+$ cat b.c
+struct Foo { int x; };
+int g(struct Foo *p) { return p->x; }
+
+$ cl -c a.c b.c -Zi -Fdts.pdb
+
+$ lld-link a.obj b.obj -debug -entry:main -nodefaultlib -out:t.exe
+
+RUN: rm -rf %t && mkdir -p %t && mkdir -p %t/lib && cd %t
+
+RUN: yaml2obj %S/Inputs/pdb-type-server-simple-a.yaml -o lib/a.obj
+RUN: yaml2obj %S/Inputs/pdb-type-server-simple-b.yaml -o lib/b.obj
+RUN: llvm-pdbutil yaml2pdb %S/Inputs/pdb-type-server-simple-ts.yaml -pdb ts.pdb
+
+RUN: lld-link lib/a.obj lib/b.obj -debug -entry:main -nodefaultlib -out:t.exe
----------------
aganea wrote:

Can you rather leave the existing test unmodified and add another block after to run your test? I think you could create a %t2 folder and %t2/lib and cp the .obj and the .pdb files from the previous step? Then add another line with `lld-link ...` and `FileCheck -check-prefix=OUTPUT` and then `OUTPUT-NOT: failed to load reference`. You can take inspiration from other tests, such as `pdb-natvis.test`. Except that in your case you could pack all these steps together (mkdir(s), cp, lld-link and the OUTPUT line)

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


More information about the llvm-commits mailing list