Skip to content

[feature/damAnalyzer] Merge from main #2298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
de899fa
Skip peverify on CopyOfCoreLibrariesKeepsUnusedTypes (#2247)
mrvoorhe Sep 2, 2021
c40ed49
Stop using git protocol for submodule (#2248)
akoeplinger Sep 2, 2021
3e5edda
Tag analyzer diagnostics as non configurable (#2252)
mateoatr Sep 3, 2021
39505a8
Nullable annotations part 1 (#2253)
sbomer Sep 3, 2021
e160ad7
Revert "Tag analyzer diagnostics as non configurable (#2252)" (#2257)
mateoatr Sep 3, 2021
df8dcdb
Remove preview branding (#2259)
sbomer Sep 6, 2021
a5b54de
Update dependencies from https://github.com/dotnet/runtime build 2021…
dotnet-maestro[bot] Sep 6, 2021
6dc3aa7
[main] Update dependencies from dotnet/arcade (#2261)
dotnet-maestro[bot] Sep 6, 2021
23f5f59
Update edited document before continuing code fixing (#2250)
mateoatr Sep 7, 2021
43fb979
Add a test for #2260 (#2263)
vitek-karas Sep 8, 2021
a9888c2
Workaround NRE in SweepStep (#2264)
vitek-karas Sep 8, 2021
4f28a65
Warn on RUC annotated ctors invoked through `new()` constraint in ana…
mateoatr Sep 8, 2021
8b7695a
Special case `MakeGenericMethod/Type` in RUC analyzer (#2209)
mateoatr Sep 8, 2021
0c359ea
Make ILCompiler more flexible. (#2272)
mrvoorhe Sep 10, 2021
be8ec96
Refactor how test case metadata is obtained. (#2268)
mrvoorhe Sep 11, 2021
7c88b9b
Change occurrences of 'mono/linker' to 'dotnet/linker' (#2277)
mateoatr Sep 16, 2021
6f237bb
Warn on RUC annotated attribute ctors (analyzer) (#2201)
mateoatr Sep 16, 2021
8977a27
Enable nullable on annotations (#2278)
tlakollo Sep 17, 2021
29911cc
Update dependencies from https://github.com/dotnet/arcade build 20210…
dotnet-maestro[bot] Sep 20, 2021
6f6ad01
Update dependencies from https://github.com/dotnet/runtime build 2021…
dotnet-maestro[bot] Sep 20, 2021
ff06442
Mark forwarders for all TypeReferences (#2276) (#2280)
sbomer Sep 20, 2021
c230fdf
Nullable annotations part 3 (#2285)
sbomer Sep 21, 2021
108fe5b
Fix handling of unknown BindingFlags (#2288)
MichalStrehovsky Sep 21, 2021
8097e39
Share logic for discovering typereferences (#2287)
sbomer Sep 23, 2021
c0567db
Minor simplification of the type ref walking code (#2293)
vitek-karas Sep 24, 2021
8108675
Merge remote-tracking branch 'origin/main' into mergeIntoAnalyzer
sbomer Sep 24, 2021
04246b9
Update dependencies from https://github.com/dotnet/arcade build 20210…
dotnet-maestro[bot] Sep 27, 2021
0be1bac
Update dependencies from https://github.com/dotnet/runtime build 2021…
dotnet-maestro[bot] Sep 27, 2021
d31e26e
Make BindingFlagsAreUnsupported more precise (#2296)
MichalStrehovsky Sep 29, 2021
640878a
Analyzer test infra improvements (#2292)
sbomer Sep 29, 2021
3576825
Merge remote-tracking branch 'origin/main' into mergeIntoAnalyzer
sbomer Sep 29, 2021
2e6f5d4
Merge remote-tracking branch 'origin/feature/damAnalyzer' into mergeI…
sbomer Sep 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ dotnet_diagnostic.RS2008.severity = none
# Exception type is not sufficiently specific
dotnet_diagnostic.CA2201.severity = none

# Analyzer crashes with https://github.com/dotnet/roslyn-analyzers/issues/5450
dotnet_diagnostic.CA2252.severity = none

[external**]
dotnet_analyzer_diagnostic.severity = none
generated_code = true
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ investigate bugs, regressions and problems.
License
=======

Check the [LICENSE](https://github.com/mono/linker/blob/main/LICENSE) file.
Check the [LICENSE](https://github.com/dotnet/linker/blob/main/LICENSE) file.

CLA
=======
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "cecil"]
path = external/cecil
url = git://github.com/mono/cecil.git
url = https://github.com/mono/cecil.git
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/mono/linker</RepositoryUrl>
<RepositoryUrl>https://github.com/dotnet/linker</RepositoryUrl>
<_ToolsProjectTargets>$(ArtifactsToolsetDir)Common\Tools.proj.nuget.g.targets</_ToolsProjectTargets>
<!-- Set this to true to build against the package instead of the submodule. -->
<UseCecilPackage Condition="'$(UseCecilPackage)' == ''">false</UseCecilPackage>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Another tool available for developers is implemented as [Roslyn Analyzer](src/IL

# Contributing

We welcome contributions! Many developers have helped make this project better by reporting [issues](https://github.com/mono/linker/issues) or contributing [pull requests](https://github.com/mono/linker/pulls).
We welcome contributions! Many developers have helped make this project better by reporting [issues](https://github.com/dotnet/linker/issues) or contributing [pull requests](https://github.com/dotnet/linker/pulls).

## How to build all projects

Expand All @@ -44,4 +44,4 @@ The same script can be used to run all tests from the terminal. We also have int

## CI Build & Test Status

[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/mono/linker-ci?branchName=main)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=364&branchName=main)
[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/linker-ci?branchName=main)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=364&branchName=main)
2 changes: 1 addition & 1 deletion docs/error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ the error code. For example:

- There was an error writing the linked assembly 'output'. An exception with more details is printed.

#### `IL1012`: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues
#### `IL1012`: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/dotnet/linker/issues

- There was an unexpected error while trimming. An exception with more details is printed to the MSBuild log. Please share this stack trace with the IL Linker team to further investigate the cause and possible solution.

Expand Down
12 changes: 6 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21427.6">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21474.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>474307e526160c813c9fd58060eb8356ccca6099</Sha>
<Sha>3ea0d860c6973f2cbadc9e895c7ec2cbdaec4ad5</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.21427.6">
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.21474.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>474307e526160c813c9fd58060eb8356ccca6099</Sha>
<Sha>3ea0d860c6973f2cbadc9e895c7ec2cbdaec4ad5</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.IL" Version="7.0.0-alpha.1.21430.3">
<Dependency Name="Microsoft.NET.Sdk.IL" Version="7.0.0-alpha.1.21476.2">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>9671726c0a79d5f4cab320b32da1cd4463a0d1be</Sha>
<Sha>78ac8430e8480742181170eef91a6fb016535aa4</Sha>
<!--
This would introduce a cyclic dependency, so it's explictly not enabled for now
<SourceBuild RepoName="runtime" />
Expand Down
10 changes: 4 additions & 6 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
<MajorVersion>7</MajorVersion>
<MinorVersion>0</MinorVersion>
<PatchVersion>100</PatchVersion>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
<!-- Use an unchanging prerelease label so it doesn't need to be updated. -->
<PreReleaseVersionLabel>1</PreReleaseVersionLabel>
</PropertyGroup>
<PropertyGroup>
<UsingToolMicrosoftNetCompilers>true</UsingToolMicrosoftNetCompilers>
<!-- ilasm -->
<MicrosoftNETSdkILPackageVersion>7.0.0-alpha.1.21430.3</MicrosoftNETSdkILPackageVersion>
<MicrosoftNETSdkILPackageVersion>7.0.0-alpha.1.21476.2</MicrosoftNETSdkILPackageVersion>
<!-- see https://github.com/dotnet/runtime/issues/1338 -->
<MicrosoftNETCoreILAsmVersion>$(MicrosoftNETSdkILPackageVersion)</MicrosoftNETCoreILAsmVersion>
<!-- SRM version should match the SDK version at https://github.com/dotnet/sdk/blob/master/eng/Versions.props -->
<SystemReflectionMetadataVersion>5.0.0</SystemReflectionMetadataVersion>
<MicrosoftBuildFrameworkVersion>17.0.0-preview-21267-01</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>17.0.0-preview-21267-01</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftDotNetApiCompatVersion>6.0.0-beta.21427.6</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetApiCompatVersion>7.0.0-beta.21474.2</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetCodeAnalysisVersion>6.0.0-beta.21271.1</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>3.10.0-2.final</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisVersion>3.10.0-2.final</MicrosoftCodeAnalysisVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stages:
parameters:

enableTelemetry: true # send helix telemetry
helixRepo: mono/linker
helixRepo: dotnet/linker
enablePublishUsingPipelines: true
enablePublishBuildArtifacts: true # publish build logs to pipeline storage
${{ if eq(variables.officialBuild, 'false') }}:
Expand Down
40 changes: 10 additions & 30 deletions eng/common/cross/build-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ usage()
{
echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir <directory>]"
echo "BuildArch can be: arm(default), armel, arm64, x86"
echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.9 or alpine3.13. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.13 or alpine3.14. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
echo " for FreeBSD can be: freebsd11, freebsd12, freebsd13"
echo " for illumos can be: illumos."
echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD"
Expand All @@ -32,9 +32,9 @@ __UbuntuPackages="build-essential"
__AlpinePackages="alpine-base"
__AlpinePackages+=" build-base"
__AlpinePackages+=" linux-headers"
__AlpinePackagesEdgeCommunity=" lldb-dev"
__AlpinePackagesEdgeMain+=" python3"
__AlpinePackagesEdgeMain+=" libedit"
__AlpinePackages+=" lldb-dev"
__AlpinePackages+=" python3"
__AlpinePackages+=" libedit"

# symlinks fixer
__UbuntuPackages+=" symlinks"
Expand Down Expand Up @@ -185,23 +185,17 @@ while :; do
__UbuntuRepo=
__Tizen=tizen
;;
alpine|alpine3.9)
alpine|alpine3.13)
__CodeName=alpine
__UbuntuRepo=
__AlpineVersion=3.9
__AlpinePackagesEdgeMain+=" llvm11-libs"
__AlpinePackagesEdgeMain+=" clang-libs"
__AlpineVersion=3.13
__AlpinePackages+=" llvm10-libs"
;;
alpine3.13)
alpine3.14)
__CodeName=alpine
__UbuntuRepo=
__AlpineVersion=3.13
# Alpine 3.13 has all the packages we need in the 3.13 repository
__AlpinePackages+=$__AlpinePackagesEdgeCommunity
__AlpinePackagesEdgeCommunity=
__AlpinePackages+=$__AlpinePackagesEdgeMain
__AlpinePackagesEdgeMain=
__AlpinePackages+=" llvm10-libs"
__AlpineVersion=3.14
__AlpinePackages+=" llvm11-libs"
;;
freebsd11)
__FreeBSDBase="11.3-RELEASE"
Expand Down Expand Up @@ -279,20 +273,6 @@ if [[ "$__CodeName" == "alpine" ]]; then
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
add $__AlpinePackages

if [[ -n "$__AlpinePackagesEdgeMain" ]]; then
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
-X http://dl-cdn.alpinelinux.org/alpine/edge/main \
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
add $__AlpinePackagesEdgeMain
fi

if [[ -n "$__AlpinePackagesEdgeCommunity" ]]; then
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
-X http://dl-cdn.alpinelinux.org/alpine/edge/community \
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
add $__AlpinePackagesEdgeCommunity
fi

rm -r $__ApkToolsDir
elif [[ "$__CodeName" == "freebsd" ]]; then
mkdir -p $__RootfsDir/usr/local/etc
Expand Down
9 changes: 6 additions & 3 deletions eng/common/cross/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
set(TOOLCHAIN "i686-linux-gnu")
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(triple "x86_64-unknown-freebsd11")
set(triple "x86_64-unknown-freebsd12")
elseif (ILLUMOS)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(TOOLCHAIN "x86_64-illumos")
Expand Down Expand Up @@ -91,6 +91,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_ASM_COMPILER_TARGET ${triple})
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld")
elseif(ILLUMOS)
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")

Expand Down Expand Up @@ -138,8 +141,8 @@ function(add_toolchain_linker_flag Flag)
if (NOT Config STREQUAL "")
set(CONFIG_SUFFIX "_${Config}")
endif()
set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE)
set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE)
set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE)
set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE)
endfunction()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
#!/usr/bin/env bash
#
# This file locates the native compiler with the given name and version and sets the environment variables to locate it.
# This file detects the C/C++ compiler and exports it to the CC/CXX environment variables
#

source="${BASH_SOURCE[0]}"

# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"

# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

if [ $# -lt 0 ]
then
if [[ "$#" -lt 2 ]]; then
echo "Usage..."
echo "find-native-compiler.sh <compiler> <compiler major version> <compiler minor version>"
echo "init-compiler.sh <Architecture> <compiler> <compiler major version> <compiler minor version>"
echo "Specify the target architecture."
echo "Specify the name of compiler (clang or gcc)."
echo "Specify the major version of compiler."
echo "Specify the minor version of compiler."
exit 1
fi

. $scriptroot/../pipeline-logging-functions.sh
. "$( cd -P "$( dirname "$0" )" && pwd )"/../pipeline-logging-functions.sh

compiler="$1"
build_arch="$1"
compiler="$2"
cxxCompiler="$compiler++"
majorVersion="$2"
minorVersion="$3"
majorVersion="$3"
minorVersion="$4"

if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi
# clear the existing CC and CXX from environment
CC=
CXX=
LDFLAGS=

if [[ "$compiler" == "gcc" ]]; then cxxCompiler="g++"; fi

check_version_exists() {
desired_version=-1
Expand All @@ -50,38 +43,38 @@ check_version_exists() {
echo "$desired_version"
}

if [ -z "$CLR_CC" ]; then
if [[ -z "$CLR_CC" ]]; then

# Set default versions
if [ -z "$majorVersion" ]; then
if [[ -z "$majorVersion" ]]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi
if [[ "$compiler" == "clang" ]]; then versions=( 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [[ "$compiler" == "gcc" ]]; then versions=( 11 10 9 8 7 6 5 4.9 ); fi

for version in "${versions[@]}"; do
parts=(${version//./ })
desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")"
if [ "$desired_version" != "-1" ]; then majorVersion="${parts[0]}"; break; fi
if [[ "$desired_version" != "-1" ]]; then majorVersion="${parts[0]}"; break; fi
done

if [ -z "$majorVersion" ]; then
if [[ -z "$majorVersion" ]]; then
if command -v "$compiler" > /dev/null; then
if [ "$(uname)" != "Darwin" ]; then
if [[ "$(uname)" != "Darwin" ]]; then
Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH."
fi
export CC="$(command -v "$compiler")"
export CXX="$(command -v "$cxxCompiler")"
CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")"
else
Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found."
exit 1
fi
else
if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
if [[ "$compiler" == "clang" && "$majorVersion" -lt 5 ]]; then
if [[ "$build_arch" == "arm" || "$build_arch" == "armel" ]]; then
if command -v "$compiler" > /dev/null; then
Write-PipelineTelemetryError -category "Build" -type "warning" "Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
export CC="$(command -v "$compiler")"
export CXX="$(command -v "$cxxCompiler")"
CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")"
else
Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
exit 1
Expand All @@ -91,31 +84,40 @@ if [ -z "$CLR_CC" ]; then
fi
else
desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
if [ "$desired_version" = "-1" ]; then
if [[ "$desired_version" == "-1" ]]; then
Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion."
exit 1
fi
fi

if [ -z "$CC" ]; then
export CC="$(command -v "$compiler$desired_version")"
export CXX="$(command -v "$cxxCompiler$desired_version")"
if [ -z "$CXX" ]; then export CXX="$(command -v "$cxxCompiler")"; fi
if [[ -z "$CC" ]]; then
CC="$(command -v "$compiler$desired_version")"
CXX="$(command -v "$cxxCompiler$desired_version")"
if [[ -z "$CXX" ]]; then CXX="$(command -v "$cxxCompiler")"; fi
fi
else
if [ ! -f "$CLR_CC" ]; then
if [[ ! -f "$CLR_CC" ]]; then
Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist"
exit 1
fi
export CC="$CLR_CC"
export CXX="$CLR_CXX"
CC="$CLR_CC"
CXX="$CLR_CXX"
fi

if [ -z "$CC" ]; then
Write-PipelineTelemetryError -category "Build" "Unable to find $compiler."
if [[ -z "$CC" ]]; then
Write-PipelineTelemetryError -category "Build" "Unable to find $compiler."
exit 1
fi

export CCC_CC="$CC"
export CCC_CXX="$CXX"
export SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")"
if [[ "$compiler" == "clang" ]]; then
if command -v "lld$desired_version" > /dev/null; then
# Only lld version >= 9 can be considered stable
if [[ "$majorVersion" -ge 9 ]]; then
LDFLAGS="-fuse-ld=lld"
fi
fi
fi

SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")"

export CC CXX LDFLAGS SCAN_BUILD_COMMAND
Loading