Closed Bug 1576758 Opened 3 months ago Closed 3 months ago

Static Analysis Plugin does not produce a pdb on Windows

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect
Not set

Tracking

(firefox70 fixed)

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: tjr, Assigned: tjr)

Details

Attachments

(1 file)

Looking at the output I found the following:

0:01.61 c:/Users/Tom/.mozbuild/clang/bin/clang-cl.exe -Fohost_FooChecker.obj -c  -Ic:/Users/Tom/.mozbuild/clang/include -std=c++14 -EHs-c- -GR- -D_DEBUG_POINTER_IMPL= -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DUNICODE -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_NEW_ASTMATCHER_NAMES -DHAS_ACCEPTS_IGNORINGPARENIMPCASTS -GR- -EHsc -O2 -DDEBUG=1 -fPIC -Ic:/mozilla-unified/build/clang-plugin -Ic:/mozilla-unified/obj-x86_64-pc-mingw32/build/clang-plugin -Ic:/mozilla-unified/obj-x86_64-pc-mingw32/dist/include -Xclang -MP -Xclang -dependency-file -Xclang .deps/host_FooChecker.obj.pp -Xclang -MT -Xclang host_FooChecker.obj -Ic:/mozilla-unified/obj-x86_64-pc-mingw32/dist/include/nspr c:/mozilla-unified/build/clang-plugin/FooChecker.cpp

 0:01.63 clang-cl: warning: unknown argument ignored in clang-cl: '-std=c++14' [-Wunknown-argument]
 0:01.63 clang-cl: warning: unknown argument ignored in clang-cl: '-fPIC' [-Wunknown-argument]

c:/Users/Tom/.mozbuild/clang/bin/lld-link.exe -NOLOGO -DLL -OUT:clang-plugin.dll host_ArithmeticArgChecker.obj host_AssertAssignmentChecker.obj host_CanRunScriptChecker.obj host_CustomAttributes.obj host_CustomTypeAnnotation.obj host_DanglingOnTemporaryChecker.obj host_DiagnosticsMatcher.obj host_ExplicitImplicitChecker.obj host_ExplicitOperatorBoolChecker.obj host_KungFuDeathGripChecker.obj host_LoadLibraryUsageChecker.obj host_MozCheckAction.obj host_MustOverrideChecker.obj host_MustReturnFromCallerChecker.obj host_MustUseChecker.obj host_NaNExprChecker.obj host_NeedsNoVTableTypeChecker.obj host_NoAddRefReleaseOnReturnChecker.obj host_NoAutoTypeChecker.obj host_NoDuplicateRefCntMemberChecker.obj host_NoExplicitMoveConstructorChecker.obj host_NonMemMovableMemberChecker.obj host_NonMemMovableTemplateArgChecker.obj host_NonParamInsideFunctionDeclChecker.obj host_OverrideBaseCallChecker.obj host_OverrideBaseCallUsageChecker.obj host_ParamTraitsEnumChecker.obj host_RefCountedCopyConstructorChecker.obj host_RefCountedInsideLambdaChecker.obj host_ScopeChecker.obj host_SprintfLiteralChecker.obj host_TrivialCtorDtorChecker.obj host_TrivialDtorChecker.obj host_FooChecker.obj host_VariableUsageHelpers.obj host_ThirdPartyPaths.obj -Ic:/Users/Tom/.mozbuild/clang/include -std=c++14 -EHs-c- -GR- -D_DEBUG_POINTER_IMPL= -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DUNICODE -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_NEW_ASTMATCHER_NAMES -DHAS_ACCEPTS_IGNORINGPARENIMPCASTS -GR- -EHsc -O2 -fPIC -Fdclang-plugin.pdb -LIBPATH:c:/Users/Tom/.mozbuild/clang/lib clangASTMatchers.lib clang.lib -brepro -LIBPATH:'C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\lib\x64' -LIBPATH:'C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\atlmfc\lib\x64' -LIBPATH:'C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64' -LIBPATH:'C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64' -LIBPATH:'C:/PROGRA~2/MIB055~1/2017/COMMUN~1/DIA SDK/lib/amd64'


 0:05.84 lld-link: warning: ignoring unknown argument: -Ic:/Users/Tom/.mozbuild/clang/include
 0:05.84 lld-link: warning: ignoring unknown argument: -std=c++14
 0:05.84 lld-link: warning: ignoring unknown argument: -EHs-c-
 0:05.84 lld-link: warning: ignoring unknown argument: -GR-
 0:05.84 lld-link: warning: ignoring unknown argument: -D_DEBUG_POINTER_IMPL=
 0:05.84 lld-link: warning: ignoring unknown argument: -D_CRT_SECURE_NO_DEPRECATE
 0:05.84 lld-link: warning: ignoring unknown argument: -D_CRT_SECURE_NO_WARNINGS
 0:05.84 lld-link: warning: ignoring unknown argument: -D_CRT_NONSTDC_NO_DEPRECATE
 0:05.84 lld-link: warning: ignoring unknown argument: -D_CRT_NONSTDC_NO_WARNINGS
 0:05.84 lld-link: warning: ignoring unknown argument: -D_SCL_SECURE_NO_DEPRECATE
 0:05.84 lld-link: warning: ignoring unknown argument: -D_SCL_SECURE_NO_WARNINGS
 0:05.84 lld-link: warning: ignoring unknown argument: -DUNICODE
 0:05.84 lld-link: warning: ignoring unknown argument: -D_UNICODE
 0:05.84 lld-link: warning: ignoring unknown argument: -D__STDC_CONSTANT_MACROS
 0:05.84 lld-link: warning: ignoring unknown argument: -D__STDC_FORMAT_MACROS
 0:05.84 lld-link: warning: ignoring unknown argument: -D__STDC_LIMIT_MACROS
 0:05.84 lld-link: warning: ignoring unknown argument: -DHAVE_NEW_ASTMATCHER_NAMES
 0:05.84 lld-link: warning: ignoring unknown argument: -DHAS_ACCEPTS_IGNORINGPARENIMPCASTS
 0:05.84 lld-link: warning: ignoring unknown argument: -GR-
 0:05.84 lld-link: warning: ignoring unknown argument: -EHsc
 0:05.84 lld-link: warning: ignoring unknown argument: -O2
 0:05.84 lld-link: warning: ignoring unknown argument: -fPIC
 0:05.84 lld-link: warning: ignoring unknown argument: -Fdclang-plugin.pdb

I dug into this a bit, and was able to get a pdb successfully made with the attached patch.

However, it doesn't address that other flags (CFLAGS/CXXFLAGS) are being sent to the linker and causing other unknown argument issues. I suspect this is because the static analysis plugin is the only HostSharedLibrary in the tree and not well supported.

-Fd is the parameter accepted by clang. -PDB is the parameter accepted by lld-link. Additionally, to produce a pdb you apparently also need the -DEBUG flag

Pushed by tritter@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/88935a44fe7c
Correct a HostSharedLibrary's link command to correctly output a pdb r=glandium
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.