This is the mail archive of the 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: [Darwin] Patch, take 2: enable linkonce support for Darwin

On Feb 2, 2004, at 10:47 AM, Jason Merrill wrote:

On Fri, 30 Jan 2004 17:06:17 -0800, Matt Austern <> wrote:

Here's the case where we use COMMON even on SUPPORTS_ONE_ONLY
  if (TREE_CODE (decl) == VAR_DECL
       && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) ==
     DECL_COMMON (decl) = 1;
   else if (SUPPORTS_ONE_ONLY)

I agree, it looks funny. Unless someone can explain to me why this is a
good idea, I'd be happy to exchange the order of those clauses so that we
never use COMMON if we've got ONE_ONLY available.

I was doing it that way out of a philosophy of using a more advanced
feature only when necessary. COMMON objects are merged by any Unix linker,
and they take up no space in the object file. But if using COMMON is
problematic, I'm certainly not attached to it.

OK! As you may have noticed, version 3 of my patch avoids COMMON on all platforms where ONE_ONLY is available. This is the only part of my patch that changes the compiler's behavior for any target other than Darwin.

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.

But yes, you're basically right: this is a fairly big change in semantics.
That's why it's not the default, even on Darwin.


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