[U-Boot-Users] PATCH: include/linux/byteorder/swab.h

Leon Kukovec leon.kukovec at ultra.si
Tue Jan 6 10:24:32 CET 2004

Hi Wolfgang,

On Sat, 2004-01-03 at 20:57, Wolfgang Denk wrote:
> In message <1071237953.30434.196.camel at tt-devel.ultra.si> you wrote:
> > 
> > Change:
> > 	o	changed extern __inline__ into static __inline__ in
> > 		include/linux/byteorder/swab.h
> Sorry, but I reject this patch. Using "extern __inline__" serves some
> useful purpose (see GCC documentation).  Also,  this  is  how  it  is
> implemented in Linux, too.

I read the documentation and it says that if you use extern and
__inline__ together, the function has to be _ALSO_ implemented in a
library - which is not true for U-Boot.

I do not wanna be rude, but I have re-examined vanilla Linux kernel,
2.4.24, RedHat's glibc-kernelheaders, Gentoo kernel headers and ALL have
a static __inline__.

Would you be so kind and let me know which version of the kernel headers
did you take a look at ?

I'm fine with anything as long as it does the job and is legal. And if
you want to have and extern __inline__ although Linux has it static, I
will have to add several swab functions into generic library.

I'm trying to "fix" this issue because of debugging with -O0. It is much

Quote from GCC 3.2.2 manual:

If you specify both inline and extern in the function definition, then
the definition is used only for inlining. In no case is the function
compiled on its own, not even if you refer to its address explicitly.
Such an address becomes an external reference, as if you had only
declared the function, and had not defined it. 

This combination of inline and extern has almost the effect of a macro.
The way to use it is to put a function definition in a header file with
these keywords, and put another copy of the definition (lacking inline
and extern) in a library file. The definition in the header file will
cause most calls to the function to be inlined. If any uses of the
function remain, they will refer to the single copy in the library. 

Since GCC eventually will implement ISO C99 semantics for inline
functions, it is best to use static inline only to guarentee
compatibility. (The existing semantics will remain available when
-std=gnu89 is specified, but eventually the default will be -std=gnu99
and that will implement the C99 semantics, though it does not do so

End of Quote.

Happy New Year's,


Best Regards,

More information about the U-Boot mailing list