You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering issues while trying to build and link a NativeAOT compiled object file for an EFI application on macOS. Below are the details of the problem and the steps I have taken so far:
Problem Description:
I am working on a project where I need to compile C# code using ILC and link the resulting object file to create an EFI application. The development environment is macOS M1, and I am targeting the x86_64 architecture on .NET8 RC1.
Steps Taken:
Compilation with ILC:
I used the following command to compile the C# code using .NET Native:
Project-Level Compilation with dotnet build:
I also tried defining the csc arguments at the project level in the .csproj file properties and then built the project using dotnet build to ensure that the correct C# version and .NET 8 SDK were being used. However, this did not resolve the issue.
Linking with Clang:
I attempted to link the compiled object file using clang with the following command: clang -o BOOTX64.EFI -target x86_64-unknown-windows -ffreestanding -nostdlib -e EfiMain EFINet8Test.obj -fuse-ld=/usr/local/opt/llvm/bin/lld-link
However, this resulted in an "unknown file type" error, indicating that lld-link does not recognise the format of the .obj file produced by ILC.
Exploration of Alternatives:
I explored using different linkers such as lld-link and ld from MinGW-w64, but none recognised the ILC-produced .obj file format.
I considered converting the object file format using objcopy, but this approach has its complexities.
I also attempted to pass custom clang arguments through the .csproj file using the IlcArg property, but the issue persisted.
Questions:
Is there a known solution or workaround for linking ILC-compiled object files for EFI applications on macOS?
Are there alternative linkers or tools that can recognise and link the .obj file produced by NativeAOT on macOS?
Is it possible to provide custom clang arguments or specify a custom linker through MSBuild or .csproj settings to address this issue?
Any guidance, suggestions, or insights into this problem would be greatly appreciated. Thank you in advance for your help!
The text was updated successfully, but these errors were encountered:
ZeroLP
changed the title
Issues with Linking NativeAOT (ILC) Compiled Object File for EFI Application on macOS
Issues with Linking NativeAOT (ILC) Compiled Object File for EFI Application on macOS (.NET8 RC1)
Sep 23, 2023
Hello,
I am encountering issues while trying to build and link a NativeAOT compiled object file for an EFI application on macOS. Below are the details of the problem and the steps I have taken so far:
Problem Description:
I am working on a project where I need to compile C# code using ILC and link the resulting object file to create an EFI application. The development environment is macOS M1, and I am targeting the x86_64 architecture on .NET8 RC1.
Steps Taken:
Compilation with ILC:
I used the following command to compile the C# code using .NET Native:
Project-Level Compilation with dotnet build:
I also tried defining the csc arguments at the project level in the .csproj file properties and then built the project using dotnet build to ensure that the correct C# version and .NET 8 SDK were being used. However, this did not resolve the issue.
Linking with Clang:
I attempted to link the compiled object file using clang with the following command:
clang -o BOOTX64.EFI -target x86_64-unknown-windows -ffreestanding -nostdlib -e EfiMain EFINet8Test.obj -fuse-ld=/usr/local/opt/llvm/bin/lld-link
However, this resulted in an "unknown file type" error, indicating that lld-link does not recognise the format of the .obj file produced by ILC.
Exploration of Alternatives:
lld-link
andld
from MinGW-w64, but none recognised the ILC-produced .obj file format.objcopy
, but this approach has its complexities.Questions:
Any guidance, suggestions, or insights into this problem would be greatly appreciated. Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: