That's fair enough about gcc not inlining without -O, now that you mention
it, I think I'd heard that before, along with the fact that marking a
variable as register won't necessarily get it into a register, it's just
taken as a hint to the compiler.
The bit that's still really confusing me is where is gcc getting the capital
X from, I have grepped all the .h and .c files of 2.2.17 and 2.2.19 and
there is no mention of put_user_X, only put_user_x. Any idea what that's
On Sat, Apr 21, 2001 at 12:03:56PM +0100, Kenn Humborg wrote:
> In my experience, you _need_ to compile with -O. With no optimisations
> enabled, GCC doesn't inline _any_ functions, even ones specifically marked
> __inline__. Calls to __put_user_N and other inlined stuff gets translated
> to regular function calls. Then either of these can happen:
>> o When compiled the kernel itself, this function may be declared
> as static inline and no global symbol will be created for it,
> so linking will fail
>> o When compiling a module, this symbol was never EXPORT_SYMBOL()ed
> (or whatever the macro is called...), so module loading will fail.
>>> > What's the story? I thought -O wasn't meant to make any difference except
> > speedwise. Is there something that says that all kernel code must be
> > compiled with a -O switch? Where is gcc getting this capital X instead of a
> > small x?
>> Take a look into the innards of include/asm/uaccess.h. __put_user(addr,x) gets
> broken out to something like __put_user_X via some GCC-specific keywords
> and some pre-processor magic. This, then, allows for byte, word and longword
> copies to be optimized individually.
>> The code is complex, but the generated code is simple.
> Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!