[Bug 277958] libc: invalid internal linkage on feclearexcept

[email protected] Wed, 18 Mar 2026 22:41:18 +0000
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277958

Jonathan Wakely <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #6 from Jonathan Wakely <[email protected]> ---
I don't think you can keep the static inline definition. It means that
&feclearexcept has a different address in every translation unit, which defeats
the purpose of there being extern symbols in libm.

What is allowed is to hide the declaration of the extern symbol with a macro
that redirects to a *different* function name, which can be static inline:

int feclearexcept(int __excepts);

static inline int
__inline_feclearexcept(int __excepts)
{
  /* ... */
}
#define feclearexcept __inline_feclearexcept

This ensures that somebody can #undef feclearexcept to get at the real symbol,
whether to take its address for use across TUs, or for the original context in
comment 0 where C++ modules require a symbol with external linkage.

Simply defining it in libm and continuing to define a static inline function in
fenv.h would do absolutely nothing to solve that original reported issue (which
is now affecting GCC as well as LLVM).

-- 
You are receiving this mail because:
You are the assignee for the bug.