`WINCONSOLE` has no effect in directories that set no other `WIN32_EXE_LDFLAGS`
Categories
(Firefox Build System :: General, task)
Tracking
(firefox162 fixed)
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: RyanVM, Assigned: RyanVM)
References
Details
Attachments
(1 external file)
WINCONSOLE is supposed to pick the console or GUI subsystem for a directory's Windows programs (-SUBSYSTEM:CONSOLE/-SUBSYSTEM:WINDOWS on clang-cl, -mconsole/-mwindows on mingw). In a directory whose moz.build sets nothing else in WIN32_EXE_LDFLAGS, the flag never reaches the link line, and the program gets whatever subsystem the linker infers from its entry point.
In TreeMetadataEmitter.emit_from_context, WIN32_EXE_LDFLAGS is copied into the VariablePassthru object only when it is non-empty at that point. The WINCONSOLE handling appends the subsystem flags afterwards, to the context's list. When the list was empty, that list was never handed to the passthru object, so the appended flags are dropped. When the list already had an entry, the passthru object holds the same list and picks them up.
No shipping program shows a wrong subsystem today: the affected ones either use wWinMain, which makes the linker choose GUI anyway, or set it with a /SUBSYSTEM linker pragma. A new GUI program that enters through wmain, sets WINCONSOLE = False and has no other WIN32_EXE_LDFLAGS would silently link as a console program.
Low priority since this is not an active problem and I think that's unlikely to change.
| Assignee | ||
Comment 2•12 days ago
|
||
Taking this now to help avoid behavior changes in bug 2091109 per Yannis' review request.
Try push: https://treeherder.mozilla.org/jobs?repo=try&revision=e4b94ca75c71470d3296d37228572a69b5565c72
| Assignee | ||
Comment 3•12 days ago
|
||
WINCONSOLE now sets the subsystem of every C and C++ Windows program, including in directories that set
nothing else in WIN32_EXE_LDFLAGS. On mingw, private_browsing, windbgdlg and, in non-debug builds,
plugin-container become GUI programs instead of console ones, as their WINCONSOLE = False asks. On clang-cl,
where the linker already picked the same subsystems from the entry points, programs such as crashhelper,
pingsender, private_browsing and the C++ unit tests get subsystem version 10.0, like firefox.exe, instead of
6.0.
Updated•12 days ago
|
Updated•12 days ago
|
Comment 4•12 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Task Configuration' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 5•12 days ago
|
||
The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.
Updated•9 days ago
|
Comment 7•7 days ago
|
||
| bugherder | ||
Updated•3 days ago
|
Description
•