Skip to content

Commit

Permalink
Add UseMicrosoftAbi property to switch between gnu/msvc ABIs.
Browse files Browse the repository at this point in the history
Closes #52.
  • Loading branch information
alexrp committed Jun 23, 2022
1 parent bf55399 commit f3f8941
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
20 changes: 12 additions & 8 deletions doc/configuration/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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`.
1 change: 1 addition & 0 deletions src/sdk/Sdk/Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<Import Project="Sdk.props"
Sdk="Microsoft.NET.Sdk" />

<Import Project="../build/Vezel.Zig.Sdk.Core.props" />
<Import Project="../build/Vezel.Zig.Sdk.Items.props" />
<Import Project="../build/Vezel.Zig.Sdk.Build.props" />
Expand Down
2 changes: 2 additions & 0 deletions src/sdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<Import Project="../build/Vezel.Zig.Sdk.Overrides.targets" />
<Import Project="../build/Vezel.Zig.Sdk.Cross.targets" />
<Import Project="../build/Vezel.Zig.Sdk.Symbols.targets" />

<Import Project="Sdk.targets"
Sdk="Microsoft.NET.Sdk" />

<Import Project="../build/Vezel.Zig.Sdk.Hacks.targets" />
<Import Project="../build/Vezel.Zig.Sdk.Defaults.targets" />
<Import Project="../build/Vezel.Zig.Sdk.Defines.targets" />
Expand Down
3 changes: 2 additions & 1 deletion src/sdk/build/Vezel.Zig.Sdk.Cross.Host.targets
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@

<PropertyGroup>
<HostAbi>gnu</HostAbi>
<HostAbi Condition="'$(HostSystem)' == 'windows'">msvc</HostAbi>
<HostAbi Condition="$(HostRuntimeIdentifier.Contains('-musl-'))">musl</HostAbi>
<HostAbi Condition="'$(HostArchitecture)' == 'arm'">$(HostAbi)eabihf</HostAbi>
<HostAbi Condition="'$(HostArchitecture)' == 'arm' and '$(HostAbi)' != 'msvc'">$(HostAbi)eabihf</HostAbi>
</PropertyGroup>

<PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/sdk/build/Vezel.Zig.Sdk.Cross.Target.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@

<PropertyGroup>
<TargetAbi>gnu</TargetAbi>
<TargetAbi Condition="'$(TargetSystem)' == 'windows' and '$(UseMicrosoftAbi)' == 'true'">msvc</TargetAbi>
<TargetAbi Condition="$(TargetRuntimeIdentifier.Contains('-musl-'))">musl</TargetAbi>
<TargetAbi Condition="'$(TargetArchitecture)' == 'arm'">$(TargetAbi)eabihf</TargetAbi>
<TargetAbi Condition="'$(TargetArchitecture)' == 'arm' and '$(TargetAbi)' != 'msvc'">$(TargetAbi)eabihf</TargetAbi>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit f3f8941

Please sign in to comment.