assembly files and patches

This commit is contained in:
slava86 2021-03-19 20:37:30 +03:00
parent dadb90095f
commit af9227ef64
9 changed files with 801 additions and 0 deletions

17
RID-ROSA.patch Normal file
View file

@ -0,0 +1,17 @@
--- a/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/PublishCoreSetupBinaries.cs 2021-02-27 18:56:00.070820761 +0300
+++ b/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/PublishCoreSetupBinaries.cs 2021-02-27 19:00:56.342954236 +0300
@@ -49,6 +49,14 @@
{
version = version.Substring(0, version.Length - "-osx".Length);
}
+ if (version.Contains("-rosa.2019.1"))
+ {
+ version = version.Substring(0, version.IndexOf("-rosa.2019.1"));
+ }
+ if (version.Contains("-rosa.2019.05"))
+ {
+ version = version.Substring(0, version.IndexOf("-rosa.2019.05"));
+ }
if (version.Contains("-ubuntu"))
{
version = version.Substring(0, version.IndexOf("-ubuntu"));

50
build-bootstrap-tarball Executable file
View file

@ -0,0 +1,50 @@
#!/bin/bash
set -euo pipefail
set -x
sdk_version=3.1.105
arch=$(uname -m)
if [[ $arch == "x86_64" ]]; then
arch=x64
elif [[ $arch == "aarch64" ]]; then
arch=arm64
fi
if rpm -qa | grep libunwind; then
echo "error: libunwind is installed. Not a good idea for bootstrapping."
exit 1
fi
if rpm -qa | grep dotnet ; then
echo "error: dotnet is installed. Not a good idea for bootstrapping."
exit 1
fi
if [ -d /usr/lib/dotnet ] || [ -d /usr/lib64/dotnet ] || [ -d /usr/share/dotnet ] ; then
echo "error: one of /usr/lib/dotnet /usr/lib64/dotnet or /usr/share/dotnet/ exists. Not a good idea for bootstrapping."
exit 1
fi
if command -v dotnet ; then
echo "error: dotnet is in $PATH. Not a good idea for bootstrapping."
exit 1
fi
if [ ! -d dotnet-source-build-tarball ]; then
if [ ! -d source-build ]; then
git clone https://github.com/dotnet/source-build
fi
pushd source-build
sed -i -e 's|cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE||' repos/coreclr.common.props
git clean -xdf
./build-source-tarball.sh ../dotnet-source-build-tarball/ -- -p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000
popd
fi
rm -rf dotnet-v${sdk_version}-SDK dotnet-v${sdk_version}-SDK.tar.gz
cp -a dotnet-source-build-tarball dotnet-v${sdk_version}-SDK
cp -a source-build/artifacts/$arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz dotnet-v${sdk_version}-SDK/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz
tar czf dotnet-v${sdk_version}-SDK-$arch.tar.gz dotnet-v${sdk_version}-SDK

View file

@ -0,0 +1,12 @@
diff --git a/configurecompiler.cmake b/configurecompiler.cmake
index d769e82f57..4936c8b00d 100644
--- a/configurecompiler.cmake
+++ b/configurecompiler.cmake
@@ -474,6 +474,7 @@ if (CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-unused-function)
+ add_compile_options(-Wno-error=misleading-indentation)
#These seem to indicate real issues
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)

134
build-dotnet-tarball Executable file
View file

@ -0,0 +1,134 @@
#!/bin/bash
# Usage:
# build-dotnet-tarball <tag-from-source-build>
#
# Creates a source archive from a tag (or commit) at github.com/dotnet/source-build
# Source-build is a little strange, we need to clone it, check out the
# tag, build it and then create a tarball from the archive directory
# it creates. Also, it is likely that the source archive is only
# buildable on the OS it was initially created in.
set -euo pipefail
IFS=$'\n\t'
print_usage() {
echo "Usage:"
echo "$0 <tag-from-source-build>"
echo
echo "Creates a source archive from a tag at https://github.com/dotnet/source-build"
}
clean_dotnet_cache() {
rm -rf ~/.aspnet ~/.dotnet/ ~/.nuget/ ~/.local/share/NuGet ~/.templateengine
rm -rf /tmp/NuGet /tmp/NuGetScratch /tmp/.NETCore* /tmp/.NETStandard* /tmp/.dotnet /tmp/dotnet.* /tmp/clr-debug-pipe* /tmp/Razor-Server /tmp/CoreFxPipe* /tmp/VBCSCompiler /tmp/.NETFramework*
}
function runtime_id {
declare -A archmap
archmap=(
["aarch64"]="arm64"
["amd64"]="x64"
["armv8l"]="arm"
["i686"]="x86"
["i386"]="x86"
["x86_64"]="x64"
)
arch=${archmap["$(uname -m)"]}
source /etc/os-release
case "${ID}" in
# Remove the RHEL minor version
rhel) rid_version=${VERSION_ID%.*} ;;
*) rid_version=${VERSION_ID} ;;
esac
echo "${ID}.${rid_version}-${arch}"
}
positional_args=()
while [[ "$#" -gt 0 ]]; do
arg="${1}"
case "${arg}" in
-h|--help)
print_usage
exit 0
;;
*)
positional_args+=("$1")
shift
;;
esac
done
tag=${positional_args[0]:-}
if [[ -z ${tag} ]]; then
echo "error: missing tag to build"
exit 1
fi
set -x
dir_name="dotnet-${tag}"
unmodified_tarball_name="${dir_name}-original"
tarball_name="${dir_name}"
if [ -f "${tarball_name}.tar.gz" ]; then
echo "error: ${tarball_name}.tar.gz already exists"
exit 1
fi
if [ ! -f "${unmodified_tarball_name}.tar.gz" ]; then
temp_dir=$(mktemp -d -p "$(pwd)")
pushd "${temp_dir}"
git clone https://github.com/dotnet/source-build
pushd source-build
git checkout "${tag}"
git submodule update --init --recursive
clean_dotnet_cache
sed -i -e 's|cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE||' repos/coreclr.proj
patch -p1 < ../../RID-ROSA.patch
mkdir -p patches/cli
cp ../../dotnet-pull10652.patch patches/cli/
mkdir -p patches/coreclr/
cp ../../build-coreclr-clang10.patch patches/coreclr/
cp ../../coreclr-libunwind-fno-common.patch patches/coreclr/
mkdir -p patches/corefx/
cp ../../corefx-42900-clang-10.patch patches/corefx/
mkdir -p patches/aspnetcore/
cp ../../disable-aspnetcore-targetingpackoverride.patch patches/aspnetcore/
./build.sh \
/p:ArchiveDownloadedPackages=true \
/p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000 \
/p:DownloadSourceBuildReferencePackagesTimeoutSeconds=100000
./build-source-tarball.sh "${unmodified_tarball_name}" --skip-build
popd
popd
tar czf "${unmodified_tarball_name}.tar.gz" -C "${temp_dir}/source-build" "${unmodified_tarball_name}"
rm -rf "${temp_dir}"
fi
rm -rf "${tarball_name}"
tar xf "${unmodified_tarball_name}.tar.gz"
mv "${unmodified_tarball_name}" "${tarball_name}"
pushd "${tarball_name}"
Remove files with funny licenses, crypto implementations and other
not-very-useful artifacts to reduce tarball size
find -type f -iname '*.tar.gz' -delete
rm -rf .dotnet
rm -r src/aspnetcore.*/src/SignalR/clients/java/signalr/gradle*
find src/aspnetcore.*/src -type d -name samples -print0 | xargs -0 rm -r
rm -r src/NuGet.Client.*/test/EndToEnd/ProjectTemplates/NetCoreWebApplication1.0.zip
find src/coreclr.*/ -depth -name tests -print0 | xargs -0 rm -r
popd
tar czf "${tarball_name}.tar.gz" "${tarball_name}"

View file

@ -0,0 +1,402 @@
From 29e17d8d2ccbca07c423e3089a6d5ae8a1c9cb6e Mon Sep 17 00:00:00 2001
From: Yichao Yu <yyc1992@gmail.com>
Date: Tue, 31 Mar 2020 00:43:32 -0400
Subject: [PATCH] Fix compilation with -fno-common.
Making all other archs consistent with IA64 which should not have this problem.
Also move the FIXME to the correct place.
Also add some minimum comments about this...
---
src/aarch64/Ginit.c | 15 +++++++--------
src/arm/Ginit.c | 15 +++++++--------
src/coredump/_UPT_get_dyn_info_list_addr.c | 5 +++++
src/hppa/Ginit.c | 15 +++++++--------
src/ia64/Ginit.c | 1 +
src/mi/Gfind_dynamic_proc_info.c | 1 +
src/mips/Ginit.c | 15 +++++++--------
src/ppc32/Ginit.c | 11 +++++++----
src/ppc64/Ginit.c | 11 +++++++----
src/ptrace/_UPT_get_dyn_info_list_addr.c | 5 +++++
src/s390x/Ginit.c | 15 +++++++--------
src/sh/Ginit.c | 15 +++++++--------
src/tilegx/Ginit.c | 15 +++++++--------
src/x86/Ginit.c | 15 +++++++--------
src/x86_64/Ginit.c | 15 +++++++--------
15 files changed, 89 insertions(+), 80 deletions(-)
diff --git a/src/pal/src/libunwind/src/aarch64/Ginit.c b/src/pal/src/libunwind/src/aarch64/Ginit.c
index dec235c82..35389762f 100644
--- a/src/pal/src/libunwind/src/aarch64/Ginit.c
+++ b/src/pal/src/libunwind/src/aarch64/Ginit.c
@@ -61,13 +61,6 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -78,7 +71,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/arm/Ginit.c b/ssrc/pal/src/libunwind/src/arm/Ginit.c
index 2720d063a..0bac0d72d 100644
--- a/src/pal/src/libunwind/src/arm/Ginit.c
+++ b/src/pal/src/libunwind/src/arm/Ginit.c
@@ -57,18 +57,17 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
index 0d1190556..739ed0569 100644
--- a/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
+++ b/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
@@ -74,6 +74,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
#else
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
static inline int
get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
int *countp)
diff --git a/src/pal/src/libunwind/src/hppa/Ginit.c b/src/pal/src/libunwind/src/hppa/Ginit.c
index 461e4b93d..265455a68 100644
--- a/src/pal/src/libunwind/src/hppa/Ginit.c
+++ b/src/pal/src/libunwind/src/hppa/Ginit.c
@@ -64,13 +64,6 @@ _Uhppa_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -81,7 +74,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ia64/Ginit.c b/src/pal/src/libunwind/src/ia64/Ginit.c
index b09a2ad57..8601bb3ca 100644
--- a/src/pal/src/libunwind/src/ia64/Ginit.c
+++ b/src/pal/src/libunwind/src/ia64/Ginit.c
@@ -68,6 +68,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
if (!_U_dyn_info_list_addr)
return -UNW_ENOINFO;
#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
*dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c b/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
index 98d350128..2e7c62e5e 100644
--- a/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
+++ b/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
@@ -49,6 +49,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
return -UNW_ENOINFO;
#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr ();
for (di = list->first; di; di = di->next)
if (ip >= di->start_ip && ip < di->end_ip)
diff --git a/src/pal/src/libunwind/src/mips/Ginit.c b/src/pal/src/libunwind/src/mips/Ginit.c
index 3df170c75..bf7a8f5a8 100644
--- a/src/pal/src/libunwind/src/mips/Ginit.c
+++ b/src/pal/src/libunwind/src/mips/Ginit.c
@@ -69,13 +69,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -86,7 +79,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ppc32/Ginit.c b/src/pal/src/libunwind/src/ppc32/Ginit.c
index ba302448a..7b4545580 100644
--- a/src/pal/src/libunwind/src/ppc32/Ginit.c
+++ b/src/pal/src/libunwind/src/ppc32/Ginit.c
@@ -91,9 +91,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -104,7 +101,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ppc64/Ginit.c b/src/pal/src/libunwind/src/ppc64/Ginit.c
index 4c88cd6e7..7bfb395a7 100644
--- a/src/pal/src/libunwind/src/ppc64/Ginit.c
+++ b/src/pal/src/libunwind/src/ppc64/Ginit.c
@@ -95,9 +95,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -108,7 +105,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
index cc5ed0441..16671d453 100644
--- a/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
@@ -71,6 +71,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
#else
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
static inline int
get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
int *countp)
diff --git a/src/pal/src/libunwind/src/sh/Ginit.c b/src/pal/src/libunwind/src/sh/Ginit.c
index 52988a721..9fe96d2bd 100644
--- a/src/pal/src/libunwind/src/sh/Ginit.c
+++ b/src/pal/src/libunwind/src/sh/Ginit.c
@@ -58,13 +58,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -75,7 +68,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/tilegx/Ginit.c b/src/pal/src/libunwind/src/tilegx/Ginit.c
index 7564a558b..925e64132 100644
--- a/src/pal/src/libunwind/src/tilegx/Ginit.c
+++ b/src/pal/src/libunwind/src/tilegx/Ginit.c
@@ -64,13 +64,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -81,7 +74,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/x86/Ginit.c b/src/pal/src/libunwind/src/x86/Ginit.c
index f6b8dc27d..3cec74a21 100644
--- a/src/pal/src/libunwind/src/x86/Ginit.c
+++ b/src/pal/src/libunwind/src/x86/Ginit.c
@@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
# endif /* UNW_LOCAL_ONLY */
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -71,7 +64,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}
diff --git a/src/pal/src/libunwind/src/x86_64/Ginit.c b/src/pal/src/libunwind/src/x86_64/Ginit.c
index a865d3385..fd8d418b1 100644
--- a/src/pal/src/libunwind/src/x86_64/Ginit.c
+++ b/src/pal/src/libunwind/src/x86_64/Ginit.c
@@ -49,13 +49,6 @@ static struct unw_addr_space local_addr_space;
unw_addr_space_t unw_local_addr_space = &local_addr_space;
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
- by a remote unwinder. On ia64, this is done via a special
- unwind-table entry. Perhaps something similar can be done with
- DWARF2 unwind info. */
-
static void
put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
@@ -66,7 +59,13 @@ static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
void *arg)
{
- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
return 0;
}

View file

@ -0,0 +1,70 @@
From 58d6cd09bd2d5b1085c6572c1d97b8533cf8294b Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Fri, 3 Apr 2020 13:53:09 -0400
Subject: [PATCH] Fix corefx to build on clang 10
Clang 10 adds/enables new warnings, some of which is affecting
the corefx code.
Clang 10 has added -Walloca to warn about uses of alloca. This commit
replaces the only non-compliant use of that with a single fixed
stack-allocated buffer.
Clang 10 has also added -Wimplicit-int-float-conversion. This commit
uses explicit casts to double to avoid the warnings.
This is a backport of dotnet/runtime#33734 to corefx.
After this commit, I can build all of corefx with Clang 10.
---
src/Native/Unix/System.Native/pal_io.c | 20 +++++++++++---------
src/Native/Unix/System.Native/pal_time.c | 2 +-
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/Native/Unix/System.Native/pal_io.c b/src/Native/Unix/System.Native/pal_io.c
index 2d51edacf5ee..c7c42eb3e72b 100644
--- a/src/Native/Unix/System.Native/pal_io.c
+++ b/src/Native/Unix/System.Native/pal_io.c
@@ -906,18 +906,20 @@ int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, int32_t mi
return Error_EINVAL;
}
- size_t bufferSize;
- if (!multiply_s(sizeof(struct pollfd), (size_t)eventCount, &bufferSize))
+ struct pollfd stackBuffer[(uint32_t)(2048/sizeof(struct pollfd))];
+ int useStackBuffer = eventCount <= (sizeof(stackBuffer)/sizeof(stackBuffer[0]));
+ struct pollfd* pollfds = NULL;
+ if (useStackBuffer)
{
- return SystemNative_ConvertErrorPlatformToPal(EOVERFLOW);
+ pollfds = (struct pollfd*)&stackBuffer[0];
}
-
-
- int useStackBuffer = bufferSize <= 2048;
- struct pollfd* pollfds = (struct pollfd*)(useStackBuffer ? alloca(bufferSize) : malloc(bufferSize));
- if (pollfds == NULL)
+ else
{
- return Error_ENOMEM;
+ pollfds = (struct pollfd*)calloc(eventCount, sizeof(*pollfds));
+ if (pollfds == NULL)
+ {
+ return Error_ENOMEM;
+ }
}
for (uint32_t i = 0; i < eventCount; i++)
diff --git a/src/Native/Unix/System.Native/pal_time.c b/src/Native/Unix/System.Native/pal_time.c
index 1a7c862749d1..54ebde60a83b 100644
--- a/src/Native/Unix/System.Native/pal_time.c
+++ b/src/Native/Unix/System.Native/pal_time.c
@@ -169,7 +169,7 @@ int32_t SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo)
uint64_t resolution = SystemNative_GetTimestampResolution();
uint64_t timestamp = SystemNative_GetTimestamp();
- uint64_t currentTime = (uint64_t)(timestamp * ((double)SecondsToNanoSeconds / resolution));
+ uint64_t currentTime = (uint64_t)((double)timestamp * ((double)SecondsToNanoSeconds / (double)resolution));
uint64_t lastRecordedCurrentTime = previousCpuInfo->lastRecordedCurrentTime;
uint64_t lastRecordedKernelTime = previousCpuInfo->lastRecordedKernelTime;

View file

@ -0,0 +1,11 @@
--- Directory.Build.props 2020-06-04 17:54:26.587622453 -0500
+++ Directory.Build.props 2020-06-04 17:54:43.948536557 -0500
@@ -145,8 +145,6 @@
<!-- The location of the local installation of the .NET Core shared framework. -->
<PropertyGroup>
<LocalDotNetRoot>$(RepoRoot).dotnet\</LocalDotNetRoot>
- <!-- Override the SDK default and point to local .dotnet folder. -->
- <NetCoreTargetingPackRoot>$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
</PropertyGroup>
<Import Project="eng\tools\RepoTasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />

104
dotnet-pull10652.patch Normal file
View file

@ -0,0 +1,104 @@
From 49891b96c12567109d6086a23ca7c117dd40bdc7 Mon Sep 17 00:00:00 2001
From: sfoslund <sfoslund@microsoft.com>
Date: Fri, 14 Feb 2020 15:05:24 -0800
Subject: [PATCH] Resolving and adding test coverage for stack dump on dotnet
-d
---
.../LocalToolsCommandResolver.cs | 3 +-
src/Cli/dotnet/Program.cs | 4 +++
.../GivenALocalToolsCommandResolver.cs | 13 ++++++++
.../CommandTests/CommandIntegrationTests.cs | 31 +++++++++++++++++++
4 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 src/Tests/dotnet.Tests/CommandTests/CommandIntegrationTests.cs
diff --git a/src/dotnet/CommandFactory/CommandResolution/LocalToolsCommandResolver.cs b/src/dotnet/CommandFactory/CommandResolution/LocalToolsCommandResolver.cs
index fae180cbde..59af704755 100644
--- a/src/dotnet/CommandFactory/CommandResolution/LocalToolsCommandResolver.cs
+++ b/src/dotnet/CommandFactory/CommandResolution/LocalToolsCommandResolver.cs
@@ -57,7 +57,8 @@ public CommandSpec Resolve(CommandResolverArguments arguments)
return null;
}
- if (!arguments.CommandName.StartsWith(LeadingDotnetPrefix, StringComparison.OrdinalIgnoreCase))
+ if (!arguments.CommandName.StartsWith(LeadingDotnetPrefix, StringComparison.OrdinalIgnoreCase) ||
+ string.IsNullOrWhiteSpace(arguments.CommandName.Substring(LeadingDotnetPrefix.Length)))
{
return null;
}
diff --git a/src/dotnet/Program.cs b/src/dotnet/Program.cs
index 8b9cccfe0b..67e784bbf3 100644
--- a/src/dotnet/Program.cs
+++ b/src/dotnet/Program.cs
@@ -216,6 +216,10 @@ internal static int ProcessArgs(string[] args, ITelemetry telemetryClient = null
exitCode = builtIn.Command(appArgs.ToArray());
}
+ else if (string.IsNullOrEmpty(topLevelCommandParserResult.Command))
+ {
+ exitCode = 0;
+ }
else
{
CommandResult result = CommandFactoryUsingResolver.Create(
diff --git a/test/Microsoft.DotNet.CommandFactory.Tests/GivenALocalToolsCommandResolver.cs b/test/Microsoft.DotNet.CommandFactory.Tests/GivenALocalToolsCommandResolver.cs
index 4235f2055e..07bd774c97 100644
--- a/test/Microsoft.DotNet.CommandFactory.Tests/GivenALocalToolsCommandResolver.cs
+++ b/test/Microsoft.DotNet.CommandFactory.Tests/GivenALocalToolsCommandResolver.cs
@@ -79,6 +79,19 @@ public void WhenResolveItCanFindToolExecutable(string toolCommand)
commandPath.Should().Be(fakeExecutable.Value);
}
+ [Fact]
+ public void WhenResolveWithNoArgumentsItReturnsNull()
+ {
+ (FilePath fakeExecutable, LocalToolsCommandResolver localToolsCommandResolver) = DefaultSetup("-d");
+
+ var result = localToolsCommandResolver.Resolve(new CommandResolverArguments()
+ {
+ CommandName = "-d",
+ });
+
+ result.Should().BeNull();
+ }
+
private (FilePath, LocalToolsCommandResolver) DefaultSetup(string toolCommand)
{
NuGetVersion packageVersionA = NuGetVersion.Parse("1.0.4");
diff --git a/test/dotnet.Tests/CommandTests/CommandIntegrationTests.cs b/test/dotnet.Tests/CommandTests/CommandIntegrationTests.cs
new file mode 100644
index 0000000000..30e5bfdbb7
--- /dev/null
+++ b/test/dotnet.Tests/CommandTests/CommandIntegrationTests.cs
@@ -0,0 +1,31 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using FluentAssertions;
+using Microsoft.NET.TestFramework;
+using Microsoft.NET.TestFramework.Commands;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Microsoft.DotNet.Tests.Commands
+{
+ public class CommandIntegrationTests : SdkTest
+ {
+ public CommandIntegrationTests(ITestOutputHelper log) : base(log) {}
+
+ [Fact]
+ public void GivenNoArgumentsProvided()
+ {
+ var cmd = new DotnetCommand(Log).Execute(string.Empty);
+ cmd.StdErr.Should().BeEmpty();
+ }
+
+ [Fact]
+ public void GivenOnlyArgumentProvidedIsDiagnosticsFlag()
+ {
+ var cmd = new DotnetCommand(Log).Execute("-d");
+ cmd.ExitCode.Should().Be(0);
+ cmd.StdErr.Should().BeEmpty();
+ }
+ }
+}

View file

@ -78,6 +78,7 @@ Patch101: corefx-39686-cgroupv2-01.patch
Patch102: corefx-39686-cgroupv2-02.patch
Patch103: corefx-39633-cgroupv2-mountpoints.patch
# Adding Rosalinux to the group to generate RID
# https://github.com/dotnet/source-build/issues/2095
Patch104: corefx-Rosalinux-groups.patch
# https://github.com/dotnet/corefx/pull/43032