ld -defsym option

Fabio Alemagna falemagn@studenti.unina.it
Tue Jul 8 12:50:00 GMT 2003


On Tue, 8 Jul 2003, S kris wrote:

> Hi,
>
> I am trying to link the x.o and sample.a (contains y.o) using ld for
> creating executable. I have used -defsym xsymbol=ysymbol as the linker
> option for changing the symbol "xsymbol" defined in x.c to the symbol
> "ysymbol" defined in y.c. But i get the error "Undefined symbol
> 'ysymbol' referenced in x.o". What may be the reason for this error? Is
> this something to do with archive?
>
> Please help me in fixing this?

Symbol names have to be specified using the same mangling as they have in
the compiler's asm output. The m68k port of gcc puts a '_' before every
symbol's name, hence you should use -defsym _xsymbol=_ysymbol.

Fabio Alemagna



More information about the Gcc mailing list