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:
/* withfoo.ld */
SECTIONS {
.foo 0x80000000 : {
_start_foo = .;
. += 0xfff;
_end_foo = .;
}
}
and then compile with:
if [ $FOO_DEFINED ]; then
gcc -Wl,-T normal.ld $(OBJS) foo.o foo.ld
else
gcc -Wl,-T normal.ld $(OBJS)
fi
where I'd like to not to have to modify normal.ld. normal.ld has a SECTIONS definition within it. So that gives me two SECTIONS... I'm getting the warning:
/usr/bin/ld: warning: foo.ld contains output sections; did you forget -T?
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?