Linker stumbles over non-grouped .text/.rodata for a C++ function

Stephan Bergmann stephan.bergmann.secondary@googlemail.com
Wed Aug 31 20:33:00 GMT 2011


On Aug 31, 2011, at 10:07 PM, Ian Lance Taylor wrote:
> Stephan Bergmann <stephan.bergmann.secondary@googlemail.com> writes:
> 
>> I am trying to track down an error that can at least be observed when building recent versions of LibreOffice (e.g., revision bf3ff35d8c96315c35cf8dc8495be4b488b55cb6 of git://anongit.freedesktop.org/libreoffice/core) on Fedora 15 i386 (i.e., with GCC 4.6.0 20110603 (Red Hat 4.6.0-10)).  The problem is that linking together objects via
>> 
>>> g++ -shared vbarange.o vbasheetobjects.o
>> 
>> 
>> fails with errors like
>> 
>>> `.L109' referenced in section `.rodata._ZN19ScVbaCollectionBaseIN4cppu15WeakImplHelper1IN3ooo3vba11XCollectionEEEE4ItemERKN3com3sun4star3uno3AnyESD_[ScVbaCollectionBase<cppu::WeakImplHelper1<ooo::vba::XCollection> >::Item(com::sun::star::uno::Any const&, com::sun::star::uno::Any const&)]' of vbasheetobjects.o: defined in discarded section `.text._ZN19ScVbaCollectionBaseIN4cppu15WeakImplHelper1IN3ooo3vba11XCollectionEEEE4ItemERKN3com3sun4star3uno3AnyESD_[non-virtual thunk to ScVbaCollectionBase<cppu::WeakImplHelper1<ooo::vba::XCollection> >::Item(com::sun::star::uno::Any const&, com::sun::star::uno::Any const&)]' of vbasheetobjects.o
> 
> This sounds like a compiler bug.  You are correct that the .text and
> .rodata sections should be using the same section group.  Please file a
> bug report so it is not forgotten.

Done, <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255>.

> That said, this message from the linker is a warning, and you can
> normally ignore it.

Hm, for me it resulted in an ld exit code of 1, but maybe that was due to one of the additional command line switches apart from -shared when linking (but which did not otherwise affect the problem).

-Stephan



More information about the Gcc mailing list