Skip to contentSkip to conversation

PATCH: include/linux/byteorder/swab.h

U-Boot-Users Leon Kukovec 2 participants 4 messages Dec 12, 2003 – Feb 6, 2004

lore
Share & tools
lore
#0 lore raw

Fixes:
o the optimization can now be disabled
(config.mk: OPTFLAGS = -O0)
(makes debugging easier)
Change:
o changed extern __inline__ into static __inline__ in
include/linux/byteorder/swab.h

COMPILER: ELDK x86 2.1.0 (RedHat 9.0)

BUILD FOR: ppc mips arm

BUILD STATUS:

	ERIC 		FAILED
	ixdp425		FAILED
	lubbock		FAILED
	MPC8540ADS	FAILED
	MPC8560ADS	FAILED

NOTE: the same builds fail for U-Boot HEAD branch.

--
Best Regards,
Leon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: u-boot-swab.patch
Type: text/x-patch
Size: 1729 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20031212/1b8f0d20/attachment.bin

#1 lore raw
Quoted 4 lines · In message <[email protected]> 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.

Best regards, and a Happy New Year!

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Real programmers don't comment their code. It was hard to  write,  it
should be hard to understand.
#2 lore raw

Hi Wolfgang,

Quoted 9 lines · Wolfgang Denk
Quoted 4 lines · In message <[email protected]> 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 simplier.

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 yet.)

End of Quote.

Happy New Year's,

Signature · 2 lines
Best Regards,
	Leon.
#3 lore raw
In reply to Leon Kukovec
Quoted 8 lines · In message <[email protected]> you wrote:

Fixes:
o the optimization can now be disabled
(config.mk: OPTFLAGS = -O0)
(makes debugging easier)
Change:
o changed extern __inline__ into static __inline__ in
include/linux/byteorder/swab.h

Added. Thanks.

Best regards,

Wolfgang Denk

Signature · 3 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19,  Hall 12.0 Booth 440
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
"One planet is all you get."