This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: Question about global object constructors, VxWorks, and GCC 2.95(fwd)



The problem is that gcc 2.95 makes the ctor objects local. 

Here's some code compiled with gcc 2.95.1:

00000068 t L2
00000048 t L5
00000044 t L8
0000006c t __GLOBAL_.I.x_
0000004c t ___1X
00000000 t ___static_initialization_and_destruction_0
00000000 B _x_
         U _x__Fv

And here's the same code compiled with gcc 2.8.1:

0000003c t .L1
0000001c t .L6
00000018 t .L7
00000000 T __GLOBAL_$I$x_
00000020 t ___1X
00000000 B _x_
         U _x__Fv

We've not had this precise problem with VxWorks, but we do have an
analgous problem, which we have solved by patching objcopy to give it a
--globalize-symbol option.

If anyone's interested, I'll pop it on an ftp site somewhere. Working
out what to do with collect2 is probably the right thing to do, though
;-(

Regards!
Luke Diamand


Bryan Ogawa wrote:
> 
> I also posted this message to the generic gcc help list, but thought this
> list might also be relevant.
> 
> Hi all,
> 
> I am trying to compile gcc-2.95 for VxWorks (Tornado 1.0.1).  I have
> successfully hacked and patched the files to the point of being able to
> compile and load .o files, both C and C++.  The C++ ones require some
> incremental linking to work, however, since my VxWorks kernel image does
> not have all the functions (e.g. parts of libstdc++).
> 
> Such objects work, however, when loaded and called.
> 
> However, global object constructors and static member objects don't work.
> 
> This is almost certainly because the VxWorks shell doesn't know to call
> the constructors when the objects are loaded.
> 
> I have investigated and I have found out that the constructors are being
> built and put into the .o files, but that these constructors are marked
> local so the symbols are not exported.
> 
> So, I cannot even write C code to call the functions manually.
> 
> I am trying to figure out whether the right approach is to switch to
> collect2 or whether there is some sort of hacking on the .o files after
> linking is a better approach.  Any suggestions?  What do other VxWorks
> users do?
> 
> Any help is greatly appreciated, including pointers to manuals or web
> pages that I might have missed.
> 
> Thanks,
> 
> --
> Bryan K. Ogawa  <bogawa@vovida.com>  http://www.vovida.com/

-- 
Virata http://www.virata.com
Cambridge
Tel: +44 1223 566919      Fax: +44 1223 566915

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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