Closed Bug 2091523 Opened 15 days ago Closed 7 days ago

`WINCONSOLE` has no effect in directories that set no other `WIN32_EXE_LDFLAGS`

Categories

(Firefox Build System :: General, task)

task

Tracking

(firefox162 fixed)

RESOLVED FIXED
162 Branch
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.

Priority: -- → P5

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

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.

Assignee: nobody → ryanvm
Status: NEW → ASSIGNED
Attachment #9682821 - Attachment description: Bug 2091523 - Build mingw plugin-container, private_browsing and windbgdlg as GUI programs. r?#firefox-build-system-reviewers → Bug 2091523 - Build mingw plugin-container, private_browsing and windbgdlg as GUI programs. r?#firefox-build-system-reviewers,sergesanspaille,yjuglaret
See Also: → 2092728

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.

Component: General → Task Configuration

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.

Priority: P5 → --
Component: Task Configuration → General
See Also: → 2069767
See Also: → 1972782
Pushed by ahochheiden@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3b8e23444429 https://hg.mozilla.org/integration/autoland/rev/135baf041254 Build mingw plugin-container, private_browsing and windbgdlg as GUI programs. r=firefox-build-system-reviewers,yjuglaret,ahochheiden
Status: ASSIGNED → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
Depends on: 1972782
See Also: 1972782 →
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: