diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h --- a/lld/COFF/Config.h +++ b/lld/COFF/Config.h @@ -248,9 +248,11 @@ uint32_t minorImageVersion = 0; // If changing the default os/subsys version here, update the default in // the MinGW driver accordingly. - uint32_t majorOSVersion = 6; + // Chang the value to 4 to support win-xp + uint32_t majorOSVersion = 4; uint32_t minorOSVersion = 0; - uint32_t majorSubsystemVersion = 6; + // Chang the value to 4 to support win-xp + uint32_t majorSubsystemVersion = 4; uint32_t minorSubsystemVersion = 0; uint32_t timestamp = 0; uint32_t functionPadMin = 0; diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -386,11 +386,12 @@ // Emit the XML. Note that we do *not* verify that the XML attributes are // syntactically correct. This is intentional for link.exe compatibility. - os << "<?xml version=\"1.0\" standalone=\"yes\"?>\n" - << "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\"\n" - << " manifestVersion=\"1.0\">\n"; + // Use microsoft xml to support win-xp. + os << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n" + << "<assembly xmlns='urn:schemas-microsoft-com:asm.v1' " + "manifestVersion='1.0'>\n"; if (config->manifestUAC) { - os << " <trustInfo>\n" + os << " <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n" << " <security>\n" << " <requestedPrivileges>\n" << " <requestedExecutionLevel level=" << config->manifestLevel diff --git a/lld/test/COFF/hello32.test b/lld/test/COFF/hello32.test --- a/lld/test/COFF/hello32.test +++ b/lld/test/COFF/hello32.test @@ -34,11 +34,11 @@ HEADER-NEXT: ImageBase: 0x400000 HEADER-NEXT: SectionAlignment: 4096 HEADER-NEXT: FileAlignment: 512 -HEADER-NEXT: MajorOperatingSystemVersion: 6 +HEADER-NEXT: MajorOperatingSystemVersion: 4 HEADER-NEXT: MinorOperatingSystemVersion: 0 HEADER-NEXT: MajorImageVersion: 0 HEADER-NEXT: MinorImageVersion: 0 -HEADER-NEXT: MajorSubsystemVersion: 6 +HEADER-NEXT: MajorSubsystemVersion: 4 HEADER-NEXT: MinorSubsystemVersion: 0 HEADER-NEXT: SizeOfImage: 20480 HEADER-NEXT: SizeOfHeaders: 1024 diff --git a/lld/test/COFF/manifest.test b/lld/test/COFF/manifest.test --- a/lld/test/COFF/manifest.test +++ b/lld/test/COFF/manifest.test @@ -7,10 +7,9 @@ # RUN: lld-link /manifest /out:%t.exe /entry:main %t.obj # RUN: FileCheck -check-prefix=MANIFEST %s < %t.exe.manifest -MANIFEST: <?xml version="1.0" standalone="yes"?> -MANIFEST: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" -MANIFEST: manifestVersion="1.0"> -MANIFEST: <trustInfo> +MANIFEST: <?xml version='1.0' encoding='UTF-8' standalone='yes'?> +MANIFEST: <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> +MANIFEST: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> MANIFEST: <security> MANIFEST: <requestedPrivileges> MANIFEST: <requestedExecutionLevel level='asInvoker' uiAccess='false'/> @@ -23,10 +22,9 @@ # RUN: /manifestuac:"level='requireAdministrator' uiAccess='true'" %t.obj # RUN: FileCheck -check-prefix=UAC %s < %t.exe.manifest -UAC: <?xml version="1.0" standalone="yes"?> -UAC: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" -UAC: manifestVersion="1.0"> -UAC: <trustInfo> +UAC: <?xml version='1.0' encoding='UTF-8' standalone='yes'?> +UAC: <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> +UAC: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> UAC: <security> UAC: <requestedPrivileges> UAC: <requestedExecutionLevel level='requireAdministrator' uiAccess='true'/> @@ -40,10 +38,9 @@ # RUN: /manifestdependency:"foo='bar'" %t.obj # RUN: FileCheck -check-prefix=DEPENDENCY %s < %t.exe.manifest -DEPENDENCY: <?xml version="1.0" standalone="yes"?> -DEPENDENCY: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" -DEPENDENCY: manifestVersion="1.0"> -DEPENDENCY: <trustInfo> +DEPENDENCY: <?xml version='1.0' encoding='UTF-8' standalone='yes'?> +DEPENDENCY: <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> +DEPENDENCY: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> DEPENDENCY: <security> DEPENDENCY: <requestedPrivileges> DEPENDENCY: <requestedExecutionLevel level='asInvoker' uiAccess='false'/> @@ -61,9 +58,8 @@ # RUN: /manifestdependency:"foo='bar'" %t.obj # RUN: FileCheck -check-prefix=NOUAC %s < %t.exe.manifest -NOUAC: <?xml version="1.0" standalone="yes"?> -NOUAC: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" -NOUAC: manifestVersion="1.0"> +NOUAC: <?xml version='1.0' encoding='UTF-8' standalone='yes'?> +NOUAC: <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> NOUAC: <dependency> NOUAC: <dependentAssembly> NOUAC: <assemblyIdentity foo='bar' /> @@ -74,9 +70,8 @@ # RUN: lld-link /manifest /out:%t.exe /entry:main /manifestuac:no %t.obj # RUN: FileCheck -check-prefix=NOUACNODEP %s < %t.exe.manifest -NOUACNODEP: <?xml version="1.0" standalone="yes"?> -NOUACNODEP: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" -NOUACNODEP: manifestVersion="1.0"> +NOUACNODEP: <?xml version='1.0' encoding='UTF-8' standalone='yes'?> +NOUACNODEP: <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> NOUACNODEP: </assembly> # Several /manifestdependency: flags are naively dedup'd. @@ -87,10 +82,9 @@ # RUN: %t.obj # RUN: FileCheck -check-prefix=SEVERALDEPS %s < %t.exe.manifest -SEVERALDEPS: <?xml version="1.0" standalone="yes"?> -SEVERALDEPS: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" -SEVERALDEPS: manifestVersion="1.0"> -SEVERALDEPS: <trustInfo> +SEVERALDEPS: <?xml version='1.0' encoding='UTF-8' standalone='yes'?> +SEVERALDEPS: <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> +SEVERALDEPS: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> SEVERALDEPS: <security> SEVERALDEPS: <requestedPrivileges> SEVERALDEPS: <requestedExecutionLevel level='asInvoker' uiAccess='false'/> @@ -130,40 +124,43 @@ # RUN: llvm-readobj --coff-resources %t.exe \ # RUN: | FileCheck --check-prefix EMBED %s -EMBED: Data ( -EMBED: 0000: 3C3F786D 6C207665 7273696F 6E3D2231 |<?xml version="1| -EMBED: 0010: 2E302220 7374616E 64616C6F 6E653D22 |.0" standalone="| -EMBED: 0020: 79657322 3F3E0A3C 61737365 6D626C79 |yes"?>.<assembly| -EMBED: 0030: 20786D6C 6E733D22 75726E3A 73636865 | xmlns="urn:sche| -EMBED: 0040: 6D61732D 6D696372 6F736F66 742D636F |mas-microsoft-co| -EMBED: 0050: 6D3A6173 6D2E7631 220A2020 20202020 |m:asm.v1". | -EMBED: 0060: 20202020 6D616E69 66657374 56657273 | manifestVers| -EMBED: 0070: 696F6E3D 22312E30 223E0A20 203C7472 |ion="1.0">. <tr| -EMBED: 0080: 75737449 6E666F3E 0A202020 203C7365 |ustInfo>. <se| -EMBED: 0090: 63757269 74793E0A 20202020 20203C72 |curity>. <r| -EMBED: 00A0: 65717565 73746564 50726976 696C6567 |equestedPrivileg| -EMBED: 00B0: 65733E0A 20202020 20202020 203C7265 |es>. <re| -EMBED: 00C0: 71756573 74656445 78656375 74696F6E |questedExecution| -EMBED: 00D0: 4C657665 6C206C65 76656C3D 27617349 |Level level='asI| -EMBED: 00E0: 6E766F6B 65722720 75694163 63657373 |nvoker' uiAccess| -EMBED: 00F0: 3D276661 6C736527 2F3E0A20 20202020 |='false'/>. | -EMBED: 0100: 203C2F72 65717565 73746564 50726976 | </requestedPriv| -EMBED: 0110: 696C6567 65733E0A 20202020 3C2F7365 |ileges>. </se| -EMBED: 0120: 63757269 74793E0A 20203C2F 74727573 |curity>. </trus| -EMBED: 0130: 74496E66 6F3E0A20 203C6465 70656E64 |tInfo>. <depend| -EMBED: 0140: 656E6379 3E0A2020 20203C64 6570656E |ency>. <depen| -EMBED: 0150: 64656E74 41737365 6D626C79 3E0A2020 |dentAssembly>. | -EMBED: 0160: 20202020 3C617373 656D626C 79496465 | <assemblyIde| -EMBED: 0170: 6E746974 7920666F 6F3D2762 61722720 |ntity foo='bar' | -EMBED: 0180: 2F3E0A20 2020203C 2F646570 656E6465 |/>. </depende| -EMBED: 0190: 6E744173 73656D62 6C793E0A 20203C2F |ntAssembly>. </| -EMBED: 01A0: 64657065 6E64656E 63793E0A 20203C64 |dependency>. <d| -EMBED: 01B0: 6570656E 64656E63 793E0A20 2020203C |ependency>. <| -EMBED: 01C0: 64657065 6E64656E 74417373 656D626C |dependentAssembl| -EMBED: 01D0: 793E0A20 20202020 203C6173 73656D62 |y>. <assemb| -EMBED: 01E0: 6C794964 656E7469 74792062 617A3D27 |lyIdentity baz='| -EMBED: 01F0: 71757578 27202F3E 0A202020 203C2F64 |quux' />. </d| -EMBED: 0200: 6570656E 64656E74 41737365 6D626C79 |ependentAssembly| -EMBED: 0210: 3E0A2020 3C2F6465 70656E64 656E6379 |>. </dependency| -EMBED: 0220: 3E0A3C2F 61737365 6D626C79 3E0A |>.</assembly>.| -EMBED: ) + EMBED: Data ( + EMBED: 0000: 3C3F786D 6C207665 7273696F 6E3D2731 |<?xml version='1| + EMBED: 0010: 2E302720 656E636F 64696E67 3D275554 |.0' encoding='UT| + EMBED: 0020: 462D3827 20737461 6E64616C 6F6E653D |F-8' standalone=| + EMBED: 0030: 27796573 273F3E0A 3C617373 656D626C |'yes'?>.<assembl| + EMBED: 0040: 7920786D 6C6E733D 2775726E 3A736368 |y xmlns='urn:sch| + EMBED: 0050: 656D6173 2D6D6963 726F736F 66742D63 |emas-microsoft-c| + EMBED: 0060: 6F6D3A61 736D2E76 3127206D 616E6966 |om:asm.v1' manif| + EMBED: 0070: 65737456 65727369 6F6E3D27 312E3027 |estVersion='1.0'| + EMBED: 0080: 3E0A2020 3C747275 7374496E 666F2078 |>. <trustInfo x| + EMBED: 0090: 6D6C6E73 3D227572 6E3A7363 68656D61 |mlns="urn:schema| + EMBED: 00A0: 732D6D69 63726F73 6F66742D 636F6D3A |s-microsoft-com:| + EMBED: 00B0: 61736D2E 7633223E 0A202020 203C7365 |asm.v3">. <se| + EMBED: 00C0: 63757269 74793E0A 20202020 20203C72 |curity>. <r| + EMBED: 00D0: 65717565 73746564 50726976 696C6567 |equestedPrivileg| + EMBED: 00E0: 65733E0A 20202020 20202020 203C7265 |es>. <re| + EMBED: 00F0: 71756573 74656445 78656375 74696F6E |questedExecution| + EMBED: 0100: 4C657665 6C206C65 76656C3D 27617349 |Level level='asI| + EMBED: 0110: 6E766F6B 65722720 75694163 63657373 |nvoker' uiAccess| + EMBED: 0120: 3D276661 6C736527 2F3E0A20 20202020 |='false'/>. | + EMBED: 0130: 203C2F72 65717565 73746564 50726976 | </requestedPriv| + EMBED: 0140: 696C6567 65733E0A 20202020 3C2F7365 |ileges>. </se| + EMBED: 0150: 63757269 74793E0A 20203C2F 74727573 |curity>. </trus| + EMBED: 0160: 74496E66 6F3E0A20 203C6465 70656E64 |tInfo>. <depend| + EMBED: 0170: 656E6379 3E0A2020 20203C64 6570656E |ency>. <depen| + EMBED: 0180: 64656E74 41737365 6D626C79 3E0A2020 |dentAssembly>. | + EMBED: 0190: 20202020 3C617373 656D626C 79496465 | <assemblyIde| + EMBED: 01A0: 6E746974 7920666F 6F3D2762 61722720 |ntity foo='bar' | + EMBED: 01B0: 2F3E0A20 2020203C 2F646570 656E6465 |/>. </depende| + EMBED: 01C0: 6E744173 73656D62 6C793E0A 20203C2F |ntAssembly>. </| + EMBED: 01D0: 64657065 6E64656E 63793E0A 20203C64 |dependency>. <d| + EMBED: 01E0: 6570656E 64656E63 793E0A20 2020203C |ependency>. <| + EMBED: 01F0: 64657065 6E64656E 74417373 656D626C |dependentAssembl| + EMBED: 0200: 793E0A20 20202020 203C6173 73656D62 |y>. <assemb| + EMBED: 0210: 6C794964 656E7469 74792062 617A3D27 |lyIdentity baz='| + EMBED: 0220: 71757578 27202F3E 0A202020 203C2F64 |quux' />. </d| + EMBED: 0230: 6570656E 64656E74 41737365 6D626C79 |ependentAssembly| + EMBED: 0240: 3E0A2020 3C2F6465 70656E64 656E6379 |>. </dependency| + EMBED: 0250: 3E0A3C2F 61737365 6D626C79 3E0A |>.</assembly>.| + EMBED: ) diff --git a/lld/test/COFF/manifestinput.test b/lld/test/COFF/manifestinput.test --- a/lld/test/COFF/manifestinput.test +++ b/lld/test/COFF/manifestinput.test @@ -9,7 +9,7 @@ # RUN: -check-prefix TEST_EMBED TEST_EMBED: ResourceTableRVA: 0x2000 -TEST_EMBED-NEXT: ResourceTableSize: 0x2A0 +TEST_EMBED-NEXT: ResourceTableSize: 0x2C8 TEST_EMBED-DAG: Resources [ TEST_EMBED-NEXT: Total Number of Resources: 1 TEST_EMBED-DAG: Number of String Entries: 0 diff --git a/lld/test/COFF/subsystem.test b/lld/test/COFF/subsystem.test --- a/lld/test/COFF/subsystem.test +++ b/lld/test/COFF/subsystem.test @@ -2,9 +2,9 @@ # RUN: %p/Inputs/ret42.obj # RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=CHECK1 %s -CHECK1: MajorOperatingSystemVersion: 6 +CHECK1: MajorOperatingSystemVersion: 4 CHECK1: MinorOperatingSystemVersion: 0 -CHECK1: MajorSubsystemVersion: 6 +CHECK1: MajorSubsystemVersion: 4 CHECK1: MinorSubsystemVersion: 0 CHECK1: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI @@ -37,7 +37,7 @@ CHECK4: MajorOperatingSystemVersion: 1 CHECK4: MinorOperatingSystemVersion: 2 -CHECK4: MajorSubsystemVersion: 6 +CHECK4: MajorSubsystemVersion: 4 CHECK4: MinorSubsystemVersion: 0 # RUN: lld-link /entry:main /out:%t.exe /osversion:1.2 /subsystem:default,3.4 \