Proposed change: weak symbol support for Darwin

Matt Austern austern@apple.com
Wed Oct 15 00:43:00 GMT 2003


On Oct 14, 2003, at 2:17 PM, Joe Buck wrote:

> On Mon, Oct 13, 2003 at 06:28:21PM -0700, Matt Austern wrote:
>> It's not that hard.  Currently we've got four cases for polymorphic
>> classes:
>
> Which really reduce to two: your case 1 where we use the cfront trick,
> and everything else where we can't.
>
>> I'm describing what the compiler currently does, by the way, not my
>> proposal.
>> And currently we make the vtable weak for all four cases.
>>
>> My proposal is to change the compiler, for Darwin only, so that it 
>> only
>> makes the vtables weak for cases 2-4.  I don't see any good reason to
>> make
>> that change on any other platforms, but I'd be happy to do it if 
>> anyone
>> can
>> think of a reason why it would be an improvement.
>
> There's the maintainance issue: maintainers forever more will have to
> ask themselves why Darwin is different, even though some other OSes
> have similar issues with weak symbols.
>
> I think that just making the change everywhere would be better.
> For one thing, x86/ELF using developers will notice that they have
> broken Darwin a bit earlier. :-)
>
> In fact, anything that can be done to easily reduce the number of
> special cases, multiple ways of doing things, and OS-specific tweaks
> in gcc that aren't really needed will pay off in the long run.

If Mark agrees that it's a good idea not to make vtables weak unless
we have to, I'll be happy to make that change.  It'll certainly be 
easier
for me, and better for the Darwin platform.

The only reason I was reluctant to make the change globally was that
on most platforms (e.g. Linux/x86) the current scheme ain't broke.

			--Matt



More information about the Gcc mailing list