Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to invoke `ld -r` equivalent using qcc?: (2 Items)
   
How to invoke `ld -r` equivalent using qcc?  
This must be a FAQ, but as a QNX newbies, I have no other places to turn to...

I am trying to combine several .o files into a single .o for later use, usually, on linux/unix, I will use `ld -r` to do
 this, but I have tried in vein to invoke this using `qcc -Wl,-i`. The problem is not with the partial linking step (i.e
. `ld -r` to create the libgtcrypto.o in the example), but with the final linking:

GTsuite/bin\libgtcfd.a(libgtcrypto.o):(.data.rel+0x0): multiple definition of `_
_dso_handle'
C:/QNX650/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.5.0/4.4.2/crtbegin.o:(.dat
a.rel+0x0): first defined here
GTsuite/bin\libgtcfd.a(libgtcrypto.o): In function `_init':
(.init+0x0): multiple definition of `_init'
C:/QNX650/target/qnx6/x86/lib/crti.o:(.init+0x0): first defined here
GTsuite/bin\libgtcfd.a(libgtcrypto.o): In function `_start':
(.text+0x8): multiple definition of `_start'
C:/QNX650/target/qnx6/x86/lib/crt1.o:(.text+0x8): first defined here
GTsuite/bin\libgtcfd.a(libgtcrypto.o): In function `_fini':
(.fini+0x0): multiple definition of `_fini'
C:/QNX650/target/qnx6/x86/lib/crti.o:(.fini+0x0): first defined here
C:/QNX650/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.5.0/4.4.2/crtend.o:(.dtors
+0x0): multiple definition of `__DTOR_END__'
GTsuite/bin\libgtcfd.a(libgtcrypto.o):(.dtors+0x4): first defined here
cc: C:/QNX650/host/win32/x86/usr/bin/ntox86-ld caught signal 1
make: *** [GTsuite/bin/GTsuite.nag_qnx] Error 1
Re: How to invoke `ld -r` equivalent using qcc?  
On 12-04-10 12:26 PM, Allen Zhao wrote:
> This must be a FAQ, but as a QNX newbies, I have no other places to turn to...
>
> I am trying to combine several .o files into a single .o for later use, usually, on linux/unix, I will use `ld -r` to 
do this, but I have tried in vein to invoke this using `qcc -Wl,-i`. The problem is not with the partial linking step (i
.e. `ld -r` to create the libgtcrypto.o in the example), but with the final linking:


The problem is actually with the creation of the relocatable object. 
During creation qcc is automatically pulling in the startup crt files 
into the relocatable output, and then when you do the final link, the 
startup objects are being brought into the output a second time. When 
creating your relocatable object, you should use -nostdlib, which will 
imply -nostartup as well.

Regards,

Ryan Mansfield