KEEP sections without writing a complete linker script?

Lars Noschinski lars@public.noschinski.de
Thu Jun 17 18:21:00 GMT 2010


* Tristan Gingold <gingold@adacore.com> [10-06-17 15:28]:
> > | SECTIONS
> > | {
> > |   .bootcall_trampoline :
> > |   {
> > |     *(.bootcall_trampoline)
> > |     KEEP(*(.bootcall_trampoline))
> > |   }
> > | }
> > 
> > This seems to work, but gives me the annoying warning
> > 
> > | /usr/lib/gcc/avr/4.3.4/../../../avr/bin/ld: warning: keep_bootcall.x contains output sections; did you forget -T?
[...]
> How did you invoke gcc or ld ?  It seems, according to the error message, that you forget the -T switch.  Ie, you
> should use something like -Wl,-T,myscript.ld

Using -T would give me not the effect I wanted, as this would replace
the default linker script.

> Your script looks strange: you shouldn't repeat the input section.  I think that written as is the second line has no effect.
> You should use something like:
> SECTIONS
> {
>   .bootcall_trampoline :
>    {
>      KEEP(*(.bootcall_trampoline))
>     }
>  }

This might be better, I just followed the example in the default avr
linker scripts. Both variants produce the desired effect
(.bootcall_trampoline is not discarded).


Greetings,
    Lars Noschinski



More information about the Binutils mailing list