From d0baa9a5762a74209d7943d680ae062c2e4ded44 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 26 May 2022 18:27:28 -0700 Subject: [PATCH] add support for arm to --platform (#13120) * merge * temp * temp * update tests * wrong api * proj tweak * Oops * fantomas --- src/Compiler/AbstractIL/il.fs | 2 + src/Compiler/AbstractIL/il.fsi | 2 + src/Compiler/AbstractIL/ilread.fs | 2 + src/Compiler/AbstractIL/ilwrite.fs | 267 +++++++++--------- src/Compiler/AbstractIL/ilwritepdb.fs | 1 - src/Compiler/Driver/CompilerImports.fs | 2 + src/Compiler/Driver/CompilerOptions.fs | 2 + src/Compiler/Driver/CreateILModule.fs | 4 +- src/Compiler/FSComp.txt | 4 +- src/Compiler/Service/ServiceLexing.fsi | 1 - src/Compiler/xlf/FSComp.txt.cs.xlf | 8 +- src/Compiler/xlf/FSComp.txt.de.xlf | 8 +- src/Compiler/xlf/FSComp.txt.es.xlf | 8 +- src/Compiler/xlf/FSComp.txt.fr.xlf | 8 +- src/Compiler/xlf/FSComp.txt.it.xlf | 8 +- src/Compiler/xlf/FSComp.txt.ja.xlf | 8 +- src/Compiler/xlf/FSComp.txt.ko.xlf | 8 +- src/Compiler/xlf/FSComp.txt.pl.xlf | 8 +- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 8 +- src/Compiler/xlf/FSComp.txt.ru.xlf | 8 +- src/Compiler/xlf/FSComp.txt.tr.xlf | 8 +- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 8 +- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 8 +- src/FSharp.Build/Fsc.fs | 2 + .../CompilerOptions/fsc/platform.fs | 36 +-- .../EmittedIL/Platform/AssemblyNameForDll.fs | 7 + .../EmittedIL/Platform/AssemblyNameForExe.fs | 7 + .../EmittedIL/Platform/Platform.fs | 136 +++++++++ .../EmittedIL/Platform/PlatformedDll.fs | 3 + .../EmittedIL/Platform/PlatformedExe.fs | 1 + .../FSharp.Compiler.ComponentTests.fsproj | 24 +- tests/FSharp.Test.Utilities/Compiler.fs | 2 +- tests/FSharp.Test.Utilities/ILChecker.fs | 8 + tests/fsharp/test.fs | 54 ++++ tests/fsharp/test.fsx | 3 + .../fsc/help/help40.437.1033.bsl | 6 +- 36 files changed, 447 insertions(+), 233 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForDll.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForExe.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/Platform.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedDll.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedExe.fs create mode 100644 tests/fsharp/test.fs create mode 100644 tests/fsharp/test.fsx diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 7cd377cad3d..3afa9326f47 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -1114,6 +1114,8 @@ type ILPlatform = | X86 | AMD64 | IA64 + | ARM + | ARM64 type ILSourceDocument = { diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index d205162b991..55c713968e2 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -25,6 +25,8 @@ type ILPlatform = | X86 | AMD64 | IA64 + | ARM + | ARM64 /// Debug info. Values of type "source" can be attached at sequence /// points and some other locations. diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 6ec7cec7c1c..022d5eeb839 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -4741,7 +4741,9 @@ let openPEFileReader (fileName, pefile: BinaryFile, pdbDirPath, noFileOnDisk) = let platform = match machine with | 0x8664 -> Some AMD64 + | 0xaa64 -> Some ARM64 | 0x200 -> Some IA64 + | 0x1c0 -> Some ARM | _ -> Some X86 let sectionHeadersStartPhysLoc = peOptionalHeaderPhysLoc + headerSizeOpt diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index 988e21c1d13..61f02d8cc0d 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -3875,13 +3875,16 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe let os = new BinaryWriter(stream, System.Text.Encoding.UTF8) - let imageBaseReal = modul.ImageBase // FIXED CHOICE - let alignVirt = modul.VirtualAlignment // FIXED CHOICE - let alignPhys = modul.PhysicalAlignment // FIXED CHOICE + let imageBaseReal = modul.ImageBase // FIXED CHOICE + let alignVirt = modul.VirtualAlignment // FIXED CHOICE + let alignPhys = modul.PhysicalAlignment // FIXED CHOICE let isItanium = modul.Platform = Some IA64 - - let numSections = 3 // .text, .sdata, .reloc + let isItaniumOrAMD = match modul.Platform with | Some IA64 | Some AMD64 -> true | _ -> false + let hasEntryPointStub = match modul.Platform with | Some ARM64 | Some ARM -> false | _ -> true + let numSections = + if hasEntryPointStub then 3 // .text, .sdata, .reloc + else 2 // .text, .sdata // HEADERS let next = 0x0 @@ -3889,26 +3892,13 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe let headerAddr = next let next = headerAddr - let msdosHeaderSize = 0x80 - let msdosHeaderChunk, next = chunk msdosHeaderSize next - - let peSignatureSize = 0x04 - let peSignatureChunk, next = chunk peSignatureSize next - - let peFileHeaderSize = 0x14 - let peFileHeaderChunk, next = chunk peFileHeaderSize next - - let peOptionalHeaderSize = if modul.Is64Bit then 0xf0 else 0xe0 - let peOptionalHeaderChunk, next = chunk peOptionalHeaderSize next - - let textSectionHeaderSize = 0x28 - let textSectionHeaderChunk, next = chunk textSectionHeaderSize next - - let dataSectionHeaderSize = 0x28 - let dataSectionHeaderChunk, next = chunk dataSectionHeaderSize next - - let relocSectionHeaderSize = 0x28 - let relocSectionHeaderChunk, next = chunk relocSectionHeaderSize next + let msdosHeaderChunk, next = chunk 0x80 next + let peSignatureChunk, next = chunk 0x04 next + let peFileHeaderChunk, next = chunk 0x14 next + let peOptionalHeaderChunk, next = chunk (if modul.Is64Bit then 0xf0 else 0xe0) next + let textSectionHeaderChunk, next = chunk 0x28 next + let dataSectionHeaderChunk, next = chunk 0x28 next + let relocSectionHeaderChunk, next = if hasEntryPointStub then chunk 0x28 next else nochunk next let headerSize = next - headerAddr let nextPhys = align alignPhys (headerSectionPhysLoc + headerSize) @@ -3921,7 +3911,8 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe let textSectionAddr = next let next = textSectionAddr - let importAddrTableChunk, next = chunk 0x08 next + // IAT not for ARM + let importAddrTableChunk, next = if hasEntryPointStub then chunk 0x08 next else nochunk next let cliHeaderPadding = (if isItanium then (align 16 next) else next) - next let next = next + cliHeaderPadding let cliHeaderChunk, next = chunk 0x48 next @@ -3974,17 +3965,15 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe let vtfixupsChunk, next = nochunk next // Note: only needed for mixed mode assemblies let importTableChunkPrePadding = (if isItanium then (align 16 next) else next) - next let next = next + importTableChunkPrePadding - let importTableChunk, next = chunk 0x28 next - let importLookupTableChunk, next = chunk 0x14 next - let importNameHintTableChunk, next = chunk 0x0e next - let mscoreeStringChunk, next = chunk 0x0c next + let importTableChunk, next = if hasEntryPointStub then chunk 0x28 next else nochunk next + let importLookupTableChunk, next = if hasEntryPointStub then chunk 0x14 next else nochunk next + let importNameHintTableChunk, next = if hasEntryPointStub then chunk 0x0e next else nochunk next + let mscoreeStringChunk, next = if hasEntryPointStub then chunk 0x0c next else nochunk next - let next = align 0x10 (next + 0x05) - 0x05 + let next = if hasEntryPointStub then align 0x10 (next + 0x05) - 0x05 else next let importTableChunk = { addr=importTableChunk.addr; size = next - importTableChunk.addr} - let importTableChunkPadding = importTableChunk.size - (0x28 + 0x14 + 0x0e + 0x0c) - - let next = next + 0x03 - let entrypointCodeChunk, next = chunk 0x06 next + let importTableChunkPadding = if hasEntryPointStub then importTableChunk.size - (0x28 + 0x14 + 0x0e + 0x0c) else importTableChunk.size + let entrypointCodeChunk, next = if hasEntryPointStub then chunk 0x06 (next + 0x03) else nochunk next let globalpointerCodeChunk, next = chunk (if isItanium then 0x8 else 0x0) next let pdbInfoOpt = @@ -4084,13 +4073,13 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe // .RELOC SECTION base reloc table: 0x0c size let relocSectionPhysLoc = nextPhys - let relocSectionAddr = next - let baseRelocTableChunk, next = chunk 0x0c next + let relocSectionAddr = if hasEntryPointStub then next else 0x00 + let baseRelocTableChunk, next = if hasEntryPointStub then chunk 0x0c next else nochunk next - let relocSectionSize = next - relocSectionAddr - let nextPhys = align alignPhys (relocSectionPhysLoc + relocSectionSize) - let relocSectionPhysSize = nextPhys - relocSectionPhysLoc - let next = align alignVirt (relocSectionAddr + relocSectionSize) + let relocSectionSize = if hasEntryPointStub then next - relocSectionAddr else 0x00 + let nextPhys = if hasEntryPointStub then align alignPhys (relocSectionPhysLoc + relocSectionSize) else nextPhys + let relocSectionPhysSize = if hasEntryPointStub then nextPhys - relocSectionPhysLoc else 0x00 + let next = if hasEntryPointStub then align alignVirt (relocSectionAddr + relocSectionSize) else align alignVirt next // Now we know where the data section lies we can fix up the // references into the data section from the metadata tables. @@ -4144,12 +4133,12 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe write (Some peFileHeaderChunk.addr) os "pe file header" [| |] - if (modul.Platform = Some AMD64) then - writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 - elif isItanium then - writeInt32AsUInt16 os 0x200 - else - writeInt32AsUInt16 os 0x014c // Machine - IMAGE_FILE_MACHINE_I386 + match modul.Platform with + | Some AMD64 -> writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 + | Some IA64 -> writeInt32AsUInt16 os 0x200 // Machine - IMAGE_FILE_MACHINE_IA64 + | Some ARM64 -> writeInt32AsUInt16 os 0xaa64 // Machine - IMAGE_FILE_MACHINE_ARM64 + | Some ARM -> writeInt32AsUInt16 os 0x1c0 // Machine - IMAGE_FILE_MACHINE_ARM + | _ -> writeInt32AsUInt16 os 0x014c // Machine - IMAGE_FILE_MACHINE_I386 writeInt32AsUInt16 os numSections @@ -4187,37 +4176,35 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe writeInt32 os 0x00 // Pointer to Symbol Table Always 0 // 00000090 writeInt32 os 0x00 // Number of Symbols Always 0 - writeInt32AsUInt16 os peOptionalHeaderSize // Size of the optional header, the format is described below. + writeInt32AsUInt16 os peOptionalHeaderChunk.size // Format is described below. - // 64bit: IMAGE_FILE_32BIT_MACHINE ||| IMAGE_FILE_LARGE_ADDRESS_AWARE + // 64bit: IMAGE_FILE_LARGE_ADDRESS_AWARE // 32bit: IMAGE_FILE_32BIT_MACHINE - // Yes, 32BIT_MACHINE is set for AMD64... - let iMachineCharacteristic = match modul.Platform with | Some IA64 -> 0x20 | Some AMD64 -> 0x0120 | _ -> 0x0100 + let iMachineCharacteristic = match modul.Platform with | Some IA64 | Some AMD64 | Some ARM64 -> 0x20 | _ -> 0x0100 - writeInt32AsUInt16 os ((if isDll then 0x2000 else 0x0000) ||| 0x0002 ||| 0x0004 ||| 0x0008 ||| iMachineCharacteristic) + writeInt32AsUInt16 os ((if isDll then 0x2000 else 0x0000) ||| 0x0002 ||| iMachineCharacteristic) // Now comes optional header - let peOptionalHeaderByte = peOptionalHeaderByteByCLRVersion desiredMetadataVersion write (Some peOptionalHeaderChunk.addr) os "pe optional header" [| |] if modul.Is64Bit then - writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit + writeInt32AsUInt16 os 0x020B // Magic number is 0x020B for 64-bit else - writeInt32AsUInt16 os 0x010b // Always 0x10B (see Section 23.1). - writeInt32AsUInt16 os peOptionalHeaderByte // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 - writeInt32 os textSectionPhysSize // Size of the code (text) section, or the sum of all code sections if there are multiple sections. + writeInt32AsUInt16 os 0x010b // Always 0x10B (see Section 23.1). + writeInt32AsUInt16 os peOptionalHeaderByte // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8 + writeInt32 os textSectionPhysSize // Size of the code (text) section, or the sum of all code sections if there are multiple sections. // 000000a0 - writeInt32 os dataSectionPhysSize // Size of the initialized data section - writeInt32 os 0x00 // Size of the uninitialized data section - writeInt32 os entrypointCodeChunk.addr // RVA of entry point, needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 - writeInt32 os textSectionAddr // e.g. 0x0002000 + writeInt32 os dataSectionPhysSize // Size of the initialized data section + writeInt32 os 0x00 // Size of the uninitialized data section + writeInt32 os entrypointCodeChunk.addr // RVA of entry point, needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 + writeInt32 os textSectionAddr // e.g. 0x0002000 // 000000b0 if modul.Is64Bit then - writeInt64 os (int64 imageBaseReal) // REVIEW: For 64-bit, we should use a 64-bit image base + writeInt64 os (int64 imageBaseReal) else - writeInt32 os dataSectionAddr // e.g. 0x0000c000 - writeInt32 os imageBaseReal // Image Base Always 0x400000 (see Section 23.1). - QUERY : no it's not always 0x400000, e.g. 0x034f0000 + writeInt32 os dataSectionAddr // e.g. 0x0000c000 + writeInt32 os (int32 imageBaseReal) // Image Base Always 0x400000 (see Section 23.1). - QUERY : no it's not always 0x400000, e.g. 0x034f0000 writeInt32 os alignVirt // Section Alignment Always 0x2000 (see Section 23.1). writeInt32 os alignPhys // File Alignment Either 0x200 or 0x1000. @@ -4337,21 +4324,22 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x40uy |] // Characteristics Flags: IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA - write (Some relocSectionHeaderChunk.addr) os "reloc section header" [| |] + if hasEntryPointStub then + write (Some relocSectionHeaderChunk.addr) os "reloc section header" [| |] // 000001a0 - writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" - writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. - writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section. + writeBytes os [| 0x2euy; 0x72uy; 0x65uy; 0x6cuy; 0x6fuy; 0x63uy; 0x00uy; 0x00uy; |] // ".reloc\000\000" + writeInt32 os relocSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. + writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section. // 000001b0 - writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes - writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. + writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes + writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. // 000001b8 - writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. - writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). + writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. + writeInt32 os 0x00 // PointerToLineNumbers Always 0 (see Section 23.1). // 000001c0 - writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. - writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | + writeInt32AsUInt16 os 0x00 // NumberOfRelocations Number of relocations, set to 0 if unused. + writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). + writeBytes os [| 0x40uy; 0x00uy; 0x00uy; 0x42uy |] // Characteristics Flags: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | writePadding os "pad to text begin" (textSectionPhysLoc - headerSize) @@ -4360,12 +4348,12 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe let textV2P v = v - textSectionAddr + textSectionPhysLoc // e.g. 0x0200 - write (Some (textV2P importAddrTableChunk.addr)) os "import addr table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says + if hasEntryPointStub then + write (Some (textV2P importAddrTableChunk.addr)) os "import addr table" [| |] + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 // QUERY 4 bytes of zeros not 2 like ECMA 24.3.1 says // e.g. 0x0208 - let flags = (if modul.IsILOnly then 0x01 else 0x00) ||| (if modul.Is32Bit then 0x02 else 0x00) ||| @@ -4413,50 +4401,51 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe write (Some (textV2P rawdataChunk.addr)) os "raw data" [| |] writeBytes os data - writePadding os "start of import table" importTableChunkPrePadding - - // vtfixups would go here - write (Some (textV2P importTableChunk.addr)) os "import table" [| |] - - writeInt32 os importLookupTableChunk.addr - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os mscoreeStringChunk.addr - writeInt32 os importAddrTableChunk.addr - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - - write (Some (textV2P importLookupTableChunk.addr)) os "import lookup table" [| |] - writeInt32 os importNameHintTableChunk.addr - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - writeInt32 os 0x00 - - - write (Some (textV2P importNameHintTableChunk.addr)) os "import name hint table" [| |] - // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. - // Shall _CorExeMain a .exe file _CorDllMain for a .dll file. - if isDll then - writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy ; 0x6fuy; 0x72uy; 0x44uy; 0x6cuy; 0x6cuy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - else - writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy; 0x6fuy; 0x72uy; 0x45uy; 0x78uy; 0x65uy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] + if hasEntryPointStub then + writePadding os "start of import table" importTableChunkPrePadding + + // vtfixups would go here + write (Some (textV2P importTableChunk.addr)) os "import table" [| |] + + writeInt32 os importLookupTableChunk.addr + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os mscoreeStringChunk.addr + writeInt32 os importAddrTableChunk.addr + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + + write (Some (textV2P importLookupTableChunk.addr)) os "import lookup table" [| |] + writeInt32 os importNameHintTableChunk.addr + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + writeInt32 os 0x00 + + + write (Some (textV2P importNameHintTableChunk.addr)) os "import name hint table" [| |] + // Two zero bytes of hint, then Case sensitive, null-terminated ASCII string containing name to import. + // Shall _CorExeMain a .exe file _CorDllMain for a .dll file. + if isDll then + writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy ; 0x6fuy; 0x72uy; 0x44uy; 0x6cuy; 0x6cuy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] + else + writeBytes os [| 0x00uy; 0x00uy; 0x5fuy; 0x43uy; 0x6fuy; 0x72uy; 0x45uy; 0x78uy; 0x65uy; 0x4duy; 0x61uy; 0x69uy; 0x6euy; 0x00uy |] - write (Some (textV2P mscoreeStringChunk.addr)) os "mscoree string" - [| 0x6duy; 0x73uy; 0x63uy; 0x6fuy ; 0x72uy; 0x65uy ; 0x65uy; 0x2euy ; 0x64uy; 0x6cuy ; 0x6cuy; 0x00uy ; |] + write (Some (textV2P mscoreeStringChunk.addr)) os "mscoree string" + [| 0x6duy; 0x73uy; 0x63uy; 0x6fuy ; 0x72uy; 0x65uy ; 0x65uy; 0x2euy ; 0x64uy; 0x6cuy ; 0x6cuy; 0x00uy ; |] - writePadding os "end of import tab" importTableChunkPadding + writePadding os "end of import tab" importTableChunkPadding - writePadding os "head of entrypoint" 0x03 - let ep = (imageBaseReal + textSectionAddr) - write (Some (textV2P entrypointCodeChunk.addr)) os " entrypoint code" - [| 0xFFuy; 0x25uy; (* x86 Instructions for entry *) b0 ep; b1 ep; b2 ep; b3 ep |] - if isItanium then - write (Some (textV2P globalpointerCodeChunk.addr)) os " itanium global pointer" - [| 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy |] + writePadding os "head of entrypoint" 0x03 + let ep = (imageBaseReal + textSectionAddr) + write (Some (textV2P entrypointCodeChunk.addr)) os " entrypoint code" + [| 0xFFuy; 0x25uy; (* x86 Instructions for entry *) b0 ep; b1 ep; b2 ep; b3 ep |] + if isItanium then + write (Some (textV2P globalpointerCodeChunk.addr)) os " itanium global pointer" + [| 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy; 0x0uy |] if options.pdbfile.IsSome then write (Some (textV2P debugDirectoryChunk.addr)) os "debug directory" (Array.create debugDirectoryChunk.size 0x0uy) @@ -4484,26 +4473,26 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe writePadding os "end of .rsrc" (relocSectionPhysLoc - dataSectionPhysLoc - dataSectionSize) // RELOC SECTION + if hasEntryPointStub then + // See ECMA 24.3.2 + let relocV2P v = v - relocSectionAddr + relocSectionPhysLoc + + let entrypointFixupAddr = entrypointCodeChunk.addr + 0x02 + let entrypointFixupBlock = (entrypointFixupAddr / 4096) * 4096 + let entrypointFixupOffset = entrypointFixupAddr - entrypointFixupBlock + let reloc = (if isItaniumOrAMD then 0xA000 (* IMAGE_REL_BASED_DIR64 *) else 0x3000 (* IMAGE_REL_BASED_HIGHLOW *)) ||| entrypointFixupOffset + // For the itanium, you need to set a relocation entry for the global pointer + let reloc2 = + if not isItanium then + 0x0 + else + 0xA000 ||| (globalpointerCodeChunk.addr - ((globalpointerCodeChunk.addr / 4096) * 4096)) - // See ECMA 24.3.2 - let relocV2P v = v - relocSectionAddr + relocSectionPhysLoc - - let entrypointFixupAddr = entrypointCodeChunk.addr + 0x02 - let entrypointFixupBlock = (entrypointFixupAddr / 4096) * 4096 - let entrypointFixupOffset = entrypointFixupAddr - entrypointFixupBlock - let reloc = (if modul.Is64Bit then 0xA000 (* IMAGE_REL_BASED_DIR64 *) else 0x3000 (* IMAGE_REL_BASED_HIGHLOW *)) ||| entrypointFixupOffset - // For the itanium, you need to set a relocation entry for the global pointer - let reloc2 = - if not isItanium then - 0x0 - else - 0xA000 ||| (globalpointerCodeChunk.addr - ((globalpointerCodeChunk.addr / 4096) * 4096)) - - write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" - [| b0 entrypointFixupBlock; b1 entrypointFixupBlock; b2 entrypointFixupBlock; b3 entrypointFixupBlock - 0x0cuy; 0x00uy; 0x00uy; 0x00uy - b0 reloc; b1 reloc - b0 reloc2; b1 reloc2; |] + write (Some (relocV2P baseRelocTableChunk.addr)) os "base reloc table" + [| b0 entrypointFixupBlock; b1 entrypointFixupBlock; b2 entrypointFixupBlock; b3 entrypointFixupBlock + 0x0cuy; 0x00uy; 0x00uy; 0x00uy + b0 reloc; b1 reloc + b0 reloc2; b1 reloc2; |] writePadding os "end of .reloc" (imageEndSectionPhysLoc - relocSectionPhysLoc - relocSectionSize) pdbData, pdbInfoOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings diff --git a/src/Compiler/AbstractIL/ilwritepdb.fs b/src/Compiler/AbstractIL/ilwritepdb.fs index 0a4a5b53794..df3ff04764c 100644 --- a/src/Compiler/AbstractIL/ilwritepdb.fs +++ b/src/Compiler/AbstractIL/ilwritepdb.fs @@ -53,7 +53,6 @@ type BlobBuildingStream() = override _.Read(_buffer: byte array, _offset: int, _count: int) = raise (NotSupportedException()) - override _.SetLength(_value: int64) = raise (NotSupportedException()) override val Position = 0L with get, set diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 9acec5b6649..21604212b79 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -405,6 +405,8 @@ type TcConfig with | None -> "MSIL" | Some X86 -> "x86" | Some AMD64 -> "amd64" + | Some ARM -> "arm" + | Some ARM64 -> "arm64" | Some IA64 -> "ia64" try diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 681d6fa92f1..1d211eee26a 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -708,6 +708,8 @@ let outputFileFlagsFsc (tcConfigB: TcConfigBuilder) = match s with | "x86" -> Some X86 | "x64" -> Some AMD64 + | "arm" -> Some ARM + | "arm64" -> Some ARM64 | "Itanium" -> Some IA64 | "anycpu32bitpreferred" -> tcConfigB.prefer32Bit <- true diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index c510fcca310..5cb00a7f215 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -487,8 +487,8 @@ module MainModuleBuilder = ImageBase = (match tcConfig.baseAddress with None -> 0x00400000l | Some b -> b) IsDLL=(tcConfig.target = CompilerTarget.Dll || tcConfig.target=CompilerTarget.Module) Platform = tcConfig.platform - Is32Bit=(match tcConfig.platform with Some X86 -> true | _ -> false) - Is64Bit=(match tcConfig.platform with Some AMD64 | Some IA64 -> true | _ -> false) + Is32Bit=(match tcConfig.platform with Some X86 | Some ARM -> true | _ -> false) + Is64Bit=(match tcConfig.platform with Some AMD64 | Some IA64 | Some ARM64 -> true | _ -> false) Is32BitPreferred = if tcConfig.prefer32Bit && not tcConfig.target.IsExe then (error(Error(FSComp.SR.invalidPlatformTarget(), rangeCmdArgs))) else tcConfig.prefer32Bit CustomAttrsStored= storeILCustomAttrs diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index d59eaf4ff53..513117632cc 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -850,7 +850,7 @@ optsPublicSign,"Public-sign the assembly using only the public portion of the st optsWriteXml,"Write the xmldoc of the assembly to the given file" optsStrongKeyFile,"Specify a strong name key file" optsStrongKeyContainer,"Specify a strong name key container" -optsPlatform,"Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu." +optsPlatform,"Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu." optsNoOpt,"Only include optimization information essential for implementing inlined constructs. Inhibits cross-module inlining but improves binary compatibility." optsNoInterface,"Don't add a resource to the generated assembly containing F#-specific metadata" optsSig,"Print the inferred interface of the assembly to a file" @@ -917,7 +917,7 @@ optsHelpBannerMisc,"- MISCELLANEOUS -" optsHelpBannerLanguage,"- LANGUAGE -" optsHelpBannerErrsAndWarns,"- ERRORS AND WARNINGS -" 1063,optsUnknownArgumentToTheTestSwitch,"Unknown --test argument: '%s'" -1064,optsUnknownPlatform,"Unrecognized platform '%s', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" +1064,optsUnknownPlatform,"Unrecognized platform '%s', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu." 1065,optsUnknownChecksumAlgorithm,"Algorithm '%s' is not supported" optsInternalNoDescription,"The command-line option '%s' is for test purposes only" optsDCLONoDescription,"The command-line option '%s' has been deprecated" diff --git a/src/Compiler/Service/ServiceLexing.fsi b/src/Compiler/Service/ServiceLexing.fsi index df1dfdde294..5e2e5a9732d 100755 --- a/src/Compiler/Service/ServiceLexing.fsi +++ b/src/Compiler/Service/ServiceLexing.fsi @@ -6,7 +6,6 @@ open System open System.Threading open FSharp.Compiler open FSharp.Compiler.Text - #nowarn "57" /// Represents encoded information for the end-of-line continuation of lexing diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 92860a2902f..d0a995aa3b0 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Omezuje platformy, na kterých je možné tento kód spustit: x86, Itanium, x64, anycpu32bitpreferred a anycpu. Výchozí je anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Omezuje platformy, na kterých je možné tento kód spustit: x86, Itanium, x64, anycpu32bitpreferred a anycpu. Výchozí je anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Nerozpoznaná platforma {0}. Platné hodnoty jsou x86, x64, Itanium, anycpu32bitpreferred a anycpu. + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Nerozpoznaná platforma {0}. Platné hodnoty jsou x86, x64, Itanium, anycpu32bitpreferred a anycpu. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 22bd16c63c3..57d1e5450ea 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Schränken Sie ein, auf welchen Plattformen dieser Code ausgeführt werden kann: "x86", "Itanium", "x64", "anycpu32bitpreferred" oder "anycpu". Der Standard ist "anycpu". + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Schränken Sie ein, auf welchen Plattformen dieser Code ausgeführt werden kann: "x86", "Itanium", "x64", "anycpu32bitpreferred" oder "anycpu". Der Standard ist "anycpu". @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Unbekannte Plattform "{0}", gültige Werte sind "x86", "x64", "Itanium", "anycpu32bitpreferred" und "anycpu". + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Unbekannte Plattform "{0}", gültige Werte sind "x86", "x64", "Itanium", "anycpu32bitpreferred" und "anycpu". diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 4dc904402bf..6a59b872c1b 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Limitar las plataformas en las que se puede ejecutar este código: x86, Itanium, x64, anycpu32bitpreferred o anycpu. El valor predeterminado es anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Limitar las plataformas en las que se puede ejecutar este código: x86, Itanium, x64, anycpu32bitpreferred o anycpu. El valor predeterminado es anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Plataforma '{0}' no reconocida. Los valores válidos son 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' y 'anycpu' + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Plataforma '{0}' no reconocida. Los valores válidos son 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' y 'anycpu' diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 0c131e6353c..7b64cc5b780 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Limiter les plateformes sur lesquelles ce code peut s'exécuter : x86, Itanium, x64, anycpu32bitpreferred ou anycpu. La valeur par défaut est anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Limiter les plateformes sur lesquelles ce code peut s'exécuter : x86, Itanium, x64, anycpu32bitpreferred ou anycpu. La valeur par défaut est anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Plateforme '{0}' non reconnue, les valeurs valides sont 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' et 'anycpu' + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Plateforme '{0}' non reconnue, les valeurs valides sont 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' et 'anycpu' diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 5a6035a7014..8a36ec3b730 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Limita le piattaforme in cui è possibile eseguire il codice: x86, Itanium, x64, anycpu32bitpreferred o anycpu. Il valore predefinito è anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Limita le piattaforme in cui è possibile eseguire il codice: x86, Itanium, x64, anycpu32bitpreferred o anycpu. Il valore predefinito è anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Piattaforma '{0}' non riconosciuta. I valori validi sono 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' e 'anycpu' + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Piattaforma '{0}' non riconosciuta. I valori validi sono 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' e 'anycpu' diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index d8f1be72618..2509bc7585a 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - このコードが実行されるプラットフォームの制限: x86、Itanium、x64、anycpu32bitpreferred、または anycpu。既定は anycpu です。 + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + このコードが実行されるプラットフォームの制限: x86、Itanium、x64、anycpu32bitpreferred、または anycpu。既定は anycpu です。 @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - 認識されないプラットフォーム '{0}'。有効な値は 'x86'、'x64'、'Itanium'、'anycpu32bitpreferred'、および 'anycpu' です。 + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + 認識されないプラットフォーム '{0}'。有効な値は 'x86'、'x64'、'Itanium'、'anycpu32bitpreferred'、および 'anycpu' です。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 0cd7929d6ff..8f209c3ada1 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - 이 코드를 실행할 수 있는 플랫폼을 x86, Itanium, x64, anycpu32bitpreferred 또는 anycpu로 제한합니다. 기본값은 anycpu입니다. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + 이 코드를 실행할 수 있는 플랫폼을 x86, Itanium, x64, anycpu32bitpreferred 또는 anycpu로 제한합니다. 기본값은 anycpu입니다. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - 인식할 수 없는 플랫폼 '{0}'입니다. 올바른 값은 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' 및 'anycpu'입니다. + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + 인식할 수 없는 플랫폼 '{0}'입니다. 올바른 값은 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' 및 'anycpu'입니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index f92eed64abc..9539f9af34f 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Ogranicz platformy, na jakich można uruchomić ten kod: x86, Itanium, x64, anycpu32bitpreferred lub anycpu. Domyślna platforma to anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Ogranicz platformy, na jakich można uruchomić ten kod: x86, Itanium, x64, anycpu32bitpreferred lub anycpu. Domyślna platforma to anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Nierozpoznana platforma „{0}”. Prawidłowe wartości to „x86”, „x64”, „Itanium”, „anycpu32bitpreferred” i „anycpu” + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Nierozpoznana platforma „{0}”. Prawidłowe wartości to „x86”, „x64”, „Itanium”, „anycpu32bitpreferred” i „anycpu” diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 0c6ceac112a..29bcce01250 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Limite em quais plataformas este código pode ser executado: x86, Itanium, x64, anycpu32bitpreferred ou anycpu. O padrão é anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Limite em quais plataformas este código pode ser executado: x86, Itanium, x64, anycpu32bitpreferred ou anycpu. O padrão é anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Plataforma não reconhecida '{0}', os valores válidos são 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' e 'anycpu' + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Plataforma não reconhecida '{0}', os valores válidos são 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' e 'anycpu' diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 22b93f16437..1fb3a354f86 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Выберите платформы, на которых может выполняться этот код: x86, Itanium, x64, anycpu32bitpreferred или anycpu. По умолчанию используется любой процессор (anycpu). + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Выберите платформы, на которых может выполняться этот код: x86, Itanium, x64, anycpu32bitpreferred или anycpu. По умолчанию используется любой процессор (anycpu). @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Нераспознанная платформа "{0}"; допустимые значения: x86, x64, Itanium, anycpu32bitpreferred и anycpu + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Нераспознанная платформа "{0}"; допустимые значения: x86, x64, Itanium, anycpu32bitpreferred и anycpu diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 3a720bf0f0d..d36bd224b9d 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - Bu kodun üzerinde çalışabileceği platformları sınırlandırın: x86, Itanium, x64, anycpu32bitpreferred veya anycpu. Varsayılan: anycpu. + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + Bu kodun üzerinde çalışabileceği platformları sınırlandırın: x86, Itanium, x64, anycpu32bitpreferred veya anycpu. Varsayılan: anycpu. @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - Tanınmayan platform '{0}', geçerli değerler: 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' ve 'anycpu' + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + Tanınmayan platform '{0}', geçerli değerler: 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred' ve 'anycpu' diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index f9eea243b93..a1b2b225415 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - 限制可以运行此代码的平台: x86、Itanium、x64、anycpu32bitpreferred 或 anycpu。默认值为 anycpu。 + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + 限制可以运行此代码的平台: x86、Itanium、x64、anycpu32bitpreferred 或 anycpu。默认值为 anycpu。 @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - 无法识别的平台“{0}”,有效值为“x86”、“x64”、“Itanium”、“anycpu32bitpreferred”和“anycpu” + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + 无法识别的平台“{0}”,有效值为“x86”、“x64”、“Itanium”、“anycpu32bitpreferred”和“anycpu” diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index d05d8005fea..b8854a10e66 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -5008,8 +5008,8 @@ - Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - 限制這個程式碼可以在哪些平台執行: x86、Itanium、x64、anycpu32bitpreferred 或 anycpu。預設為 anycpu。 + Limit which platforms this code can run on: x86, x64, Arm, Arm64, Itanium, anycpu32bitpreferred, or anycpu. The default is anycpu. + 限制這個程式碼可以在哪些平台執行: x86、Itanium、x64、anycpu32bitpreferred 或 anycpu。預設為 anycpu。 @@ -5303,8 +5303,8 @@ - Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - 無法辨識的平台 '{0}',有效的值是 'x86'、'x64'、'Itanium'、'anycpu32bitpreferred' 和 'anycpu' + Unrecognized platform '{0}', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'. The default is anycpu. + 無法辨識的平台 '{0}',有效的值是 'x86'、'x64'、'Itanium'、'anycpu32bitpreferred' 和 'anycpu' diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs index 76447c2f961..436f481d7c5 100644 --- a/src/FSharp.Build/Fsc.fs +++ b/src/FSharp.Build/Fsc.fs @@ -197,6 +197,8 @@ type public Fsc() as this = | "ANYCPU", _, _ -> "anycpu" | "X86", _, _ -> "x86" | "X64", _, _ -> "x64" + | "ARM", _, _ -> "arm" + | "ARM64", _, _ -> "arm64" | _ -> null ) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform.fs index 0ad8d24603f..8063e7aa5b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform.fs @@ -48,7 +48,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'ITANIUM', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'ITANIUM', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_03.fs - --platform:ITANIUM`` compilation = compilation @@ -57,11 +57,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'ITANIUM', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'ITANIUM', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'ANYCPU', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'ANYCPU', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_04.fs - --platform:ANYCPU`` compilation = compilation @@ -70,11 +70,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'ANYCPU', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'ANYCPU', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'X86', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'X86', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_05.fs - --platform:X86`` compilation = compilation @@ -83,11 +83,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'X86', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'X86', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'X64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'X64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_06.fs - --platform:X64`` compilation = compilation @@ -96,11 +96,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'X64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'X64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'IA64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'IA64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_07.fs - --platform:IA64`` compilation = compilation @@ -109,11 +109,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'IA64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'IA64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'i386', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'i386', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_08.fs - --platform:i386`` compilation = compilation @@ -122,11 +122,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'i386', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'i386', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'AMD64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'AMD64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_09.fs - --platform:AMD64`` compilation = compilation @@ -135,11 +135,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'AMD64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'AMD64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'PPC', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'PPC', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_10.fs - --platform:PPC`` compilation = compilation @@ -148,11 +148,11 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'PPC', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'PPC', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'ARM', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + //Unrecognized platform 'ARM', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' [] let ``platform - error_15.fs - --platform:ARM`` compilation = compilation @@ -161,7 +161,7 @@ module platform = |> compile |> shouldFail |> withErrorCode 1064 - |> withDiagnosticMessageMatches "Unrecognized platform 'ARM', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" + |> withDiagnosticMessageMatches "Unrecognized platform 'ARM', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForDll.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForDll.fs new file mode 100644 index 00000000000..523cd90e06d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForDll.fs @@ -0,0 +1,7 @@ +open System +open System.IO +open System.Reflection + +let path = Path.GetDirectoryName (Assembly.GetExecutingAssembly().Location) +let asm = AssemblyName.GetAssemblyName(Path.Combine(path, "PlatformedDll.dll")) +printfn "%s" (asm.ToString()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForExe.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForExe.fs new file mode 100644 index 00000000000..a80beeb0300 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/AssemblyNameForExe.fs @@ -0,0 +1,7 @@ +open System +open System.IO +open System.Reflection + +let path = Path.GetDirectoryName (Assembly.GetExecutingAssembly().Location) +let asm = AssemblyName.GetAssemblyName(Path.Combine(path, "PlatformedExe.exe")) +printfn "%s" (asm.ToString()) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/Platform.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/Platform.fs new file mode 100644 index 00000000000..0094d9fdb70 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/Platform.fs @@ -0,0 +1,136 @@ +namespace FSharp.Compiler.ComponentTests.EmittedIL + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler +open System.Runtime.InteropServices + +module Platform = + + let isArm = + match System.Runtime.InteropServices.Architecture() with + | Architecture.Arm | Architecture.Arm64 -> true + | _ -> false + + let buildPlatformedDll = + FsFromPath (__SOURCE_DIRECTORY__ ++ "PlatformedDll.fs") + |> asLibrary + |> withName "PlatformedDll.dll" + + let buildPlatformedExe = + FsFromPath (__SOURCE_DIRECTORY__ ++ "PlatformedExe.fs") + |> asExe + |> withName "PlatformedExe.exe" + + [] + let platformExeAnyCpuDefault compilation = + compilation + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.Anycpu ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformExeAnyCpu32BitPreferred compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.AnyCpu32bitPreferred ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformExeArm compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.Arm ] + |> if isArm then compileExeAndRun else compile + |> shouldSucceed + + [] + let platformExeArm64 compilation = + compilation + |> asExe + |> withPlatform ExecutionPlatform.Arm64 + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.Arm64 ] + |> if isArm then compileExeAndRun else compile + |> shouldSucceed + + [] + let platformExeItanium compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.Itanium ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformExeX86 compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.X86 ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformExeX64 compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedExe |> withPlatform ExecutionPlatform.X64 ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformDllDefault compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedDll ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformDllAnyCpuDefault compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedDll |> withPlatform ExecutionPlatform.Anycpu ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformDllArm compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedDll |> withPlatform ExecutionPlatform.Arm ] + |> if isArm then compileExeAndRun else compile + |> shouldSucceed + + [] + let platformDllArm64 compilation = + compilation + |> asExe + |> withPlatform ExecutionPlatform.Arm64 + |> withReferences [ buildPlatformedDll |> withPlatform ExecutionPlatform.Arm64 ] + |> if isArm then compileExeAndRun else compile + |> shouldSucceed + + [] + let platformDllItanium compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedDll |> withPlatform ExecutionPlatform.Itanium ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformDllX86 compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedDll |> withPlatform ExecutionPlatform.X86 ] + |> compileExeAndRun + |> shouldSucceed + + [] + let platformDllX64 compilation = + compilation + |> asExe + |> withReferences [ buildPlatformedDll |> withPlatform ExecutionPlatform.X64 ] + |> compileExeAndRun + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedDll.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedDll.fs new file mode 100644 index 00000000000..8514772167a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedDll.fs @@ -0,0 +1,3 @@ +namespace Platformed + +type aType = unit \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedExe.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedExe.fs new file mode 100644 index 00000000000..f3c7decf4b6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Platform/PlatformedExe.fs @@ -0,0 +1 @@ +printfn "Hello, World" diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index a91bb7b00a2..5caee3b58ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -18,12 +18,6 @@ - - %(RelativeDir)\TestSource\%(Filename)%(Extension) - - - %(RelativeDir)\TestSource\%(Filename)%(Extension) - @@ -93,8 +87,8 @@ - + @@ -117,6 +111,7 @@ + @@ -160,8 +155,8 @@ - - + + @@ -185,11 +180,12 @@ %(RelativeDir)\BaseLine\%(Filename)%(Extension) - - - - - + + %(RelativeDir)\TestSource\%(Filename)%(Extension) + + + %(RelativeDir)\TestSource\%(Filename)%(Extension) + diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 68ce2aff88f..6408f14dae0 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -452,7 +452,7 @@ module rec Compiler = match platform with | ExecutionPlatform.Anycpu -> "anycpu" | ExecutionPlatform.AnyCpu32bitPreferred -> "anycpu32bitpreferred" - | ExecutionPlatform.Itanium -> "itanium" + | ExecutionPlatform.Itanium -> "Itanium" | ExecutionPlatform.X64 -> "x64" | ExecutionPlatform.X86 -> "x86" | ExecutionPlatform.Arm -> "arm" diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index 117f2bb42ae..a0b1ddefdfe 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -83,11 +83,19 @@ module ILChecker = RegexOptions.Singleline) pass3 + let unifyImageBase ilCode = + Regex.Replace( + ilCode, + "\.imagebase\s*0x\d*",".imagebase {value}", + RegexOptions.Singleline) + let unifyIlText (text:string) = let unifyingAssemblyNames (text:string)= let asmName = Path.GetFileNameWithoutExtension(dllFilePath) text.Replace(asmName, "assembly") |> unifyRuntimeAssemblyName + |> unifyImageBase + text.Trim() |> stripComments |> unifyingAssemblyNames let raw = File.ReadAllText(ilFilePath) diff --git a/tests/fsharp/test.fs b/tests/fsharp/test.fs new file mode 100644 index 00000000000..c0bff1e649f --- /dev/null +++ b/tests/fsharp/test.fs @@ -0,0 +1,54 @@ + +let fail msg = + printfn "%s" msg + failwith msg + +[] +type T1 = { v1: int } +and T2 = + | T2C1 of int * string + | T2C2 of T1 * T2 +and [] T3 = { v3: T2 } +and T4() = + let mutable _v4 = { v3 = T2C2({v1=0}, T2C1(1, "hey")) } + member __.v4 with get() = _v4 and set (x) = _v4 <- x + +[] +let (|P1|_|) = + function + | 0 -> ValueNone + | _ -> ValueSome() + +[] +let (|P2|_|) = + function + | "foo" -> ValueNone + | _ -> ValueSome "bar" + +[] +let (|P3|_|) (x: T2) = + match x with + | T2C1(a, b) -> ValueSome(a, b) + | _ -> ValueNone + +[] +let (|P4|_|) (x: T4) = + match x.v4 with + | { v3 = T2C2 ({v1=a}, P3(b, c)) } -> ValueSome (a, b, c) + | _ -> ValueNone + +match 0, 1 with +| P1, _ -> fail "unit" +| _, P1 -> () +| _ -> fail "unit" + +match "foo", "bar" with +| P2 _, _ -> fail "string" +| _, P2("bar") -> () +| _ -> fail "string" + +let t4 = T4() +match t4 with +| P4 (0, 1, "hey") -> () +| _ -> fail "nested" + \ No newline at end of file diff --git a/tests/fsharp/test.fsx b/tests/fsharp/test.fsx new file mode 100644 index 00000000000..309111e6b4b --- /dev/null +++ b/tests/fsharp/test.fsx @@ -0,0 +1,3 @@ + +#load @"C:\kevinransom\fsharp\tests\fsharp\Compiler\Language\../../typeProviders/helloWorld\provider.fsx" + \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl index 7e7c4a13a99..2e41efee8f2 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -21,9 +21,9 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. the given file --keyfile: Specify a strong name key file --platform: Limit which platforms this code can - run on: x86, Itanium, x64, - anycpu32bitpreferred, or anycpu. The - default is anycpu. + run on: x86, x64, Arm, Arm64, + Itanium, anycpu32bitpreferred, or + anycpu. The default is anycpu. --nooptimizationdata Only include optimization information essential for implementing inlined constructs.