I am trying to send the linker scripts for one of the simple c program . I tried on both on Ubuntu and Windows.
On Ubuntu
After some research I found out that it was taking GNU-ld
,so With clang command line option -fuse-ld=lld
,So now I linked with clang default linker lld
I tried with this command
clang main.c -ffreestanding -nostartfiles -nodefaultlibs -fuse-ld=lld -Wl,-Map,output.map,-T Example_Linker.ld -o main
Everything works correctly. I got the memory map file and also able to pass linker scripts.
On Windows
Clang initially look for Microsoft Visual Studio Linker link.exe
for to generate executables.
It wont support Linker scripts.
So with -fuse-ld=lld
I tried the below command
clang main.c -ffreestanding -nostartfiles -nodefaultlibs -fuse-ld=lld -Wl,-Map,output.map,-T Example_Linker.ld -o main
So now error thrown was
clang: error: unknown argument: '-Map'
lld-link: warning: ignoring unknown argument: -T
How should I write a command so I may be able to get a memory map file and in same time I can pass Linker Scripts?
kindly help me with solution.