[Darwin] Patch, take 2: enable linkonce support for Darwin

Matt Austern austern@apple.com
Mon Feb 2 23:30:00 GMT 2004


On Feb 2, 2004, at 11:11 AM, Jason Merrill wrote:

> On Mon, 2 Feb 2004 11:00:26 -0800, Matt Austern <austern@apple.com> 
> wrote:
>
>> On Feb 2, 2004, at 10:47 AM, Jason Merrill wrote:
>>
>>> On Fri, 30 Jan 2004 17:06:17 -0800, Matt Austern <austern@apple.com>
>>> wrote:
>>>
>>>>>> Finally, one new user-visible feature: -fhidden-weak.  This flag 
>>>>>> makes
>>>>>> the compiler automatically give hidden visibility to symbols that 
>>>>>> have
>>>>>> vague linkage.
>>>
>>> Sounds like this would block sharing of template instantiations and 
>>> RTTI
>>> information between an executable and a shared library, which would
>>> break a lot of code.
>>
>> Not necessarily as much code as you might think!  Most Unix linkers 
>> have
>> the property that implicit instantiations are shared between different
>> shared libraries, but that's not the way it works on MS-Windows.  
>> Anyone
>> who's writing code that's portable between Unix and Windows isn't 
>> relying
>> on that sort of sharing.
>
> The code may not be, but the compiler is for internal data structures 
> like
> RTTI info.  Does throwing an exception between shared objects work with
> -fhidden-weak?

Good point.  This does work in Apple's locally modified compiler, but
only because of some other changes that we made.  I'll have to port
those extra changes over too.  There's a fourth version of my patch
in the works...  (Yes, it really is better for me to go through the 
effort
of making -fhidden-one-only work than to remove that feature.  Darwin
has enough complicated linker features that something like this is
sometimes an important simplification.)

Also looks like I'd *really* better figure out how to get complicated 
multi-
file test cases into the dg framework.  Here's the sort of test case 
that I
need to check this sort of thing:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eh-hidden-one-only.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20040202/d835677b/attachment.tar>
-------------- next part --------------


I don't know how to make something like this a dg test case.  If anyone
has advice on that, I'd appreciate it.

			--Matt



More information about the Gcc mailing list