From 627693d4fa4f06b27c65691addbe8847aafda097 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2019 15:02:57 +0000 Subject: import dotnet-2.1.507-4.el8 --- diff --git a/.dotnet.metadata b/.dotnet.metadata new file mode 100644 index 0000000..e05211e --- /dev/null +++ b/.dotnet.metadata @@ -0,0 +1 @@ +2d247ba0f76d57d380473afeb0d7fb83c5fef1b9 SOURCES/dotnet-v2.1.11.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb502ca --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/dotnet-v2.1.11.tar.gz diff --git a/SOURCES/check-debug-symbols.py b/SOURCES/check-debug-symbols.py new file mode 100755 index 0000000..1e14800 --- /dev/null +++ b/SOURCES/check-debug-symbols.py @@ -0,0 +1,136 @@ +#!/usr/bin/python3 + +""" +Check debug symbols are present in shared object and can identify +code. + +It starts scanning from a directory and recursively scans all ELF +files found in it for various symbols to ensure all debuginfo is +present and nothing has been stripped. + +Usage: + +./check-debug-symbols /path/of/dir/to/scan/ + + +Example: + +./check-debug-symbols /usr/lib64 +""" + +# This technique was explained to me by Mark Wielaard (mjw). + +import collections +import os +import re +import subprocess +import sys + +ScanResult = collections.namedtuple('ScanResult', + 'file_name debug_info debug_abbrev file_symbols gnu_debuglink') + + +def scan_file(file): + "Scan the provided file and return a ScanResult containing results of the scan." + + # Test for .debug_* sections in the shared object. This is the main test. + # Stripped objects will not contain these. + readelf_S_result = subprocess.run(['eu-readelf', '-S', file], + stdout=subprocess.PIPE, encoding='utf-8', check=True) + has_debug_info = any(line for line in readelf_S_result.stdout.split('\n') if '] .debug_info' in line) + + has_debug_abbrev = any(line for line in readelf_S_result.stdout.split('\n') if '] .debug_abbrev' in line) + + # Test FILE symbols. These will most likely be removed by anyting that + # manipulates symbol tables because it's generally useless. So a nice test + # that nothing has messed with symbols. + def contains_file_symbols(line): + parts = line.split() + if len(parts) < 8: + return False + return \ + parts[2] == '0' and parts[3] == 'FILE' and parts[4] == 'LOCAL' and parts[5] == 'DEFAULT' and \ + parts[6] == 'ABS' and re.match(r'((.*/)?[-_a-zA-Z0-9]+\.(c|cc|cpp|cxx))?', parts[7]) + + readelf_s_result = subprocess.run(["eu-readelf", '-s', file], + stdout=subprocess.PIPE, encoding='utf-8', check=True) + has_file_symbols = any(line for line in readelf_s_result.stdout.split('\n') if contains_file_symbols(line)) + + # Test that there are no .gnu_debuglink sections pointing to another + # debuginfo file. There shouldn't be any debuginfo files, so the link makes + # no sense either. + has_gnu_debuglink = any(line for line in readelf_s_result.stdout.split('\n') if '] .gnu_debuglink' in line) + + return ScanResult(file, has_debug_info, has_debug_abbrev, has_file_symbols, has_gnu_debuglink) + +def is_elf(file): + result = subprocess.run(['file', file], stdout=subprocess.PIPE, encoding='utf-8', check=True) + return re.search('ELF 64-bit LSB (?:executable|shared object)', result.stdout) + +def scan_file_if_sensible(file): + if is_elf(file): + # print(file) + return scan_file(file) + return None + +def scan_dir(dir): + results = [] + for root, _, files in os.walk(dir): + for name in files: + result = scan_file_if_sensible(os.path.join(root, name)) + if result: + results.append(result) + return results + +def scan(file): + file = os.path.abspath(file) + if os.path.isdir(file): + return scan_dir(file) + elif os.path.isfile(file): + return scan_file_if_sensible(file) + +def is_bad_result(result): + return not result.debug_info or not result.debug_abbrev or not result.file_symbols or result.gnu_debuglink + +def print_scan_results(results, verbose): + # print(results) + for result in results: + file_name = result.file_name + found_issue = False + if not result.debug_info: + found_issue = True + print('error: missing .debug_info section in', file_name) + if not result.debug_abbrev: + found_issue = True + print('error: missing .debug_abbrev section in', file_name) + if not result.file_symbols: + found_issue = True + print('error: missing FILE symbols in', file_name) + if result.gnu_debuglink: + found_issue = True + print('error: unexpected .gnu_debuglink section in', file_name) + if verbose and not found_issue: + print('OK: ', file_name) + +def main(args): + verbose = False + files = [] + for arg in args: + if arg == '--verbose' or arg == '-v': + verbose = True + else: + files.append(arg) + + results = [] + for file in files: + results.extend(scan(file)) + + print_scan_results(results, verbose) + + if any(is_bad_result(result) for result in results): + return 1 + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/SOURCES/cli-telemetry-optout.patch b/SOURCES/cli-telemetry-optout.patch new file mode 100644 index 0000000..9b01f13 --- /dev/null +++ b/SOURCES/cli-telemetry-optout.patch @@ -0,0 +1,18 @@ +diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs +index de1ebb9e6..6bbf479de 100644 +--- a/src/dotnet/Program.cs ++++ b/src/dotnet/Program.cs +@@ -28,6 +28,13 @@ public class Program + + public static int Main(string[] args) + { ++ // opt out of telemetry by default if the env var is unset ++ string telemetryValue = Environment.GetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT"); ++ if (String.IsNullOrEmpty(telemetryValue)) ++ { ++ Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1"); ++ } ++ + DebugHelper.HandleDebugSwitch(ref args); + + new MulticoreJitActivator().TryActivateMulticoreJit(); diff --git a/SOURCES/core-setup-4510-commit-id.patch b/SOURCES/core-setup-4510-commit-id.patch new file mode 100644 index 0000000..cf896ef --- /dev/null +++ b/SOURCES/core-setup-4510-commit-id.patch @@ -0,0 +1,48 @@ +From e02ee86364b9db3edc298a6a081004aa07473d09 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Wed, 29 Aug 2018 17:03:25 -0400 +Subject: [PATCH] Allow setting the commit id using /p:LatestCommit + +This is similar to how CommitCount is already supported. + +This lets consumers who are building outside a git repo, such as +source-build, set a commit id which is displayed by `dotnet --info` +and `strings dotnet | grep '@(#)'`. + +See: https://github.com/dotnet/source-build/issues/651 +See: https://github.com/dotnet/cli/pull/5945 +--- + dir.targets | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/dir.targets b/dir.targets +index 8d34872c6..59dc1ebde 100644 +--- a/dir.targets ++++ b/dir.targets +@@ -17,7 +17,8 @@ + + + +- ++ + + + +@@ -29,13 +30,13 @@ + + + +- ++ + ++ ConsoleToMSBuild="true"> + + + diff --git a/SOURCES/core-setup-pie.patch b/SOURCES/core-setup-pie.patch new file mode 100644 index 0000000..f2ef5ac --- /dev/null +++ b/SOURCES/core-setup-pie.patch @@ -0,0 +1,11 @@ +--- a/src/corehost/cli/exe/exe.cmake ++++ b/src/corehost/cli/exe/exe.cmake +@@ -44,6 +44,8 @@ + + add_executable(${DOTNET_HOST_EXE_NAME} ${SOURCES} ${RESOURCES}) + ++SET_TARGET_PROPERTIES(${DOTNET_HOST_EXE_NAME} PROPERTIES LINK_FLAGS -pie) ++ + if(NOT WIN32) + disable_pax_mprotect(${DOTNET_HOST_EXE_NAME}) + endif() diff --git a/SOURCES/coreclr-assembly-hex-constants.patch b/SOURCES/coreclr-assembly-hex-constants.patch new file mode 100644 index 0000000..00428fb --- /dev/null +++ b/SOURCES/coreclr-assembly-hex-constants.patch @@ -0,0 +1,584 @@ +diff --git a/src/debug/ee/amd64/dbghelpers.S b/src/debug/ee/amd64/dbghelpers.S +index 85ec80c701..864c4dc943 100644 +--- a/src/debug/ee/amd64/dbghelpers.S ++++ b/src/debug/ee/amd64/dbghelpers.S +@@ -29,7 +29,7 @@ NESTED_ENTRY FuncEvalHijack, _TEXT, UnhandledExceptionHandlerUnix + // + // epilogue + // +- add rsp, 20h ++ add rsp, 0x20 + TAILJMP_RAX + NESTED_END FuncEvalHijack, _TEXT + +@@ -65,14 +65,14 @@ NESTED_ENTRY ExceptionHijack, _TEXT, UnhandledExceptionHandlerUnix + // its arguments on the stack. In x64, it gets its arguments in + // registers (set up for us by DacDbiInterfaceImpl::Hijack), + // and this stack space may be reused. +- mov rax, [rsp + 20h] ++ mov rax, [rsp + 0x20] + mov [rsp], rax +- mov rax, [rsp + 28h] +- mov [rsp + 8h], rax +- mov rax, [rsp + 30h] +- mov [rsp + 10h], rax +- mov rax, [rsp + 38h] +- mov [rsp + 18h], rax ++ mov rax, [rsp + 0x28] ++ mov [rsp + 0x8], rax ++ mov rax, [rsp + 0x30] ++ mov [rsp + 0x10], rax ++ mov rax, [rsp + 0x38] ++ mov [rsp + 0x18], rax + + // DD Hijack primitive already set the stack. So just make the call now. + call C_FUNC(ExceptionHijackWorker) +@@ -93,7 +93,7 @@ NESTED_ENTRY ExceptionHijack, _TEXT, UnhandledExceptionHandlerUnix + // + // epilogue + // +- add rsp, 20h ++ add rsp, 0x20 + TAILJMP_RAX + + // Put a label here to tell the debugger where the end of this function is. +diff --git a/src/pal/inc/unixasmmacros.inc b/src/pal/inc/unixasmmacros.inc +index e7a5eba898..8a74e3f266 100644 +--- a/src/pal/inc/unixasmmacros.inc ++++ b/src/pal/inc/unixasmmacros.inc +@@ -2,7 +2,7 @@ + // The .NET Foundation licenses this file to you under the MIT license. + // See the LICENSE file in the project root for more information. + +-#define INVALIDGCVALUE 0CCCCCCCDh ++#define INVALIDGCVALUE 0xCCCCCCCD + + #if defined(__APPLE__) + #define C_FUNC(name) _##name +diff --git a/src/vm/amd64/JitHelpers_Fast.asm b/src/vm/amd64/JitHelpers_Fast.asm +index 83f7132688..5251387408 100644 +--- a/src/vm/amd64/JitHelpers_Fast.asm ++++ b/src/vm/amd64/JitHelpers_Fast.asm +@@ -40,7 +40,7 @@ EXTERN g_GCShadow:QWORD + EXTERN g_GCShadowEnd:QWORD + endif + +-INVALIDGCVALUE equ 0CCCCCCCDh ++INVALIDGCVALUE equ 0xCCCCCCCD + + ifdef _DEBUG + extern JIT_WriteBarrier_Debug:proc +diff --git a/src/vm/amd64/JitHelpers_Slow.asm b/src/vm/amd64/JitHelpers_Slow.asm +index 0e26ae6dfd..80b7453d4f 100644 +--- a/src/vm/amd64/JitHelpers_Slow.asm ++++ b/src/vm/amd64/JitHelpers_Slow.asm +@@ -48,7 +48,7 @@ g_pStringClass equ ?g_pStringClass@@3PEAVMethodTable@@EA + FramedAllocateString equ ?FramedAllocateString@@YAPEAVStringObject@@K@Z + JIT_NewArr1 equ ?JIT_NewArr1@@YAPEAVObject@@PEAUCORINFO_CLASS_STRUCT_@@_J@Z + +-INVALIDGCVALUE equ 0CCCCCCCDh ++INVALIDGCVALUE equ 0xCCCCCCCD + + extern JIT_NEW:proc + extern CopyValueClassUnchecked:proc +diff --git a/src/vm/amd64/jithelpers_fast.S b/src/vm/amd64/jithelpers_fast.S +index 6f955b0bee..5f68fc0ebf 100644 +--- a/src/vm/amd64/jithelpers_fast.S ++++ b/src/vm/amd64/jithelpers_fast.S +@@ -81,14 +81,14 @@ LEAF_ENTRY JIT_WriteBarrier, _TEXT + // Update the write watch table if necessary + mov rax, rdi + movabs r10, 0xF0F0F0F0F0F0F0F0 +- shr rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift ++ shr rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift + NOP_2_BYTE // padding for alignment of constant + movabs r11, 0xF0F0F0F0F0F0F0F0 + add rax, r10 +- cmp byte ptr [rax], 0h ++ cmp byte ptr [rax], 0x0 + .byte 0x75, 0x06 + // jne CheckCardTable +- mov byte ptr [rax], 0FFh ++ mov byte ptr [rax], 0xFF + + NOP_3_BYTE // padding for alignment of constant + +@@ -112,27 +112,27 @@ LEAF_ENTRY JIT_WriteBarrier, _TEXT + + // Touch the card table entry, if not already dirty. + shr rdi, 0x0B +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable + REPRET + + UpdateCardTable: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_2_BYTE // padding for alignment of constant + shr rdi, 0x0A + + movabs rax, 0xF0F0F0F0F0F0F0F0 +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle_WriteWatch_PostGrow64 + REPRET + + UpdateCardBundle_WriteWatch_PostGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -177,14 +177,14 @@ LEAF_ENTRY JIT_WriteBarrier, _TEXT + movabs rax, 0xF0F0F0F0F0F0F0F0 + + // Touch the card table entry, if not already dirty. +- shr rdi, 0Bh +- cmp byte ptr [rdi + rax], 0FFh ++ shr rdi, 0x0B ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable + REPRET + + UpdateCardTable: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0x0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_6_BYTE // padding for alignment of constant +@@ -194,14 +194,14 @@ LEAF_ENTRY JIT_WriteBarrier, _TEXT + // Touch the card bundle, if not already dirty. + // rdi is already shifted by 0xB, so shift by 0xA more + shr rdi, 0x0A +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle + REPRET + + UpdateCardBundle: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -312,15 +312,15 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT + #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP + // Update the write watch table if necessary + PREPARE_EXTERNAL_VAR g_sw_ww_enabled_for_gc_heap, rax +- cmp byte ptr [rax], 0h ++ cmp byte ptr [rax], 0x0 + je CheckCardTable_ByRefWriteBarrier + mov rax, rdi +- shr rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift ++ shr rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift + PREPARE_EXTERNAL_VAR g_sw_ww_table, r10 + add rax, qword ptr [r10] +- cmp byte ptr [rax], 0h ++ cmp byte ptr [rax], 0x0 + jne CheckCardTable_ByRefWriteBarrier +- mov byte ptr [rax], 0FFh ++ mov byte ptr [rax], 0xFF + #endif + + CheckCardTable_ByRefWriteBarrier: +@@ -334,8 +334,8 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT + + // move current rdi value into rcx and then increment the pointers + mov rcx, rdi +- add rsi, 8h +- add rdi, 8h ++ add rsi, 0x8 ++ add rdi, 0x8 + + // Check if we need to update the card table + // Calc pCardByte +@@ -345,13 +345,13 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT + mov rax, [rax] + + // Check if this card is dirty +- cmp byte ptr [rcx + rax], 0FFh ++ cmp byte ptr [rcx + rax], 0xFF + + jne UpdateCardTable_ByRefWriteBarrier + REPRET + + UpdateCardTable_ByRefWriteBarrier: +- mov byte ptr [rcx + rax], 0FFh ++ mov byte ptr [rcx + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + // Shift rcx by 0x0A more to get the card bundle byte (we shifted by 0x0B already) +@@ -361,13 +361,13 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT + add rcx, [rax] + + // Check if this bundle byte is dirty +- cmp byte ptr [rcx], 0FFh ++ cmp byte ptr [rcx], 0xFF + + jne UpdateCardBundle_ByRefWriteBarrier + REPRET + + UpdateCardBundle_ByRefWriteBarrier: +- mov byte ptr [rcx], 0FFh ++ mov byte ptr [rcx], 0xFF + #endif + + ret +@@ -383,8 +383,8 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT + #endif + Exit_ByRefWriteBarrier: + // Increment the pointers before leaving +- add rdi, 8h +- add rsi, 8h ++ add rdi, 0x8 ++ add rsi, 0x8 + ret + LEAF_END JIT_ByRefWriteBarrier, _TEXT + +diff --git a/src/vm/amd64/jithelpers_fastwritebarriers.S b/src/vm/amd64/jithelpers_fastwritebarriers.S +index 23c1115165..0fe0e57472 100644 +--- a/src/vm/amd64/jithelpers_fastwritebarriers.S ++++ b/src/vm/amd64/jithelpers_fastwritebarriers.S +@@ -38,13 +38,13 @@ PATCH_LABEL JIT_WriteBarrier_PreGrow64_Patch_Label_CardTable + + // Touch the card table entry, if not already dirty. + shr rdi, 0x0B +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable_PreGrow64 + REPRET + + UpdateCardTable_PreGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_6_BYTE // padding for alignment of constant +@@ -55,14 +55,14 @@ PATCH_LABEL JIT_WriteBarrier_PreGrow64_Patch_Label_CardBundleTable + // Touch the card bundle, if not already dirty. + // rdi is already shifted by 0xB, so shift by 0xA more + shr rdi, 0x0A +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle_PreGrow64 + REPRET + + UpdateCardBundle_PreGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -123,13 +123,13 @@ PATCH_LABEL JIT_WriteBarrier_PostGrow64_Patch_Label_CardTable + + // Touch the card table entry, if not already dirty. + shr rdi, 0x0B +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable_PostGrow64 + REPRET + + UpdateCardTable_PostGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_6_BYTE // padding for alignment of constant +@@ -140,14 +140,14 @@ PATCH_LABEL JIT_WriteBarrier_PostGrow64_Patch_Label_CardBundleTable + // Touch the card bundle, if not already dirty. + // rdi is already shifted by 0xB, so shift by 0xA more + shr rdi, 0x0A +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle_PostGrow64 + REPRET + + UpdateCardBundle_PostGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -182,13 +182,13 @@ PATCH_LABEL JIT_WriteBarrier_SVR64_PatchLabel_CardTable + + shr rdi, 0x0B + +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable_SVR64 + REPRET + + UpdateCardTable_SVR64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_6_BYTE // padding for alignment of constant +@@ -198,14 +198,14 @@ PATCH_LABEL JIT_WriteBarrier_SVR64_PatchLabel_CardBundleTable + + // Shift the address by 0xA more since already shifted by 0xB + shr rdi, 0x0A +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle_SVR64 + REPRET + + UpdateCardBundle_SVR64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -236,15 +236,15 @@ LEAF_ENTRY JIT_WriteBarrier_WriteWatch_PreGrow64, _TEXT + mov rax, rdi + PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_WriteWatchTable + movabs r10, 0xF0F0F0F0F0F0F0F0 +- shr rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift ++ shr rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift + NOP_2_BYTE // padding for alignment of constant + PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_Lower + movabs r11, 0xF0F0F0F0F0F0F0F0 + add rax, r10 +- cmp byte ptr [rax], 0h ++ cmp byte ptr [rax], 0x0 + .byte 0x75, 0x03 + // jne CheckCardTable_WriteWatch_PreGrow64 +- mov byte ptr [rax], 0FFh ++ mov byte ptr [rax], 0xFF + + CheckCardTable_WriteWatch_PreGrow64: + // Check the lower ephemeral region bound. +@@ -263,13 +263,13 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_Lower + NOP_2_BYTE // padding for alignment of constant + PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_CardTable + movabs rax, 0xF0F0F0F0F0F0F0F0 +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable_WriteWatch_PreGrow64 + REPRET + + UpdateCardTable_WriteWatch_PreGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_2_BYTE // padding for alignment of constant +@@ -277,14 +277,14 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_CardBundleTable + movabs rax, 0xF0F0F0F0F0F0F0F0 + + shr rdi, 0x0A +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle_WriteWatch_PreGrow64 + REPRET + + UpdateCardBundle_WriteWatch_PreGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -314,15 +314,15 @@ LEAF_ENTRY JIT_WriteBarrier_WriteWatch_PostGrow64, _TEXT + mov rax, rdi + PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_WriteWatchTable + movabs r10, 0xF0F0F0F0F0F0F0F0 +- shr rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift ++ shr rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift + NOP_2_BYTE // padding for alignment of constant + PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_Lower + movabs r11, 0xF0F0F0F0F0F0F0F0 + add rax, r10 +- cmp byte ptr [rax], 0h ++ cmp byte ptr [rax], 0x0 + .byte 0x75, 0x06 + // jne CheckCardTable_WriteWatch_PostGrow64 +- mov byte ptr [rax], 0FFh ++ mov byte ptr [rax], 0xFF + + NOP_3_BYTE // padding for alignment of constant + +@@ -358,13 +358,13 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_CardTable + + // Touch the card table entry, if not already dirty. + shr rdi, 0x0B +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable_WriteWatch_PostGrow64 + REPRET + + UpdateCardTable_WriteWatch_PostGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP_2_BYTE // padding for alignment of constant +@@ -372,14 +372,14 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_CardTable + + PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_CardBundleTable + movabs rax, 0xF0F0F0F0F0F0F0F0 +- cmp byte ptr [rdi + rax], 0FFh ++ cmp byte ptr [rdi + rax], 0xFF + + .byte 0x75, 0x02 + // jne UpdateCardBundle_WriteWatch_PostGrow64 + REPRET + + UpdateCardBundle_WriteWatch_PostGrow64: +- mov byte ptr [rdi + rax], 0FFh ++ mov byte ptr [rdi + rax], 0xFF + #endif + + ret +@@ -417,25 +417,25 @@ LEAF_ENTRY JIT_WriteBarrier_WriteWatch_SVR64, _TEXT + mov rax, rdi + PATCH_LABEL JIT_WriteBarrier_WriteWatch_SVR64_PatchLabel_WriteWatchTable + movabs r10, 0xF0F0F0F0F0F0F0F0 +- shr rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift ++ shr rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift + NOP_2_BYTE // padding for alignment of constant + PATCH_LABEL JIT_WriteBarrier_WriteWatch_SVR64_PatchLabel_CardTable + movabs r11, 0xF0F0F0F0F0F0F0F0 + add rax, r10 +- cmp byte ptr [rax], 0h ++ cmp byte ptr [rax], 0x0 + .byte 0x75, 0x03 + // jne CheckCardTable_WriteWatch_SVR64 +- mov byte ptr [rax], 0FFh ++ mov byte ptr [rax], 0xFF + + CheckCardTable_WriteWatch_SVR64: + shr rdi, 0x0B +- cmp byte ptr [rdi + r11], 0FFh ++ cmp byte ptr [rdi + r11], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardTable_WriteWatch_SVR64 + REPRET + + UpdateCardTable_WriteWatch_SVR64: +- mov byte ptr [rdi + r11], 0FFh ++ mov byte ptr [rdi + r11], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + NOP // padding for alignment of constant +@@ -444,13 +444,13 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_SVR64_PatchLabel_CardBundleTable + movabs r11, 0xF0F0F0F0F0F0F0F0 + + shr rdi, 0x0A +- cmp byte ptr [rdi + r11], 0FFh ++ cmp byte ptr [rdi + r11], 0xFF + .byte 0x75, 0x02 + // jne UpdateCardBundle_WriteWatch_SVR64 + REPRET + + UpdateCardBundle_WriteWatch_SVR64: +- mov byte ptr [rdi + r11], 0FFh ++ mov byte ptr [rdi + r11], 0xFF + #endif + + ret +diff --git a/src/vm/amd64/jithelpers_slow.S b/src/vm/amd64/jithelpers_slow.S +index f61b42afc7..aa2e8cc064 100644 +--- a/src/vm/amd64/jithelpers_slow.S ++++ b/src/vm/amd64/jithelpers_slow.S +@@ -71,15 +71,15 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT + #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP + // Update the write watch table if necessary + PREPARE_EXTERNAL_VAR g_sw_ww_enabled_for_gc_heap, r10 +- cmp byte ptr [r10], 0h ++ cmp byte ptr [r10], 0x0 + je CheckCardTable_Debug + mov r10, rdi +- shr r10, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift ++ shr r10, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift + PREPARE_EXTERNAL_VAR g_sw_ww_table, r11 + add r10, qword ptr [r11] +- cmp byte ptr [r10], 0h ++ cmp byte ptr [r10], 0x0 + jne CheckCardTable_Debug +- mov byte ptr [r10], 0FFh ++ mov byte ptr [r10], 0xFF + #endif + + CheckCardTable_Debug: +@@ -99,13 +99,13 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT + mov r10, [r10] + + // Check if this card is dirty +- cmp byte ptr [rdi + r10], 0FFh ++ cmp byte ptr [rdi + r10], 0xFF + + jne UpdateCardTable_Debug + REPRET + + UpdateCardTable_Debug: +- mov byte ptr [rdi + r10], 0FFh ++ mov byte ptr [rdi + r10], 0xFF + + #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES + // Shift rdi by 0x0A more to get the card bundle byte (we shifted by 0x0B already) +@@ -115,13 +115,13 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT + add rdi, [r10] + + // Check if this bundle byte is dirty +- cmp byte ptr [rdi], 0FFh ++ cmp byte ptr [rdi], 0xFF + + jne UpdateCardBundle_Debug + REPRET + + UpdateCardBundle_Debug: +- mov byte ptr [rdi], 0FFh ++ mov byte ptr [rdi], 0xFF + #endif + + ret +diff --git a/src/vm/amd64/virtualcallstubamd64.S b/src/vm/amd64/virtualcallstubamd64.S +index 59b5b77dba..38c33d498e 100644 +--- a/src/vm/amd64/virtualcallstubamd64.S ++++ b/src/vm/amd64/virtualcallstubamd64.S +@@ -59,19 +59,19 @@ LEAF_ENTRY ResolveWorkerChainLookupAsmStub, _TEXT + jnz Fail_RWCLAS // If the BACKPATCH_FLAGS is set we will go directly to the ResolveWorkerAsmStub + + MainLoop_RWCLAS: +- mov rax, [rax+18h] // get the next entry in the chain (don't bother checking the first entry again) ++ mov rax, [rax+0x18] // get the next entry in the chain (don't bother checking the first entry again) + test rax,rax // test if we hit a terminating NULL + jz Fail_RWCLAS + +- cmp rdx, [rax+00h] // compare our MT with the one in the ResolveCacheElem ++ cmp rdx, [rax+0x0] // compare our MT with the one in the ResolveCacheElem + jne MainLoop_RWCLAS +- cmp r10, [rax+08h] // compare our DispatchToken with one in the ResolveCacheElem ++ cmp r10, [rax+0x8] // compare our DispatchToken with one in the ResolveCacheElem + jne MainLoop_RWCLAS + Success_RWCLAS: + PREPARE_EXTERNAL_VAR CHAIN_SUCCESS_COUNTER, rdx + sub qword ptr [rdx],1 // decrement success counter + jl Promote_RWCLAS +- mov rax, [rax+10h] // get the ImplTarget ++ mov rax, [rax+0x10] // get the ImplTarget + pop rdx + jmp rax + diff --git a/SOURCES/coreclr-build-python3.patch b/SOURCES/coreclr-build-python3.patch new file mode 100644 index 0000000..1090a12 --- /dev/null +++ b/SOURCES/coreclr-build-python3.patch @@ -0,0 +1,38 @@ +From 7e0608fee5cacbf5bf7d0c3886e2fcb1a9d10754 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Wed, 9 Jan 2019 12:28:48 -0500 +Subject: [PATCH] Support building with python3 on unix (#19356) + +The windows build scripts try finding python in order of python3, +python2 and then python. The unix build scripts dont. They just try +python2 variants and then fail. This change makes brings them closer +together by letting users build using only python3. +--- + build.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/build.sh b/build.sh +index a0b1742effb..14452ad5ac5 100755 +--- a/build.sh ++++ b/build.sh +@@ -7,9 +7,9 @@ export ghprbCommentBody= + + # resolve python-version to use + if [ "$PYTHON" == "" ] ; then +- if ! PYTHON=$(command -v python2.7 || command -v python2 || command -v python) ++ if ! PYTHON=$(command -v python3 || command -v python2 || command -v python) + then +- echo "Unable to locate build-dependency python2.x!" 1>&2 ++ echo "Unable to locate build-dependency python!" 1>&2 + exit 1 + fi + fi +@@ -17,7 +17,7 @@ fi + # useful in case of explicitly set option. + if ! command -v $PYTHON > /dev/null + then +- echo "Unable to locate build-dependency python2.x ($PYTHON)!" 1>&2 ++ echo "Unable to locate build-dependency python ($PYTHON)!" 1>&2 + exit 1 + fi + diff --git a/SOURCES/coreclr-cmake-python3.patch b/SOURCES/coreclr-cmake-python3.patch new file mode 100644 index 0000000..285cdc4 --- /dev/null +++ b/SOURCES/coreclr-cmake-python3.patch @@ -0,0 +1,26 @@ +From e7c6f87f54be723724a4c996d815d59b515b01a6 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Thu, 31 Jan 2019 16:09:35 -0500 +Subject: [PATCH] Update python lookup in CMakeLists.txt to match + build.(sh|cmd) (#22145) + +Use the same logic that's used in build.sh/build.cmd to lookup python: +first search for `python3`, then fall back to `python2` and finally to +`python`. +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 82c19a9cbaa..31b814f118d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -37,7 +37,7 @@ OPTION(CLR_CMAKE_ENABLE_CODE_COVERAGE "Enable code coverage" OFF) + OPTION(CLR_CMAKE_WARNINGS_ARE_ERRORS "Warnings are errors" ON) + + # Ensure that python is present +-find_program(PYTHON NAMES python2.7 python2 python) ++find_program(PYTHON NAMES python3 python2 python) + if (PYTHON STREQUAL "PYTHON-NOTFOUND") + message(FATAL_ERROR "PYTHON not found: Please install Python 2.7.9 or later from https://www.python.org/downloads/") + endif() diff --git a/SOURCES/coreclr-mscorlib.patch b/SOURCES/coreclr-mscorlib.patch new file mode 100644 index 0000000..ca59e77 --- /dev/null +++ b/SOURCES/coreclr-mscorlib.patch @@ -0,0 +1,40 @@ +From 5164e76ce01fc36833a7f5e6fb7b1ec2f55c2262 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Wed, 1 Aug 2018 12:02:53 -0400 +Subject: [PATCH] Use the identified python when building + System.Private.CoreLib (#19043) + +build.sh and build.cmd contain logic to identify a working version of +python to use. System.Private.CoreLib ignores that and directly invokes +'python', which may not work, or even execute a different program. +--- + build.sh | 2 ++ + src/System.Private.CoreLib/System.Private.CoreLib.csproj | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/build.sh b/build.sh +index 091d6227caf..4002f2744c2 100755 +--- a/build.sh ++++ b/build.sh +@@ -22,6 +22,8 @@ then + exit 1 + fi + ++export PYTHON ++ + usage() + { + echo "Usage: $0 [BuildArch] [BuildType] [-verbose] [-coverage] [-cross] [-clangx.y] [-ninja] [-configureonly] [-skipconfigure] [-skipnative] [-skipmscorlib] [-skiptests] [-stripsymbols] [-ignorewarnings] [-cmakeargs] [-bindir]" +diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj +index 9a2fc681703..0a02d3cffdf 100644 +--- a/src/mscorlib/System.Private.CoreLib.csproj ++++ b/src/mscorlib/System.Private.CoreLib.csproj +@@ -543,7 +543,7 @@ + + $(IntermediateOutputPath)..\cmake.definitions + +- ++ + + + true diff --git a/SOURCES/coreclr-pie.patch b/SOURCES/coreclr-pie.patch new file mode 100644 index 0000000..a711fc8 --- /dev/null +++ b/SOURCES/coreclr-pie.patch @@ -0,0 +1,11 @@ +--- a/src/debug/createdump/CMakeLists.txt ++++ b/src/debug/createdump/CMakeLists.txt +@@ -38,6 +38,8 @@ + main.cpp + ) + ++SET_TARGET_PROPERTIES(createdump PROPERTIES LINK_FLAGS -pie) ++ + target_link_libraries(createdump + createdump_lib + # share the PAL in the dac module diff --git a/SOURCES/corefx-32956-alpn.patch b/SOURCES/corefx-32956-alpn.patch new file mode 100644 index 0000000..88788b2 --- /dev/null +++ b/SOURCES/corefx-32956-alpn.patch @@ -0,0 +1,22 @@ +From 9b9697318e9990655ea878a28a00eda44fb615c2 Mon Sep 17 00:00:00 2001 +From: Jeremy Barton +Date: Mon, 22 Oct 2018 11:54:52 -0700 +Subject: [PATCH] Fix ALPN detection logic (for non-portable shim builds) + +--- + .../Unix/System.Security.Cryptography.Native/configure.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake +index cdc9f50f3c33..fac8c16343df 100644 +--- a/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake ++++ b/src/Native/Unix/System.Security.Cryptography.Native/configure.cmake +@@ -2,7 +2,7 @@ include(CheckLibraryExists) + include(CheckFunctionExists) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +-set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) ++set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY}) + + check_function_exists( + EC_GF2m_simple_method diff --git a/SOURCES/corefx-optflags-support.patch b/SOURCES/corefx-optflags-support.patch new file mode 100644 index 0000000..a445618 --- /dev/null +++ b/SOURCES/corefx-optflags-support.patch @@ -0,0 +1,39 @@ +diff --git a/src/Native/Unix/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt +index 7d804a1e54..717c2718d7 100644 +--- a/src/Native/Unix/CMakeLists.txt ++++ b/src/Native/Unix/CMakeLists.txt +@@ -25,7 +25,6 @@ add_compile_options(-fPIC) + add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common) + add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common) + add_compile_options(-g) +-add_compile_options(-Werror) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + add_compile_options(-Wno-unreachable-code) + endif () +diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake +index f4a30ad6cb..f2db68402a 100644 +--- a/src/Native/Unix/configure.cmake ++++ b/src/Native/Unix/configure.cmake +@@ -27,6 +27,12 @@ else () + message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.") + endif () + ++ ++set (PREVIOUS_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ++set (CMAKE_CXX_FLAGS "-D_GNU_SOURCE") ++set (PREVIOUS_CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) ++set (CMAKE_C_FLAGS "-D_GNU_SOURCE") ++ + # We compile with -Werror, so we need to make sure these code fragments compile without warnings. + # Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors + # which are not distinguished from the test failing. So no error for that one. +@@ -698,6 +704,9 @@ endif() + + set (CMAKE_REQUIRED_LIBRARIES) + ++set (CMAKE_CXX_FLAGS "${PREVIOUS_CMAKE_CXX_FLAGS}") ++set (CMAKE_C_FLAGS "${PREVIOUS_CMAKE_C_FLAGS}") ++ + check_c_source_compiles( + " + #include diff --git a/SOURCES/dotnet.sh b/SOURCES/dotnet.sh new file mode 100644 index 0000000..718d895 --- /dev/null +++ b/SOURCES/dotnet.sh @@ -0,0 +1,7 @@ + +# Add dotnet tools directory to PATH +DOTNET_TOOLS_PATH="$HOME/.dotnet/tools" +case "$PATH" in + *"$DOTNET_TOOLS_PATH"* ) true ;; + * ) PATH="$PATH:$DOTNET_TOOLS_PATH" ;; +esac diff --git a/SPECS/dotnet.spec b/SPECS/dotnet.spec new file mode 100644 index 0000000..a276d35 --- /dev/null +++ b/SPECS/dotnet.spec @@ -0,0 +1,440 @@ +# Avoid provides/requires from private libraries +%global privlibs libhostfxr +%global privlibs %{privlibs}|libclrjit +%global privlibs %{privlibs}|libcoreclr +%global privlibs %{privlibs}|libcoreclrtraceptprovider +%global privlibs %{privlibs}|libdbgshim +%global privlibs %{privlibs}|libhostpolicy +%global privlibs %{privlibs}|libmscordaccore +%global privlibs %{privlibs}|libmscordbi +%global privlibs %{privlibs}|libsos +%global privlibs %{privlibs}|libsosplugin +%global __provides_exclude ^(%{privlibs})\\.so +%global __requires_exclude ^(%{privlibs})\\.so + +# Filter flags not supported by clang/dotnet: +# -fcf-protection is not supported by clang +# -fstack-clash-protection is not supported by clang +# -specs= is not supported by clang +# -fpie is added manually instead of via -specs +%global dotnet_cflags %(echo %optflags | sed -e 's/-fcf-protection//' | sed -e 's/-fstack-clash-protection//' | sed -re 's/-specs=[^ ]*//g') +%global dotnet_ldflags %(echo %{__global_ldflags} | sed -re 's/-specs=[^ ]*//g') + +%if 0%{?fedora} +%global use_bundled_libunwind 0 +%else +%global use_bundled_libunwind 1 +%endif + +%global simple_name dotnet + +%global host_version 2.1.11 +%global runtime_version 2.1.11 +%global sdk_version 2.1.507 + +Name: dotnet +Version: %{sdk_version} +Release: 4%{?dist} +Summary: .NET Core CLI tools and runtime +License: MIT and ASL 2.0 and BSD +URL: https://github.com/dotnet/ + +# The source is generated on a RHEL box via: +# - git clone https://github.com/dotnet/source-build +# - git checkout v%%{sdk_version} +# - set environment variables + tweak sources to build +# - ./build-source-tarball.sh dotnet-%%{sdk_version} +# - tar cvzf dotnet-%%{sdk_version}.tar.gz dotnet-%%{sdk_version} + +Source0: dotnet-v%{runtime_version}.tar.gz +Source1: check-debug-symbols.py +Source2: dotnet.sh + +Patch10: corefx-optflags-support.patch +Patch11: corefx-32956-alpn.patch + +Patch100: coreclr-build-python3.patch +Patch101: coreclr-cmake-python3.patch +Patch102: coreclr-mscorlib.patch +Patch103: coreclr-pie.patch +Patch104: coreclr-assembly-hex-constants.patch + +Patch300: core-setup-4510-commit-id.patch +Patch301: core-setup-pie.patch + +Patch400: cli-telemetry-optout.patch + +ExclusiveArch: x86_64 + +BuildRequires: clang +BuildRequires: cmake +# Bootstrap SDK needs OpenSSL 1.0 to run, but we can build and then +# run with either OpenSSL 1.0 or 1.1 +%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 +BuildRequires: compat-openssl10 +%endif +BuildRequires: git +BuildRequires: glibc-langpack-en +BuildRequires: hostname +BuildRequires: krb5-devel +BuildRequires: libcurl-devel +BuildRequires: libicu-devel +%if ! %{use_bundled_libunwind} +BuildRequires: libunwind-devel +%endif +BuildRequires: lldb-devel +BuildRequires: llvm +BuildRequires: lttng-ust-devel +BuildRequires: make +BuildRequires: openssl-devel +BuildRequires: python3 +BuildRequires: strace +BuildRequires: zlib-devel + +Requires: %{simple_name}-sdk-2.1%{?_isa} >= %{sdk_version}-%{release} + +%description +.NET Core is a fast, lightweight and modular platform for creating +cross platform applications that work on Linux, macOS and Windows. + +It particularly focuses on creating console applications, web +applications and micro-services. + +.NET Core contains a runtime conforming to .NET Standards a set of +framework libraries, an SDK containing compilers and a 'dotnet' +application to drive everything. + + +%package -n %{simple_name}-host + +Version: %{host_version} +Summary: .NET command line launcher + +%description -n %{simple_name}-host +The .NET Core host is a command line program that runs a standalone +.NET core application or launches the SDK. + +.NET Core is a fast, lightweight and modular platform for creating +cross platform applications that work on Linux, Mac and Windows. + +It particularly focuses on creating console applications, web +applications and micro-services. + + +%package -n %{simple_name}-host-fxr-2.1 + +Version: %{host_version} +Summary: .NET Core command line host resolver + +# Theoretically any version of the host should work. But lets aim for the one +# provided by this package, or from a newer version of .NET Core +Requires: %{simple_name}-host%{?_isa} >= %{host_version}-%{release} + +%description -n %{simple_name}-host-fxr-2.1 +The .NET Core host resolver contains logic to resolve and select the +right version of the .NET Core SDK or runtime to use. + +.NET Core is a fast, lightweight and modular platform for creating +cross platform applications that work on Linux, Mac and Windows. + +It particularly focuses on creating console applications, web +applications and micro-services. + +%package -n %{simple_name}-runtime-2.1 + +Version: %{runtime_version} +Summary: NET Core 2.1 runtime + +Requires: %{simple_name}-host-fxr-2.1%{?_isa} >= %{host_version}-%{release} + +# libicu is dlopen()ed +Requires: libicu + +%description -n %{simple_name}-runtime-2.1 +The .NET Core runtime contains everything needed to run .NET Core applications. +It includes a high performance Virtual Machine as well as the framework +libraries used by .NET Core applications. + +.NET Core is a fast, lightweight and modular platform for creating +cross platform applications that work on Linux, Mac and Windows. + +It particularly focuses on creating console applications, web +applications and micro-services. + +%package -n %{simple_name}-sdk-2.1 + +Version: %{sdk_version} +Summary: .NET Core 2.1 Software Development Kit + +Requires: %{simple_name}-sdk-2.1.5xx%{?_isa} >= %{sdk_version}-%{release} + +%description -n %{simple_name}-sdk-2.1 +The .NET Core SDK is a collection of command line applications to +create, build, publish and run .NET Core applications. + +.NET Core is a fast, lightweight and modular platform for creating +cross platform applications that work on Linux, Mac and Windows. + +It particularly focuses on creating console applications, web +applications and micro-services. + +%package -n %{simple_name}-sdk-2.1.5xx + +Version: %{sdk_version} +Summary: .NET Core 2.1.5xx Software Development Kit + +Requires: %{simple_name}-runtime-2.1%{?_isa} >= %{runtime_version}-%{release} + +%description -n %{simple_name}-sdk-2.1.5xx +The .NET Core SDK is a collection of command line applications to +create, build, publish and run .NET Core applications. + +.NET Core is a fast, lightweight and modular platform for creating +cross platform applications that work on Linux, Mac and Windows. + +It particularly focuses on creating console applications, web +applications and micro-services. + + +%prep +%setup -q -n %{simple_name}-v%{runtime_version} + +pushd src/corefx +%patch10 -p1 +%patch11 -p1 +popd + +pushd src/coreclr +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +popd + +pushd src/core-setup +%patch300 -p1 +%patch301 -p1 +popd + +pushd src/cli +%patch400 -p1 +popd + +# Fix bad hardcoded path in build +sed -i 's|/usr/share/dotnet|%{_libdir}/%{simple_name}|' src/core-setup/src/corehost/common/pal.unix.cpp + +# Disable warnings +sed -i 's|skiptests|skiptests ignorewarnings|' repos/coreclr.proj + +%if %{use_bundled_libunwind} +# Use bundled libunwind +sed -i 's|-DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE|-DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=FALSE|' repos/coreclr.proj +%endif + +cat source-build-info.txt + + +%build +export DOTNET_CLI_TELEMETRY_OPTOUT=1 + +export LLVM_HOME=/opt/rh/llvm-toolset-6.0/root/usr +export CMAKE_INCLUDE_PATH="/opt/rh/llvm-toolset-6.0/root/usr/include" + +export CFLAGS="%{dotnet_cflags}" +export CXXFLAGS="%{dotnet_cflags}" +export LDFLAGS="%{dotnet_ldflags}" + +test -f Tools/ilasm/ilasm + +Tools/dotnetcli/dotnet --info + +VERBOSE=1 ./build.sh \ + /v:n \ + /p:MinimalConsoleLogOutput=false \ + /p:ContinueOnPrebuiltBaselineError=true + + +%install +install -d -m 0755 %{buildroot}%{_libdir}/%{simple_name}/ +ls bin/x64/Release +tar xf bin/x64/Release/dotnet-sdk-%{sdk_version}-*.tar.gz -C %{buildroot}%{_libdir}/%{simple_name}/ + +# Fix permissions on files +find %{buildroot}%{_libdir}/%{simple_name}/ -type f -name '*.props' -exec chmod -x {} \; +find %{buildroot}%{_libdir}/%{simple_name}/ -type f -name '*.targets' -exec chmod -x {} \; +find %{buildroot}%{_libdir}/%{simple_name}/ -type f -name '*.dll' -exec chmod -x {} \; +find %{buildroot}%{_libdir}/%{simple_name}/ -type f -name '*.pubxml' -exec chmod -x {} \; + +# Add ~/.dotnet/tools to $PATH for all users +install -dm 0755 %{buildroot}%{_sysconfdir}/profile.d/ +install %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/ + +install -dm 755 %{buildroot}/%{_datadir}/bash-completion/completions +# dynamic completion needs the file to be named the same as the base command +install src/cli/scripts/register-completions.bash %{buildroot}/%{_datadir}/bash-completion/completions/dotnet + +# TODO: the zsh completion script needs to be ported to use #compdef +#install -dm 755 %%{buildroot}/%%{_datadir}/zsh/site-functions +#install src/cli/scripts/register-completions.zsh %%{buildroot}/%%{_datadir}/zsh/site-functions/_dotnet + +install -d -m 0755 %{buildroot}%{_bindir} +ln -s %{_libdir}/%{simple_name}/dotnet %{buildroot}%{_bindir}/ + +install -d -m 0755 %{buildroot}%{_mandir}/man1/ +find -iname 'dotnet*.1' -type f -exec cp {} %{buildroot}%{_mandir}/man1/ \; + +# Check debug symbols in all elf objects. This is not in %%check +# because native binaries are stripped by rpm-build after %%install. +# So we need to do this check earlier. +echo "Testing build results for debug symbols..." +%{SOURCE1} -v %{buildroot}%{_libdir}/%{simple_name}/ + + +%check +%{buildroot}%{_libdir}/%{simple_name}/dotnet --info + + +%files -n %{simple_name} +# empty package useful for dependencies + +%files -n %{simple_name}-host +%dir %{_libdir}/%{simple_name} +%{_libdir}/%{simple_name}/dotnet +%dir %{_libdir}/%{simple_name}/host +%dir %{_libdir}/%{simple_name}/host/fxr +%{_bindir}/dotnet +%license %{_libdir}/%{simple_name}/LICENSE.txt +%license %{_libdir}/%{simple_name}/ThirdPartyNotices.txt +%doc %{_mandir}/man1/dotnet*.1.gz +%{_sysconfdir}/profile.d/dotnet.sh +%dir %{_datadir}/bash-completion +%dir %{_datadir}/bash-completion/completions +%{_datadir}/bash-completion/completions/dotnet + +%files -n %{simple_name}-host-fxr-2.1 +%dir %{_libdir}/%{simple_name}/host/fxr +%{_libdir}/%{simple_name}/host/fxr/%{host_version} + +%files -n %{simple_name}-runtime-2.1 +%dir %{_libdir}/%{simple_name}/shared +%dir %{_libdir}/%{simple_name}/shared/Microsoft.NETCore.App +%{_libdir}/%{simple_name}/shared/Microsoft.NETCore.App/%{runtime_version} + +%files -n %{simple_name}-sdk-2.1 +# empty package useful for dependencies + +%files -n %{simple_name}-sdk-2.1.5xx +%dir %{_libdir}/%{simple_name}/sdk +%{_libdir}/%{simple_name}/sdk/%{sdk_version} + +%changelog +* Wed Jun 12 2019 Omair Majid - 2.1.507-4 +- Bump version +- Related: RHBZ#1712158 + +* Mon May 20 2019 Omair Majid - 2.1.507-2 +- Link against strerror_r correctly +- Resolves: RHBZ#1712158 + +* Thu May 02 2019 Omair Majid - 2.1.507-1 +- Update to .NET Core Runtime 2.1.11 and SDK 2.1.507 +- Resolves: RHBZ#1705284 + +* Wed Apr 17 2019 Omair Majid - 2.1.506-2 +- Switch away from SCL dependencies for clang/llvm/lldb +- Resolves: RHBZ#1700908 + +* Tue Apr 09 2019 Omair Majid - 2.1.506-1 +- Update to .NET Core Runtime 2.1.10 and SDK 2.1.506 +- Resolves: RHBZ#1696371 + +* Fri Feb 22 2019 Omair Majid - 2.1.504-1 +- Update to .NET Core Runtime 2.1.8 and SDK 2.1.504 +- Sync with Fedora copr spec file +- Resolves: RHBZ#1646713 + +* Fri Oct 12 2018 Omair Majid - 2.1.403-4 +- Disable telemetry via code, not just environment variable +- Resolves: rhbz#1638093 + +* Thu Oct 11 2018 Omair Majid - 2.1.403-3 +- Disable telemetry by default +- Resolves: rhbz#1638093 + +* Wed Oct 10 2018 Omair Majid - 2.1.403-2 +- Target the latest ASP.NET Core version instead of 2.1.1 +- Resolves: rhbz#1636585 + +* Thu Oct 04 2018 Omair Majid - 2.1.403-1 +- Update to .NET Core Runtime 2.1.5 and SDK 2.1.403 +- Resolves: rhbz#1634182 + +* Mon Oct 01 2018 Omair Majid - 2.1.402-5 +- Backport fix to correct order of SSL_CERT_FILE and SSL_CERT_DIR lookup +- Resolves: rhbz#1633742 + +* Thu Sep 27 2018 Omair Majid - 2.1.402-4 +- Add ~/.dotnet/tools to $PATH to make it easier to use dotnet tools +- Resolves: rhbz#1630439 + +* Tue Sep 25 2018 Omair Majid - 2.1.402-3 +- Update .NET Core Runtime 2.1.4 and SDK 2.1.402 +- Resolves: rhbz#1628997 + +* Tue Sep 11 2018 Omair Majid - 2.1.401-3 +- Use standard flags to build .NET Core +- Resolves: rhbz#1624105 + +* Tue Sep 11 2018 Omair Majid - 2.1.401-2 +- Bundle libunwind +- Resolves: rhbz#1626285 + +* Fri Aug 17 2018 Omair Majid - 2.1.401-1 +- Update .NET Core Runtime 2.1.3 and SDK 2.1.401 +- Drop upstreamed patches + +* Mon Aug 06 2018 Omair Majid - 2.1.302-1 +- Initial build. +- Un-SCLized the package. + +* Wed Jul 4 2018 Omair Majid - 2.1.302-1 +- Update to .NET Core Runtime 2.1.2 and SDK 2.1.302 + +* Wed Jun 20 2018 Omair Majid - 2.1.301-5 +- Add sdk-2.1.3xx subpackage + +* Tue Jun 19 2018 Omair Majid - 2.1.301-4 +- Rebuild to pick up new lttng-ust + +* Tue Jun 19 2018 Omair Majid - 2.1.301-3 +- Add workaround for unreadable system certificates +- Resolves: rhbz#1588099 + +* Tue Jun 19 2018 Omair Majid - 2.1.301-2 +- Add updated man pages +- Resolves: rhbz#1584790 + +* Thu Jun 14 2018 Omair Majid - 2.1.301-1 +- Update to .NET Core SDK 2.1.301 + +* Wed May 30 2018 Omair Majid - 2.1.300-7 +- Explicitly require a modified libcurl + +* Tue May 29 2018 Omair Majid - 2.1.300-6 +- Install bash completions in %%{_root_datadir} + +* Mon May 28 2018 Omair Majid - 2.1.300-5 +- Add provides for dotnet-sdk-2.1.3xx + +* Mon May 28 2018 Omair Majid - 2.1.300-4 +- Remove patch for ASP.NET Core templates. No longer needed for 2.1. + +* Fri May 25 2018 Omair Majid - 2.1.300-3 +- Remove net46 symlink + +* Thu May 24 2018 Omair Majid - 2.1.300-2 +- Rebuild to pick up updated dependencies + +* Thu May 24 2018 Omair Majid - 2.1.300-1 +- New package. Import from Fedora (DotNet SIG package).