[klibc] <sys/auxv.h>: add missing dependency <klibc/extern.h>

__extern is defined in <klibc/extern.h>

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
[klibc] Move architecture-specific initialization to arch/

Move out architecture-specific initialization code (currently only for
i386) into the arch/ directory and define a configuration variable
_KLIBC_HAS_ARCHINIT to indicate its presence.

For consistency, change __init_stdio() to __libc_init_stdio().

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
[klibc] Remove obsolete enum _IO_file_flags

This enum is not used anywhere.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
[klibc] fwrite: use memrchr() to find the final '\n' in _IOLBF mode

In line buffered mode, we need to split the write at the final '\n'
(which usually, but not always, is the last character in the string.)

Use memrchr() instead of open-coding it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
readlink: Better buffer handling

- Allow PATH_MAX bytes, not just a hard-coded 128 bytes
- Just allocate the buffer on the stack, no need for malloc()
- Use puts() rather than printf()

Reported-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
readlink: Handle multiple input arguments

Handle multiple links as parguments passed to readlink().

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
readlink: Reduce size by calling _fwrite() instead of puts()

We know how long the output is, so we might as well call _fwrite()
directly, with the explicit termination set to \n instead of \0.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
[klibc] x86-64: disable the use of SSE

Disable the use of SSE registers.  This reduces the size of the code
because it means the varadic functions don't need to marshall
parameters in the SSE registers.  Since klibc doesn't support floating
point, this is a significant size win.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>