[lld] [LLD][COFF] Add -build-id flag to generate .buildid section. (PR #71433)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 03:10:26 PST 2023


================
@@ -392,10 +392,13 @@ RUN: ld.lld -### foo.o -m i386pep -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_6
 
 RUN: ld.lld -### foo.o -m i386pep 2>&1 | FileCheck -check-prefix=BUILD_ID %s
 RUN: ld.lld -### foo.o -m i386pep --build-id 2>&1 | FileCheck -check-prefix=BUILD_ID %s
-BUILD_ID:-build-id
+BUILD_ID: -build-id
+BUILD_ID-NOT: -build-id:no
----------------
mstorsjo wrote:

Actually, it turns out that this kind of `-NOT` check doesn't work here; as we first match the `-build-id` part above, then we have FileCheck's read cursor starting at `:no`, so it won't match the `-NOT` pattern even if that's what we output. (I tested changing `MinGW/Driver.cpp` to produce the wrong thing here, and it didn't trigger the test case.)

We can't do `BUILD_ID-NOT: :no`, since it will match unrelated `:no` parts in other options further on the command line. So I believe `BUILD_ID: -build-id{{ }}` is the only really safe approach here.


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


More information about the llvm-commits mailing list