[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    KDE hackers, please read (was [nathan@codesourcery.com: Re: GCC
From:       Bernhard Rosenkraenzer <bero () redhat ! de>
Date:       2001-12-04 12:40:20
[Download RAW message or body]

FYI

---------- Forwarded message ----------
Date: Mon, 3 Dec 2001 17:17:55 +0100
From: Jakub Jelinek <jakub@redhat.com>
To: <some-internal-list@redhat.com>
Subject: KDE hackers, please read (was [nathan@codesourcery.com: Re: GCC 3.0.3: Bugs to Fix])

Hi!

If you want dynamic cast (and that's just one thing) to work with dlopen in
gcc3+, you need to use RTLD_GLOBAL. (Don't get confused by Nathan not
understanding what if and only if means).

	Jakub


Precedence: bulk
Message-ID: <3C0B4C55.D64E226A@codesourcery.com>
Date: Mon, 03 Dec 2001 09:56:37 +0000
From: Nathan Sidwell <nathan@codesourcery.com>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3-12 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>, hubbard@ilm.com,
        jyost@ilm.com, kainz@ilm.com, bramsh@acm.org
CC: Mark Mitchell <mark@codesourcery.com>, gcc@gcc.gnu.org
Subject: Re: GCC 3.0.3: Bugs to Fix
References: <14740000.1007070798@gandalf.codesourcery.com> <200111302322.03466@enzo.bigblue.local>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Franz Sirl wrote:
> 
> On Thursday 29 November 2001 22:53, Mark Mitchell wrote:
> > Here are some bugs that it would be nice, although not imperative,
> > to fix before 3.0.3:
> 
> What about PR3993? Another KDE2 blocking bug...
Is there a reason that dlopen ("foo", RTLD_NOW | RTLD_GLOBAL)
is unacceptable?

The ABI was designed on the assumption that it is possible at link
or load time to collapse objects with the same name to a single address,
and thus use address comparisons to determine equality. Loading without
RTLD_GLOBAL break that.

Presumably you'll also observe that it's possible for the 'same function'
has two different addresses, one in the library and one not in the library.

[5.10] says 'Two pointers ... compare equal if and only if ... both point
to the same object or function ...' 
Ooh, that's not actually the same as
	'Two pointers compare unequal if and only if they point to different
objects or functions'
(but I always thought that was true, defect anyone?)

Anyhow, from the ABI spec point of view, you've fallen outside the ABI
by disjointing the namespace.  To make it work without RTLD_GLOBAL would
pessimize type comparisons because we'd have to compare strings rather than
pointers to strings.  What's worse is that it's the 'unequal to' comparison
that could not be optimized, and IMO, dynamic cast & catch have more
not-equal cases than equal cases.

If we HAD to make this work at ANY cost, then I'd change the ABI to secrete
a hash of the typename that could be compared in O(0), rather than O(length).
But see - that's an ABI change.

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic