title: Can you add two SECTION sections to ld script
body: <p>I have an executable made by linking several .o files, using a somewhat involved linker script.   If a particular environment flag is set, I'd like there to be another section involved.   So, something like:</p>
  
  <pre><code>/* withfoo.ld */
  SECTIONS {
   .foo 0x80000000 : {
      _start_foo = .;
      . += 0xfff;
      _end_foo = .;
   }
  }
  </code></pre>
  
  <p>and then compile with:</p>
  
  <pre><code>if [ $FOO_DEFINED ]; then
      gcc -Wl,-T normal.ld $(OBJS) foo.o foo.ld
  else
      gcc -Wl,-T normal.ld $(OBJS)
  fi
  </code></pre>
  
  <p>where I'd like to not to have to modify <code>normal.ld</code>.   <code>normal.ld</code> has a SECTIONS definition within it.   So that gives me two SECTIONS...  I'm getting the warning:</p>
  
  <pre><code>/usr/bin/ld: warning: foo.ld contains output sections; did you forget -T?
  </code></pre>
  
  <p>Is there an actual problem or is this just a warning?  Also is there a proper way to do this that I'm not aware of?</p>