*BSD News Article 93671


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!cs.utexas.edu!news.tamu.edu!news.utdallas.edu!nrchh45.rich.nt.com!bcarh189.bnr.ca!bmerhc5e.bnr.ca!news
From: Andrew Atrens <atrens@nortel.ca>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: "g++ -fpic" broken in 2.2.1 ?
Date: Wed, 16 Apr 1997 11:31:33 -0400
Organization: Nortel Technology (formerly Bell Northern Research)
Lines: 39
Message-ID: <3354F0D3.7450@nortel.ca>
NNTP-Posting-Host: bmerh278.bnr.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.0b2 (X11; I; HP-UX A.09.05 9000/712)
X-Priority: 3 (Normal)
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:39164



 Hi All,

I'm trying to  port  AUIS-8.0  to FreeBSD 2.2.1 and have run into a snag
using g++ and -fpic .
Essentially what I'm trying to do is to build a shared library from
objects compiled with g++, so I compile
the objects with -fpic to generate position independent code.  The
following is an example of the output:

g++ -fpic -I. -I/home/andrew/include/atk -I/home/andrew/include
-I/usr/X11R6/include -c linkview.C
/var/tmp/cc000730.s: Assembler messages:

/var/tmp/cc000730.s:3147: Warning: GOT relocation burb:
`_FindBuffer__FP5frameP6buffer' should be global
...

So what this means is that  `FindBuffer(...);'  which is declared as a
`static' function in linkview.C  is being rescoped from
'static' to 'global'.  OUCH!  OUCH!   It turns out that another object
file also contains a static function of the same name
which in its turn gets promoted to 'global' namespace.  These functions
then clash as 'duplicate symbols' when I  try to
to link the objects into a shared library:

linkview.o: Definition of symbol `_FindBuffer_FP5frameP6buffer'
(multiply defined)
plinkview.o: Definition of symbol '_FindBuffer_FP5frameP6buffer'
(multiply defined)
/home/andrew/lib/atk/libframe.so.1.0: Definition of symbol
`_FindBuffer_FP5frameP6buffer' (multiply defined)

Does anyone know if there is a fix/workaround for this ?

Cheers,
Andrew.
(opinions are mine, not Nortel's)