Skip to content

Conversation

@sdmaclea
Copy link
Contributor

@sdmaclea sdmaclea commented Jun 5, 2020

Update to upstream libunwind which includes ability to cross compile on Windows.

Modify CLR's build system for building on Windows

Rework our CMakefiles to eventually avoid the collision with the ones upstreamed for building Windows.

/cc @mikem8361

@sdmaclea sdmaclea marked this pull request as draft June 5, 2020 21:33
@sdmaclea sdmaclea self-assigned this Jun 5, 2020
Pull upstream libunwind which supports building on Windows
@sdmaclea sdmaclea force-pushed the WindowsUnwindMaster branch from e44675f to 40e50fc Compare June 11, 2020 01:19
@sdmaclea sdmaclea marked this pull request as ready for review June 11, 2020 19:42
@sdmaclea sdmaclea requested a review from janvorli June 11, 2020 19:42
# MSVC compiler is currently missing C11 _Thread_local
check_c_source_compiles("void main() { _Thread_local int a; }" HAVE_THREAD_LOCAL)
if (NOT HAVE_THREAD_LOCAL)
add_definitions(-D_Thread_local=)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we define it as thread_local instead of empty string?

Copy link
Contributor Author

@sdmaclea sdmaclea Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C, thread_local is defined as _Thread_local by thread.h. Support for both seem to be missing from MSVC when compiled as C. (I might be wrong for MSVC non-standard implementation though)

Since we are only using this for DAC unwind, I assumed thread_local didn't matter, but I might be proven wrong.

@sdmaclea sdmaclea force-pushed the WindowsUnwindMaster branch from b28cdd7 to 89ad2a2 Compare June 11, 2020 23:36
@sdmaclea
Copy link
Contributor Author

sdmaclea commented Jun 12, 2020

@janvorli I have made a good faith attempt to resolve your comments. I believe it is a reasonable start.

I kept upstream include\config.h.cmake.in for Windows as this is what is used upstream.
I kept src\config.in & src\configure.cmake. It would be nicer share with Windows, but at the moment, it was simpler to keep them separate.

I guess I could switch windows to using the Linux ones.... And ignore upstream include/config.h.cmake.in. I guess the nice thing would be we would completely own our version of the build system.

I guess I'll take that approach.

@sdmaclea
Copy link
Contributor Author

@janvorli This should be ready for your review.

@sdmaclea sdmaclea requested a review from janvorli June 16, 2020 16:16
@sdmaclea sdmaclea added this to the 5.0.0 milestone Jun 17, 2020
@sdmaclea
Copy link
Contributor Author

@janvorli ping

@sdmaclea sdmaclea requested a review from mikem8361 June 17, 2020 17:23
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@janvorli
Copy link
Member

@sdmaclea I am sorry for the delay.

@sdmaclea
Copy link
Contributor Author

@janvorli No problem. Thanks for the reviews.

@sdmaclea sdmaclea merged commit 129c19d into dotnet:master Jun 18, 2020
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Jun 25, 2020
Libunwind 1.5rc2 again (dotnet/runtime#36988)

* Add arm64 support for UNWIND_CONTEXT_IS_UCONTEXT_T==0

* Reapply libunwind 1.5rc2

* Fix Linux Alpine libunwind1.5rc2

Add libunwind to cross DAC (dotnet/runtime#37521)

* Libunwind v1.5-rc1-28-g9165d2a1

Pull upstream libunwind which supports building on Windows

* Alignas and typos libunwind/libunwind#186
* Update libunwind-version.txt

* Add libunwind to cross DAC

* Colocate Unix/Windows compiler config
* Unify Windows/Unix configure.cmake
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Jun 25, 2020
Libunwind 1.5rc2 again (dotnet/runtime#36988)

* Add arm64 support for UNWIND_CONTEXT_IS_UCONTEXT_T==0

* Reapply libunwind 1.5rc2

* Fix Linux Alpine libunwind1.5rc2

Add libunwind to cross DAC (dotnet/runtime#37521)

* Libunwind v1.5-rc1-28-g9165d2a1

Pull upstream libunwind which supports building on Windows

* Alignas and typos libunwind/libunwind#186
* Update libunwind-version.txt

* Add libunwind to cross DAC

* Colocate Unix/Windows compiler config
* Unify Windows/Unix configure.cmake
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Jul 1, 2020
 + Auto renames for (dotnet/coreclr/dotnet#26080)
 + Rename _WIN64 define to BIT64 (dotnet#26080)
 + Remove stray sos reference (dotnet/runtime/dotnet#1875)
 + Fix MSVC warn as errors... (dotnet/runtime/dotnet#1876)
 + Remove unused/unnecessary defines (dotnet/runtime/dotnet#1878)
 + Rename CLR_CMAKE_PLATFORM* CLR_CMAKE_HOST* (dotnet/runtime/#1974)
 + Rename PAL_CMAKE_* CLR_CMAKE_* (dotnet/runtime/dotnet#1984)
 + Add alpinedac & linuxdac build options (dotnet/runtime/dotnet#2056)
 + Refactor CMake system to allow cross OS DAC compile (dotnet/runtime/#2054)
 + Add FEATURE_REMOTE_PROC_MEM (dotnet/runtime/dotnet#2244)
 + Fix compilation of dbgtransportsession (dotnet/runtime/dotnet#2247)
 + Auto renames from (dotnet/runtime/#2256)
 + Rename cross compilation related defines (dotnet/runtime/#2256)
 + Fix logic to disable mscordbi build (dotnet/runtime/#31745)
 + Fix unused variable warning (dotnet/runtime/#31747)
 + Remove GetRecycleMemoryInfo from DAC builds (dotnet/runtime/#31748)
 + Fix check.* cross compilation linker errors (dotnet/runtime/#31751)
 + Reduce PAL DAC exports (dotnet/runtime/#31749)
 + Add EMPTY_BASES_DECL (dotnet/runtime/dotnet#26980)
 + Disable linux unwinder on Windows (dotnet/runtime/#31777)
 + Add cross OS support for MAKEDLLNAME (dotnet/runtime/#31746)
 + Fix host compiler when cross OS DAC compiling (dotnet/runtime/#31775)
 + Fix arm64singlestepper #ifdef (dotnet/runtime/#31776)
 + Configure host features based on host OS (dotnet/runtime/#31778)
 + Configure Host OS APIs based on HOST macros (dotnet/runtime/#31774)
 + Use common CLR_CMAKE_* variables in more places (dotnet/runtime/#31659)
 + Add T_CRITICAL_SECTION for cross OS DAC compile (dotnet/runtime/#31908)
 + Fix arm cross OS DAC compilation (dotnet/runtime/#31903)
 + Add CrossOS DAC build back (dotnet/runtime/#33064)
 + Fix typo (dotnet/runtime/#33192)
 + Fix type layout whan Cross OS compiling (dotnet/runtime/#33487)
 + Partial revert auto renames from (dotnet/runtime/dotnet#2056)
 + Partial revert (dotnet/runtime/dotnet#26080)
 + Enable cross OS DBI build(dotnet/runtime/#35021)
 + Disable EMPTY_BASE_DECL except for cross OS DAC
 + Fix DBI type layout issues
   + Add utilcode_dbi
   + Consistently define DBI features
   + Define T_CRITICAL_SECTION during non-DAC builds
 + Port cross DAC unwind support to 3.1
   + Libunwind 1.5rc2 again (dotnet/runtime#36988)
 + Add libunwind to cross DAC (dotnet/runtime#37521)
@sdmaclea sdmaclea deleted the WindowsUnwindMaster branch September 26, 2020 16:53
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants