title: How to pass linker script from command line using clang on windows?
body: <p>I am using Windows OS, and the clang version is 8.0.0. I have installed visual studio community.</p>
  
  <p>I am trying on linker scripts for custom memory mapping for one of my programs.</p>
  
  <p>I am compiling and executing a program from the command line.
  These are the option I tried on windows</p>
  
  <pre><code>clang main.c -ffreestanding -nostartfiles -nodefaultlibs -Wl,-Tlinker.ld -o main
  </code></pre>
  
  <p>Error Thrown was:</p>
  
  <blockquote>
  <pre><code>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)
  </code></pre>
  </blockquote>
  
  <p>When I Tried with <code>-fuse-ld=lld-link</code> ,the error was different</p>
  
  <pre><code>lld-link: warning: ignoring unknown argument: -Tlinker.ld
  lld-link: error: &lt;root&gt;: undefined symbol: mainCRTStartup 
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>I want to know why the </p>
  
  <blockquote>
    <p>same commands work on ubuntu but not on windows?</p>
  </blockquote>
  
  <p>And also kindly let me know the solution to pass linker scripts.</p>
  
  <p>Is there any  command for clang on windows which should take linker scripts and clang linker <code>lld-link</code> at the same time?</p>