Hi, we are trying to build ChromeOs using clang while this package fails to build.
The reason, after investigation, is that Clang, under '-O2' choose not to inline "prefetch" that has below declaration -
// fuser.c
extern inline void attribute((used,__gnu_inline__,always_inline,__artificial__)) prefetch(const void *restrict x)
The declaration "extern inline and attribute __gnu_inline__" forces compiler to treat this "prefetch" implementation as inline-only definition. In other words, if the call to prefetch is not inlined (such decision is made by compiler), then there must be another prefetch implementation somewhere else in other compilation unit with no "inline" keyword.
Current situation is GCC honor "always_inline" attribute, thus no problem, whereas clang does not, instead it choose not to inline it, so an "undefined" reference to prefetch is reported.
Is there another external "prefetch" implemented in this package so the "__gnu_inline__" is meant to provide an alternative "prefetch" implementation? If that's not the case, may I suggest just remove "__gnu_inline__" attribute, so the declaration provides both inline and external definition for the function?
Anonymous
This code (src/lists.h) was written by Werner so I'll see what he thinks.
Maybe a
#ifdef GNUC_GNU_INLINE
extern inline void attribute((used,gnu_inline,always_inline,artificial))
#else
extern inline void attribute((used,always_inline,artificial))
#endif
prefetch(const void *restrict x)
might help here.
With the attached patch at least gcc compiles, no clang here.
Hi Dr. Werner Fink, I tried the patch for clang, it works for us, thanks!