This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

[PATCH] Use __gnu_inline__ for __extern_always_inline in g++-4.2


Hi,

_FORTIFY_SOURCE's __extern_always_inline macro currently only includes
the __gnu_inline__ attribute in C++ mode for gcc >= 4.3. However,
__gnu_inline__ semantics are always desired for the
__extern_always_inline functions, and are available in g++ 4.2 (and
some releases of g++ 4.1). The attached patch causes the
__gnu_inline__ attribute to be used in C++ whenever the compiler
supports it and it is not the default, that is:

 * Whenever __GNUC_STDC_INLINE__ is defined, which indicates that we
are in C, and __gnu_inline__ is available and is not the default.
 * Whenever __GNUC_GNU_INLINE__ is defined in C++ mode, which
indicates that __gnu_inline__ is available (GNU inline semantics are
never the default in C++ mode).

This causes g++-4.2 to stop emitting weak definitions for the fortify
wrapper functions if they can't be inlined, and also improves Clang
compatibility.

Thanks!
Richard

Attachment: extern-always-inline-gnu-inline.diff
Description: Binary data


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