I am using Windows OS, and the clang version is 8.0.0. I have installed visual studio community.
I am trying on linker scripts for custom memory mapping for one of my programs.
I am compiling and executing a program from the command line. These are the option I tried on windows
clang main.c -ffreestanding -nostartfiles -nodefaultlibs -Wl,-Tlinker.ld -o main
Error Thrown was:
LINK : warning LNK4044: unrecognized option '/T'; ignored linker.ld : fatal error LNK1107: invalid or corrupt file: cannot read at 0x76 clang: error: linker command failed with exit code 1107 (use -v to see invocation)
When I Tried with -fuse-ld=lld-link
,the error was different
lld-link: warning: ignoring unknown argument: -Tlinker.ld
lld-link: error: <root>: undefined symbol: mainCRTStartup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I want to know why the
same commands work on ubuntu but not on windows?
And also kindly let me know the solution to pass linker scripts.
Is there any command for clang on windows which should take linker scripts and clang linker lld-link
at the same time?