[Bug target/69179] undocumented darwin attributes "apple_kext_compatibility" and "weak_import"

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 10 10:40:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69179

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to sandra from comment #0)
> config/darwin.c defines attributes "apple_kext_compatibility" and
> "weak_import" which have no documentation in the GCC manual.
> 
> "apple_kext_compatibility" seems related to the also-undocumented
> -fapple-kext command-line option (see PR 62273).  Reading the code, I'm
> wondering if a feature intended to provide backwards compatibility with GCC
> 2.95 is even relevant to modern versions of Darwin, or whether this might be
> a candidate for deletion as obsolete.

The purpose of the attribute is to allow the VTABLE for c++ (in kernel modules)
to be altered to be compatible with GCC2.95 layouts for use with Darwin <= 8.
There is an outside possibility it might be relevant to m32 Darwin9 (this needs
checking).

This option is recognised but not implemented - it looks like the APPLE_LOCAL
changes in 4.2.1 were never upstreamed (or never accepted, or subsequently
removed).

I think, documentation-wise, we could (now) note the facts (i.e. that it's
recognised in sources but unimplemented).

For the future;
1. I doubt that there's any serious appetite for introducing intrusive changes
to c++ to support an EOL platform (if we do it at all I'd say save it for a
"Vendor Branch").  ISTM that folks who need to support such kernel modules are
not looking for up-to-date c++11 features and could just use apple g++-4.2.

2. We should introduce at least a warning in the current source that the option
is not enacted.

3. Unless anyone disagrees with (1) and has the time/enthusiasm to implement
and push the implementation though, I think we should note that this attribute
is deprecated

4. It's likely that we should review whether the -fapple-kext stuff has any
function/meaning [to the ppc port] as things stand.


More information about the Gcc-bugs mailing list