This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 3.0.3: Bugs to Fix


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


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