Skip to content

Commit

Permalink
[dotnet] Handle more complex variations of LinkerFlag.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Jun 23, 2023
1 parent e6744bf commit 17c96c9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1281,12 +1281,35 @@
Note: this means ILC doesn't support linker flags with spaces in them.
Additionally, the LinkerArg item group are actually passed to the
native compiler by the NativeAOT build tasks, not the native
linker. This means they might contain wrapped linker arguments:
'-Wl,...', which the compiler understands, but not the linker.
Thus we need to unwrap the (compiler) arguments in LinkerArgs to
be actual linker arguments. Also note that there can be multiple
linker arguments passed using a single compiler argument, and
those are separated by a comma: "-Wl,-linkerarg1,-linkerarg2", so
we need to split those into multiple linker arguments as well. And
to make things even more complicated, there may be quotes as well:
<LinkerArg>'-Wl,-linkerarg1,-linkerarg2'</LinkerArg>.
-->
<PropertyGroup>
<_LinkerArgsSplitBySemiColon>@(LinkerArg->Replace(' ',';'))</_LinkerArgsSplitBySemiColon>
</PropertyGroup>
<ItemGroup>
<_CustomLinkFlags Include="$(_LinkerArgsSplitBySemiColon.Split(';'))" />
<_AllLinkerArgs Include="$(_LinkerArgsSplitBySemiColon.Split(';'))" />
<_LinkerArgsWhichAreReallyCompilerArgs Include="@(_AllLinkerArgs)" Condition="%(Identity.StartsWith('-Wl,'))" />
<_CompilerArgsTransformedToLinkerArgs Include="@(_LinkerArgsWhichAreReallyCompilerArgs -> '%(Identity.Substring (4))')" />
</ItemGroup>
<PropertyGroup>
<_CompilerArgsTransformedToLinkerArgsSplitByComma>@(_CompilerArgsTransformedToLinkerArgs->Replace(',',';'))</_CompilerArgsTransformedToLinkerArgsSplitByComma>
</PropertyGroup>
<ItemGroup>
<_AllLinkerArgs Remove="@(_LinkerArgsWhichAreReallyCompilerArgs)" />
<_AllLinkerArgs Include="$(_CompilerArgsTransformedToLinkerArgsSplitByComma.Split(';'))" />

<_CustomLinkFlags Include="@(_AllLinkerArgs)" />
</ItemGroup>

<ItemGroup>
Expand Down

6 comments on commit 17c96c9

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 17c96c99afab5ef563bb897f0876ea78822485b6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ API diff for current PR / commit

NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

.NET (No breaking changes)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 17c96c99afab5ef563bb897f0876ea78822485b6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

📚 [CI Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: simulator tests

0 tests crashed, 5 tests failed, 87 tests passed.

Failures

❌ dotnettests tests

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ linker tests

1 tests failed, 39 tests passed.
  • dont link/Mac Catalyst [dotnet]/Debug [dotnet]: BuildFailure

Html Report (VSDrops) Download

❌ monotouch tests

3 tests failed, 23 tests passed.
  • monotouch-test/Mac Catalyst [dotnet]/Release (NativeAOT, x64) [dotnet]: BuildFailure
  • monotouch-test/iOS Unified 64-bits - simulator/Release (NativeAOT) [dotnet]: BuildFailure
  • monotouch-test/tvOS - simulator/Release (NativeAOT) [dotnet]: BuildFailure

Html Report (VSDrops) Download

Successes

⚠️ bcl: No tests selected. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ framework: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 1 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 4 tests passed. Html Report (VSDrops) Download
⚠️ install_source: No tests selected. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
⚠️ mac_binding_project: No tests selected. Html Report (VSDrops) Download
⚠️ mmp: No tests selected. Html Report (VSDrops) Download
⚠️ mononative: No tests selected. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
⚠️ mtouch: No tests selected. Html Report (VSDrops) Download
⚠️ xammac: No tests selected. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 17c96c99afab5ef563bb897f0876ea78822485b6 [CI build]

Please sign in to comment.