This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Stupid question: linking with a symbol under a different name


Suppose I have:
- compiled object file "main.o" with unresolved symbol "symbol1";
- build shared library "libused.so" with exported symbol "symbol2".

Is there way to somehow link program "main" from "main.o", telling it to use "symbol2" from "libused.so" as "symbol1"? I tried to play with --defsym=symbol1=symbol2 option of ld, but the result was unsuccessful.

user@desktop:~/test$ ld -o main main.o --defsym=symbol1=symbol2 libused.so
--defsym:1: unresolvable symbol `symbol2' referenced in expression
--defsym:1: unresolvable symbol `symbol2' referenced in expression
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400249 ld: main.o(.text+0xa): unresolvable R_X86_64_PLT32 relocation against symbol `symbol1'
ld: final link failed: Nonrepresentable section on outpu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]