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 << "\n" - << "\n"; + // Use microsoft xml to support win-xp. + os << "\n" + << "\n"; if (config->manifestUAC) { - os << " \n" + os << " \n" << " \n" << " \n" << " -MANIFEST: -MANIFEST: +MANIFEST: +MANIFEST: +MANIFEST: MANIFEST: MANIFEST: MANIFEST: @@ -23,10 +22,9 @@ # RUN: /manifestuac:"level='requireAdministrator' uiAccess='true'" %t.obj # RUN: FileCheck -check-prefix=UAC %s < %t.exe.manifest -UAC: -UAC: -UAC: +UAC: +UAC: +UAC: UAC: UAC: UAC: @@ -40,10 +38,9 @@ # RUN: /manifestdependency:"foo='bar'" %t.obj # RUN: FileCheck -check-prefix=DEPENDENCY %s < %t.exe.manifest -DEPENDENCY: -DEPENDENCY: -DEPENDENCY: +DEPENDENCY: +DEPENDENCY: +DEPENDENCY: DEPENDENCY: DEPENDENCY: DEPENDENCY: @@ -61,9 +58,8 @@ # RUN: /manifestdependency:"foo='bar'" %t.obj # RUN: FileCheck -check-prefix=NOUAC %s < %t.exe.manifest -NOUAC: -NOUAC: +NOUAC: +NOUAC: NOUAC: NOUAC: NOUAC: @@ -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: -NOUACNODEP: +NOUACNODEP: +NOUACNODEP: NOUACNODEP: # Several /manifestdependency: flags are naively dedup'd. @@ -87,10 +82,9 @@ # RUN: %t.obj # RUN: FileCheck -check-prefix=SEVERALDEPS %s < %t.exe.manifest -SEVERALDEPS: -SEVERALDEPS: -SEVERALDEPS: +SEVERALDEPS: +SEVERALDEPS: +SEVERALDEPS: SEVERALDEPS: SEVERALDEPS: SEVERALDEPS: @@ -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 |.. . . . . | -EMBED: 0100: 203C2F72 65717565 73746564 50726976 | . . . . . | -EMBED: 0160: 20202020 3C617373 656D626C 79496465 | . . . . <| -EMBED: 01C0: 64657065 6E64656E 74417373 656D626C |dependentAssembl| -EMBED: 01D0: 793E0A20 20202020 203C6173 73656D62 |y>. . . ..| -EMBED: ) + EMBED: Data ( + EMBED: 0000: 3C3F786D 6C207665 7273696F 6E3D2731 |.. . . . . | + EMBED: 0130: 203C2F72 65717565 73746564 50726976 | . . . . . | + EMBED: 0190: 20202020 3C617373 656D626C 79496465 | . . . . <| + EMBED: 01F0: 64657065 6E64656E 74417373 656D626C |dependentAssembl| + EMBED: 0200: 793E0A20 20202020 203C6173 73656D62 |y>. . . ..| + 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 \