title: arm-none-eabi-ld - "cannot find gc-sections"
body: <p>I am setting up a CMake build for an excisting project, and has successfully compiled all sources (.c) and reached the linker-stage.</p>
  
  <p>Here I run into the following error:</p>
  
  <p>/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: cannot find gc-sections: No such file or directory.</p>
  
  <p>The compilation is done using "arm-none-eabi-gcc" with the following flags:</p>
  
  <pre><code>-Wall  -fdata-sections -ffunction-sections -std=gnu99 -mabi=aapcs -mcpu=cortex-m4 -mthumb -mfloat-abi=hard'
  </code></pre>
  
  <p>The linker uses the following flags:</p>
  
  <pre><code>-Wl,-Map=out.map -Wl,gc-sections -mabi=aapcs -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -T${LINKER_SCRIPT_PATH}
  </code></pre>
  
  <p>Anyone understand why the linker is loooking for <code>gc_sections</code>?</p>
  
  <p><strong>Edit</strong>: Apparently I miss the leading hyphens of the argument. The correct linker flag is of course <code>-Wl,--gc-sections</code>, not <code>-Wl,gc-sections</code>.</p>
  
  <p>How embarrassing.</p>