Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.15.0
-
None
-
-
2cbeacd2cd1a32fda5ef7705e270c71b2ed3c369 (qt/qtbase/dev) 3fef0e3a71fc0540659f70749a8282bf7820b96d (qt/qtbase/5.15)
Description
According to the MSVC linker /MERGE option documentation, there is no way to specify multiple merge section pairs in single /MERGE option. But it is possible to specify multiple /MERGE options for each merge pair, e.g.:
/MERGE:.mysection1=.text /MERGE:.mysection2=.data
So, /MERGE option is not unique and it can be defined as many times as necessary.
In Visual Studio project settings, in linker configuration "Merge Sections" options is allowed to specify only one merge pair. But it is possible to specify more options manually in additional command line options.
But on generate MSVC project, qmake treat /MERGE as unique option and ignores all it occurrences in QMAKE_LFLAGS except last.
For example, in following configuration /MERGE:.mysection1=.text will be ignored:
msvc:QMAKE_LFLAGS += /MERGE:.mysection1=.text /MERGE:.mysection2=.data
Because qmake overwrite option value every time when option occured:
case 0x341a6b5: // /MERGE:from=to MergeSections = option+7; break;
Possible fix - add all subsequent /MERGE options to additional linker options (msvc_objectmodel.cpp):
case 0x341a6b5: // /MERGE:from=to if (MergeSections.isEmpty()) MergeSections = option+7; else AdditionalOptions += option; break;
Or change MergeSections type to list as it mentioned in variable definition (msvc_objectmodel.h):
QString MergeSections; // Should be list?