From c79e4c521309a8a48a40e0773072872a4e03d5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Thu, 23 Jun 2022 19:18:34 +0200 Subject: [PATCH] Add UseMicrosoftAbi property to switch between gnu/msvc ABIs. Closes #52. --- doc/configuration/properties.md | 20 +++++++++++-------- src/sdk/Sdk/Sdk.props | 1 + src/sdk/Sdk/Sdk.targets | 2 ++ .../build/Vezel.Zig.Sdk.Cross.Host.targets | 3 ++- .../build/Vezel.Zig.Sdk.Cross.Target.targets | 3 ++- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/configuration/properties.md b/doc/configuration/properties.md index 0077ff9..5618d37 100644 --- a/doc/configuration/properties.md +++ b/doc/configuration/properties.md @@ -149,13 +149,12 @@ historical reasons. * `SymbolVisibility` (`Default`, `Hidden`): Specifies the symbol visibility in C/C++ projects when `__attribute__((visibility(...)))` is not specified. `Default` (the default 😉) means public, while `Hidden` means private. -* `EagerBinding` (`true`, `false`): Enables/disables eager binding of symbols - when performing dynamic linking at run time. Eager binding has security - benefits, especially in combination with `RelocationHardening`. It is also - more reliable if calling external functions from signal handlers. Defaults to - `true`. -* `RelocationHardening` (`true`, `false`): Enables/disables marking relocations - as read-only. This has security benefits, especially in combination with +* `EagerBinding` (`true`, `false`): Enable/disable eager binding of symbols when + performing dynamic linking at run time. Eager binding has security benefits, + especially in combination with `RelocationHardening`. It is also more reliable + if calling external functions from signal handlers. Defaults to `true`. +* `RelocationHardening` (`true`, `false`): Enable/disable marking relocations as + read-only. This has security benefits, especially in combination with `EagerBinding`. Defaults to `true`. * `Sanitizers`: A semicolon-separated list of [sanitizers](https://github.com/google/sanitizers) to instrument code with. @@ -168,8 +167,13 @@ historical reasons. specified in `RuntimeIdentifiers`. Usually specified by the user as e.g. `dotnet build -r linux-x64`. Unset by default. * `RuntimeIdentifiers`: A semicolon-separated list of runtime identifiers that - the project supports. All targets on this list will be cross-compiled as + the project supports. All targets in this list will be cross-compiled as necessary. Defaults to all targets that the Zig compiler has known-good support for. +* `UseMicrosoftAbi` (`true`, `false`): Enable/disable using the Microsoft ABI + when targeting Windows. This may be necessary when linking to static libraries + containing C++ code that was compiled for the Microsoft ABI. Note that it is + currently not possible to cross-compile from non-Windows platforms when using + the Microsoft ABI. Unset by default. * `UseEmulator` (`true`, `false`): Enable/disable usage of an appropriate binary emulator when cross-compiling. Defaults to `true`. diff --git a/src/sdk/Sdk/Sdk.props b/src/sdk/Sdk/Sdk.props index 716120e..391741e 100644 --- a/src/sdk/Sdk/Sdk.props +++ b/src/sdk/Sdk/Sdk.props @@ -8,6 +8,7 @@ + diff --git a/src/sdk/Sdk/Sdk.targets b/src/sdk/Sdk/Sdk.targets index c37aded..30d90e0 100644 --- a/src/sdk/Sdk/Sdk.targets +++ b/src/sdk/Sdk/Sdk.targets @@ -9,8 +9,10 @@ + + diff --git a/src/sdk/build/Vezel.Zig.Sdk.Cross.Host.targets b/src/sdk/build/Vezel.Zig.Sdk.Cross.Host.targets index 5b951c8..ec38357 100644 --- a/src/sdk/build/Vezel.Zig.Sdk.Cross.Host.targets +++ b/src/sdk/build/Vezel.Zig.Sdk.Cross.Host.targets @@ -28,8 +28,9 @@ gnu + msvc musl - $(HostAbi)eabihf + $(HostAbi)eabihf diff --git a/src/sdk/build/Vezel.Zig.Sdk.Cross.Target.targets b/src/sdk/build/Vezel.Zig.Sdk.Cross.Target.targets index bb481f2..aea0b3c 100644 --- a/src/sdk/build/Vezel.Zig.Sdk.Cross.Target.targets +++ b/src/sdk/build/Vezel.Zig.Sdk.Cross.Target.targets @@ -37,8 +37,9 @@ gnu + msvc musl - $(TargetAbi)eabihf + $(TargetAbi)eabihf