From: Danny S. <dan...@cl...> - 2007-08-24 22:59:15
|
> > > > Strange... > > Is there another way to always force the -shared-libgcc flag ? I wrote: > > Unfortunately not without some cost. The crtbegin object > that initializes the EH frame use weak externals to resolve > the registration/deregistration functions. It uses weak > symbols so that we pull in in the libgcc modules with all the > unwind code only when we actually need the unwind code -- > that is to avoid dead code in non-EH apps. I did this > because in an earlier experiment with DW2, users complained > about 'huge' size of their toy apps that didn't need nor want > the unwind code. This all works as advertised with static > libgcc. However, weak symbols do not work with dlls that > are linked via import lib. So unless we add > -Wl,-u,___register_frame_info -Wl,-u,___deregister_frame_info > to make the symbols string EH tables won't be initialized or > finalized. --shared-libgcc adds the magic -u's. > Thanks for reporting, becuase it made think of the problem shtly differently and indeed ther is a very simple solution to get weak __register_frame_info,__deregister_frame_info when using static libgcc and strong externs when using a libgcc.dll. Just call them from a wrapper that lives in libgcc itself. The process of tying together the object files that make a dll automatically forces all undefined references to be strong. I'm testing an updated libgcc/crtbegin now, so far it works just by renaming libgcc_s.a to libgcc.dll.a - no need for -shared-libgcc. With this setup just adding -Bstatic to command line will revert to using static libgcc.a Danny |