NativeNt.h depends on code that is unavailable in SpiderMonkey builds
Categories
(Core :: mozglue, defect)
Tracking
()
People
(Reporter: yannis, Unassigned)
Details
mozglue/misc/NativeNt.h contains e.g. our code for parsing PE headers (mozilla::nt::PEHeaders). It lives in mozglue/misc/ but it depends on code that lives in other folders. If we actually include NativeNt.h in a .cpp file that lives in mozglue/misc/ (which I'd like to do in bug 1897479), that results in SpiderMonkey build failures for the following reasons.
First reason: NativeNt.h depends on widget/windows/WinHeaderOnlyUtils.h, which cannot be found in that case. If we move WinHeaderOnlyUtils.h to mozglue/misc/, that's still not enough because it itself depends on xpcom/base/nsWindowsHelpers.h which itself depends on xpcom/base/nsAutoRef.h, and both are not available. Note that the top of WinHeaderOnlyUtils.h claims the following:
/**
* This header is intended for self-contained, header-only, utility code for
* Win32. It may be used outside of xul.dll, in places such as firefox.exe or
* mozglue.dll. If your code creates dependencies on Mozilla libraries, you
* should put it elsewhere.
*/
Second reason: NativeNt.h depends on toolkit/xre/dllservices/mozglue/interceptor/MMPolicies.h and toolkit/xre/dllservices/mozglue/interceptor/TargetFunction.h which are not available in this case. These dependencies are only required for the definition of a single class in NativeNt.h (template <typename MMPolicy> class MOZ_RAII PEExportSection) so it looks like maybe this definition does not belong here and we could move it somewhere else.
If I move nsAutoRef.h, nsWindowsHelpers.h and WinHeaderOnlyUtils.h to mozglue/misc/, remove the dependency on MMPolicies.h and TargetFunction.h as well as the class definition that needs it, and add a #include "mozilla/Unused.h", then I can finally build SpiderMonkey. But I don't know if that would be the correct way to solve this problem.
| Reporter | ||
Comment 1•2 years ago
|
||
Here is an example bad build: https://treeherder.mozilla.org/jobs?revision=1964aeac92a23d0f2cab1fb4fc29e5dd9e9bc7f7&repo=try
For my use case in bug 1897479 I have a workaround which is to guard both the inclusion of NativeNt.h and the definition that uses mozilla::nt::PEHeaders with a #if !defined(IMPL_MFBT). This allows (new) mozglue/misc/WindowsDiagnostics.cpp to include (new) mozglue/misc/WindowsDiagnostics.h without including the dependency on NativeNt.h which is not actually required for WindowsDiagnostics.cpp. Here is a good build using the workaround: https://treeherder.mozilla.org/jobs?revision=4e7d408ecac1f37f453b384bae700b7596442f79&repo=try
Comment 2•2 years ago
|
||
The severity field is not set for this bug.
:glandium, could you have a look please?
For more information, please visit BugBot documentation.
Updated•2 years ago
|
Description
•