2003-02-07 04:54:16

by Greg KH

[permalink] [raw]
Subject: [RFC] klibc for 2.5.59 bk

Hi all,

Thanks to Arnd Bergmann, it looks like the klibc and initramfs code is
now working. I've created a patch against Linus's latest bk tree and
put it at:
http://www.kroah.com/linux/klibc/klibc-2.5.59-2.patch.gz
(I can't get to kernel.org right now, sorry)
and there's a bk tree at:
bk://kernel.bkbits.net/gregkh/linux/klibc-2.5

I'd really like to send this to Linus now, but I'm going to be away
from email for about a week, so I'll wait will I get back. If anyone
has any issues with this patch, please let me know.

thanks,

greg k-h


2003-02-07 14:51:16

by Alex Riesen

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

Greg KH, Fri, Feb 07, 2003 05:59:19 +0100:
> Hi all,
>
> Thanks to Arnd Bergmann, it looks like the klibc and initramfs code is
> now working. I've created a patch against Linus's latest bk tree and
> put it at:
> http://www.kroah.com/linux/klibc/klibc-2.5.59-2.patch.gz

was the following part of the patch intended? (hello_world?)

cpio_mknod("/dev/console", 0600, 0, 0, 'c', 5, 1);
cpio_mkdir("/root", 0700, 0, 0);
+ cpio_mkdir("/sbin", 0700, 0, 0);
+ cpio_mkfile("usr/hello_world/hello", "/sbin/hotplug", 0700, 0, 0);
cpio_trailer();

exit(0);


2003-02-09 12:53:19

by Greg KH

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Fri, Feb 07, 2003 at 04:00:38PM +0100, Alex Riesen wrote:
> Greg KH, Fri, Feb 07, 2003 05:59:19 +0100:
> > Hi all,
> >
> > Thanks to Arnd Bergmann, it looks like the klibc and initramfs code is
> > now working. I've created a patch against Linus's latest bk tree and
> > put it at:
> > http://www.kroah.com/linux/klibc/klibc-2.5.59-2.patch.gz
>
> was the following part of the patch intended? (hello_world?)

Yes it was. It shows how to add a binary file to the initramfs image,
and have it executed by the kernel during the early boot process.

The fact that the program didn't really do anything significant isn't
important here.

thanks,

greg k-h

2003-02-17 02:56:39

by Kai Germaschewski

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Sun, 9 Feb 2003, Greg KH wrote:

> > Greg KH, Fri, Feb 07, 2003 05:59:19 +0100:
> > > Hi all,
> > >
> > > Thanks to Arnd Bergmann, it looks like the klibc and initramfs code is
> > > now working. I've created a patch against Linus's latest bk tree and
> > > put it at:
> > > http://www.kroah.com/linux/klibc/klibc-2.5.59-2.patch.gz
> >
> > was the following part of the patch intended? (hello_world?)
>
> Yes it was. It shows how to add a binary file to the initramfs image,
> and have it executed by the kernel during the early boot process.
>
> The fact that the program didn't really do anything significant isn't
> important here.

I did some work on integrating klibc into kbuild now. I used your patch as
guide line, though I started from scratch with klibc-0.77. The build
should work fine (reminder: "make KBUILD_VERBOSE=0 ..." will give you much
more readable output), but I probably broke some non-x86 architectures
in the process.

To do something more useful than "hello world", I actually moved some part
of finding / mounting the final root system into userspace, though only
conditional on CONFIG_INITRAMFS.

My tree is at

Pull from http://linux-isdn.bkbits.net/linux-2.5.klibc

If people want a GNU patch, I can mail that privately, it was too large to
attach it here.

--Kai


-----------------------------------------------------------------------------
[email protected], 2003-02-15 16:55:46-06:00, [email protected]
klibc: Merge klibc-0.77

That's just a cp -r klibc-0.77/klibc/* linux/usr/lib

----------------------------------------------------------------------------
CAVEATS | 51
MCONFIG | 49
Makefile | 134 +
README | 57
SOCKETCALLS | 21
SYSCALLS | 146 +
__shared_init.c | 56
__signal.c | 22
__static_init.c | 40
abort.c | 19
alarm.c | 29
arch/README | 67
arch/alpha/MCONFIG | 17
arch/alpha/Makefile.inc | 93
arch/alpha/README-gcc | 23
arch/alpha/crt0.S | 21
arch/alpha/divide.c | 57
arch/alpha/include/klibc/archsetjmp.h | 24
arch/alpha/include/klibc/archsys.h | 53
arch/alpha/include/machine/asm.h | 44
arch/alpha/pipe.c | 28
arch/alpha/setjmp.S | 61
arch/arm/MCONFIG | 26
arch/arm/Makefile.inc | 31
arch/arm/crt0.S | 25
arch/arm/include/klibc/archsetjmp.h | 14
arch/arm/include/klibc/archsys.h | 12
arch/arm/setjmp-arm.S | 40
arch/arm/setjmp-thumb.S | 58
arch/cris/MCONFIG | 11
arch/cris/Makefile.inc | 10
arch/cris/include/klibc/archsys.h | 12
arch/i386/MCONFIG | 24
arch/i386/Makefile.inc | 27
arch/i386/crt0.S | 33
arch/i386/exits.S | 45
arch/i386/include/klibc/archsetjmp.h | 19
arch/i386/include/klibc/archsys.h | 96
arch/i386/include/klibc/diverr.h | 16
arch/i386/libgcc/__ashldi3.S | 29
arch/i386/libgcc/__ashrdi3.S | 29
arch/i386/libgcc/__lshrdi3.S | 29
arch/i386/libgcc/__muldi3.S | 34
arch/i386/libgcc/__negdi2.S | 21
arch/i386/setjmp.S | 58
arch/i386/socketcall.S | 38
arch/ia64/MCONFIG | 11
arch/ia64/Makefile.inc | 10
arch/ia64/include/klibc/archsys.h | 12
arch/m68k/MCONFIG | 11
arch/m68k/Makefile.inc | 10
arch/m68k/include/klibc/archsys.h | 12
arch/mips/MCONFIG | 18
arch/mips/Makefile.inc | 24
arch/mips/crt0.S | 25
arch/mips/include/klibc/archsetjmp.h | 39
arch/mips/include/klibc/archsys.h | 12
arch/mips/include/machine/asm.h | 11
arch/mips/include/sgidefs.h | 20
arch/mips/pipe.S | 16
arch/mips/setjmp.S | 82
arch/mips/vfork.S | 19
arch/mips64/MCONFIG | 11
arch/mips64/Makefile.inc | 10
arch/mips64/include/klibc/archsys.h | 12
arch/parisc/MCONFIG | 11
arch/parisc/Makefile.inc | 10
arch/parisc/include/klibc/archsys.h | 12
arch/ppc/MCONFIG | 11
arch/ppc/Makefile.inc | 15
arch/ppc/crt0.S | 29
arch/ppc/include/klibc/archsetjmp.h | 36
arch/ppc/include/klibc/archsys.h | 55
arch/ppc/setjmp.S | 35
arch/ppc64/MCONFIG | 11
arch/ppc64/Makefile.inc | 10
arch/ppc64/crt0.S | 38
arch/ppc64/include/klibc/archsys.h | 52
arch/s390/MCONFIG | 13
arch/s390/Makefile.inc | 16
arch/s390/crt0.S | 25
arch/s390/include/klibc/archsetjmp.h | 15
arch/s390/include/klibc/archsys.h | 41
arch/s390/setjmp.S | 32
arch/s390x/MCONFIG | 13
arch/s390x/Makefile.inc | 16
arch/s390x/crt0.S | 21
arch/s390x/include/klibc/archsetjmp.h | 15
arch/s390x/include/klibc/archsys.h | 41
arch/s390x/setjmp.S | 36
arch/sh/MCONFIG | 11
arch/sh/Makefile.inc | 10
arch/sh/include/klibc/archsys.h | 12
arch/sparc/MCONFIG | 18
arch/sparc/Makefile.inc | 44
arch/sparc/crt0.S | 2
arch/sparc/crt0i.S | 100
arch/sparc/divrem.m4 | 276 ++
arch/sparc/include/klibc/archsetjmp.h | 16
arch/sparc/include/klibc/archsys.h | 65
arch/sparc/include/machine/asm.h | 192 +
arch/sparc/include/machine/frame.h | 138 +
arch/sparc/include/machine/trap.h | 141 +
arch/sparc/setjmp.S | 38
arch/sparc/smul.S | 160 +
arch/sparc/umul.S | 193 +
arch/sparc64/MCONFIG | 21
arch/sparc64/Makefile.inc | 13
arch/sparc64/crt0.S | 2
arch/sparc64/include/klibc/archsetjmp.h | 16
arch/sparc64/include/klibc/archsys.h | 157 +
arch/sparc64/setjmp.S | 55
arch/x86_64/MCONFIG | 16
arch/x86_64/Makefile.inc | 16
arch/x86_64/crt0.S | 22
arch/x86_64/exits.S | 35
arch/x86_64/include/klibc/archsetjmp.h | 21
arch/x86_64/include/klibc/archsys.h | 32
arch/x86_64/setjmp.S | 54
assert.c | 13
atexit.c | 10
atexit.h | 19
atoi.c | 3
atol.c | 3
atoll.c | 3
atox.c | 14
brk.c | 24
bsd_signal.c | 11
calloc.c | 21
closelog.c | 18
creat.c | 12
ctypes.c | 281 ++
exec_l.c | 57
execl.c | 8
execle.c | 8
execlp.c | 8
execlpe.c | 8
execv.c | 13
execvp.c | 13
execvpe.c | 73
exitc.c | 36
fdatasync.c | 15
fgetc.c | 20
fgets.c | 33
fopen.c | 46
fork.c | 29
fprintf.c | 19
fputc.c | 14
fputs.c | 15
fread.c | 35
fread2.c | 13
fwrite.c | 35
fwrite2.c | 13
getcwd.c | 15
getdomainname.c | 25
getenv.c | 22
gethostname.c | 25
getopt.c | 74
getpriority.c | 25
globals.c | 10
include/alloca.h | 13
include/arpa/inet.h | 24
include/assert.h | 22
include/bits32/bitsize/limits.h | 14
include/bits32/bitsize/stddef.h | 18
include/bits32/bitsize/stdint.h | 34
include/bits32/bitsize/stdintconst.h | 18
include/bits32/bitsize/stdintlimits.h | 22
include/bits64/bitsize/limits.h | 14
include/bits64/bitsize/stddef.h | 13
include/bits64/bitsize/stdint.h | 36
include/bits64/bitsize/stdintconst.h | 18
include/bits64/bitsize/stdintlimits.h | 22
include/ctype.h | 117
include/dirent.h | 20
include/elf.h | 12
include/endian.h | 41
include/errno.h | 8
include/fcntl.h | 11
include/grp.h | 13
include/inttypes.h | 226 +
include/klibc/compiler.h | 61
include/klibc/diverr.h | 16
include/klibc/extern.h | 14
include/limits.h | 40
include/net/if.h | 1
include/net/if_arp.h | 1
include/net/if_ether.h | 1
include/net/if_packet.h | 1
include/netinet/in.h | 29
include/netinet/in6.h | 10
include/netinet/ip.h | 13
include/netinet/tcp.h | 11
include/netinet/udp.h | 19
include/poll.h | 16
include/sched.h | 23
include/setjmp.h | 43
include/signal.h | 72
include/stdarg.h | 14
include/stddef.h | 24
include/stdint.h | 113
include/stdio.h | 109
include/stdlib.h | 94
include/string.h | 37
include/sys/dirent.h | 13
include/sys/fsuid.h | 14
include/sys/ioctl.h | 14
include/sys/klog.h | 24
include/sys/mman.h | 21
include/sys/module.h | 158 +
include/sys/mount.h | 55
include/sys/param.h | 11
include/sys/reboot.h | 25
include/sys/resource.h | 15
include/sys/select.h | 13
include/sys/socket.h | 50
include/sys/socketcalls.h | 28
include/sys/stat.h | 23
include/sys/syscall.h | 15
include/sys/time.h | 16
include/sys/times.h | 14
include/sys/types.h | 126
include/sys/uio.h | 15
include/sys/utime.h | 10
include/sys/utsname.h | 23
include/sys/vfs.h | 14
include/sys/wait.h | 19
include/syslog.h | 53
include/termios.h | 86
include/time.h | 14
include/unistd.h | 106
include/utime.h | 15
inet/inet_addr.c | 14
inet/inet_aton.c | 23
inet/inet_ntoa.c | 19
inet/inet_ntop.c | 52
inet/inet_pton.c | 74
interp.S | 11
isatty.c | 21
libgcc/__divdi3.c | 29
libgcc/__divsi3.c | 29
libgcc/__moddi3.c | 29
libgcc/__modsi3.c | 29
libgcc/__udivdi3.c | 13
libgcc/__udivmoddi4.c | 32
libgcc/__udivmodsi4.c | 32
libgcc/__udivsi3.c | 13
libgcc/__umoddi3.c | 16
libgcc/__umodsi3.c | 16
llseek.c | 34
lrand48.c | 42
makeerrlist.pl | 80
malloc.c | 192 +
malloc.h | 51
memccpy.c | 23
memchr.c | 18
memcmp.c | 19
memcpy.c | 29
memmem.c | 44
memmove.c | 34
memset.c | 30
memswap.c | 23
mmap.c | 51
nice.c | 22
onexit.c | 39
pause.c | 21
perror.c | 12
printf.c | 19
pty.c | 31
puts.c | 13
qsort.c | 42
raise.c | 11
readdir.c | 66
realloc.c | 49
reboot.c | 15
recv.c | 11
sbrk.c | 23
seed48.c | 19
select.c | 9
send.c | 11
setegid.c | 10
setenv.c | 124
seteuid.c | 10
setpgrp.c | 10
setresgid.c | 29
setresuid.c | 30
sha1hash.c | 317 ++
sigaction.c | 19
siglist.c | 115
siglongjmp.c | 16
signal.c | 11
sigpending.c | 19
sigprocmask.c | 19
sigsuspend.c | 19
sleep.c | 20
snprintf.c | 16
socketcalls.pl | 62
socketcommon.h | 25
sprintf.c | 18
srand48.c | 16
sscanf.c | 17
strcat.c | 11
strchr.c | 16
strcmp.c | 20
strcpy.c | 20
strdup.c | 17
strerror.c | 25
strlen.c | 14
strncat.c | 11
strncmp.c | 20
strncpy.c | 22
strntoimax.c | 13
strntoumax.c | 75
strrchr.c | 18
strsep.c | 21
strspn.c | 67
strstr.c | 10
strtoimax.c | 3
strtok.c | 16
strtol.c | 3
strtoll.c | 3
strtoul.c | 3
strtoull.c | 3
strtoumax.c | 3
strtox.c | 13
syscalls.pl | 72
syscommon.h | 29
syslog.c | 68
tests/getenvtest.c | 26
tests/getopttest.c | 31
tests/hello.c | 7
tests/idtest.c | 14
tests/malloctest.c | 4145 ++++++++++++++++++++++++++++++++
tests/memstrtest.c | 29
tests/microhello.c | 9
tests/minihello.c | 7
tests/minips.c | 452 +++
tests/nfs_no_rpc.c | 538 ++++
tests/setjmptest.c | 36
tests/testrand48.c | 19
tests/testvsnp.c | 115
time.c | 27
umount.c | 12
unsetenv.c | 40
usleep.c | 15
utime.c | 30
vfprintf.c | 26
vprintf.c | 11
vsnprintf.c | 433 +++
vsprintf.c | 11
vsscanf.c | 365 ++
wait.c | 12
wait3.c | 12
waitpid.c | 12
354 files changed, 17793 insertions(+)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:09:41-06:00, [email protected]
kbuild/klibc: Integrate klibc into the build.

Basically, add a scripts/Makefile.user, which does similar things to
scripts/Makefile.build, but compiles userspace for the target instead.

It's tested for a static klibc on i386, building the shared lib works, too,
but is not further integrated.

This patch also adds gregkh's hello test program, which works as well.

----------------------------------------------------------------------------
b/Makefile | 39 ++++++
b/scripts/Makefile.build | 6 -
b/scripts/Makefile.clean | 11 +
b/scripts/Makefile.lib | 3
b/scripts/Makefile.user | 209 +++++++++++++++++++++++++++++++++++
b/usr/Makefile | 28 ++++
b/usr/lib/MCONFIG | 39 +++---
b/usr/lib/Makefile | 159 +++++++++++++-------------
b/usr/lib/socketcalls.pl | 11 +
b/usr/lib/socketcalls/socketcommon.h | 25 ++++
b/usr/lib/syscalls.pl | 12 +-
b/usr/lib/syscalls/syscommon.h | 29 ++++
b/usr/root/Makefile | 3
b/usr/root/hello |binary
b/usr/root/hello.c | 8 +
usr/lib/socketcommon.h | 25 ----
usr/lib/syscommon.h | 29 ----
17 files changed, 471 insertions(+), 165 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:11:51-06:00, [email protected]
klibc: fix up the hello_world example

stdout doesn't go anywhere useful when spawned from the kernel :)

----------------------------------------------------------------------------
hello.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:16:53-06:00, [email protected]
klibc: Fix a compiler warning

----------------------------------------------------------------------------
sha1hash.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:20:13-06:00, [email protected]
klibc: Fix the "hello" example (for real)

Greg's fix used fwrite on a file descriptor obtained from open(), which
only works by luck, since for klibc FILE * == fd.

Use standard C lib functions for open/close.

----------------------------------------------------------------------------
hello.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:21:47-06:00, [email protected]
klibc: add file support to gen_init_cpio.c

----------------------------------------------------------------------------
gen_init_cpio.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:24:10-06:00, [email protected]
klibc: gen_init_cpio file generation fix

I found what kept initramfs from working here: While creating
of initramfs_data.cpio.gz, the padding between a file header
and the file contents was wrong, which can be verified by
unpacking the archive by hand.

----------------------------------------------------------------------------
gen_init_cpio.c | 1 +
1 files changed, 1 insertion(+)

-----------------------------------------------------------------------------
[email protected], 2003-02-15 23:33:21-06:00, [email protected]
klibc: Stop on error when building the CPIO

gen_init_cpio still referenced hello in usr/hello_world, but I put it
into usr/root. This is now corrected, however it also pointed out the
common problem that the error code of gen_init_cpio is ignored since
it's output is piped to gzip. To fix that, make the generation of the
.cpio.gz a two step process.

----------------------------------------------------------------------------
Makefile | 24 +++++++++++++++++-------
gen_init_cpio.c | 2 +-
2 files changed, 18 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2003-02-16 18:06:13-06:00, [email protected]
klibc: Silence too ambitious warnings

gcc complained about unused function parameters and things, that's just
a little too much.

----------------------------------------------------------------------------
Makefile | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

-----------------------------------------------------------------------------
[email protected], 2003-02-16 18:11:32-06:00, [email protected]
klibc: Move mounting of the root filesystem into userspace

When selecting CONFIG_INITRAMFS, init/do_mounts.c is not compiled anymore,
and it's task is taken over by a small /sbin/init running in initramfs.

However, this is a proof of concept only, the userspace code only handles
mounting a local filesystem, no support for nfs / initrd / devfs yet.

----------------------------------------------------------------------------
init/Kconfig | 10 +
init/Makefile | 7
init/do_mounts.c | 6
init/main.c | 22 ++
scripts/Makefile | 4
usr/Makefile | 2
usr/gen_init_cpio.c | 2
usr/root/Makefile | 5
usr/root/init.c | 442 ++++++++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 489 insertions(+), 11 deletions(-)





2003-02-17 05:40:47

by Jeff Garzik

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

Kai Germaschewski wrote:
> I did some work on integrating klibc into kbuild now. I used your patch as
> guide line, though I started from scratch with klibc-0.77. The build
> should work fine (reminder: "make KBUILD_VERBOSE=0 ..." will give you much

woo hoo! Thanks much. I was sorta hoping you would step in and help
out with the kbuild issues ;-)


> To do something more useful than "hello world", I actually moved some part
> of finding / mounting the final root system into userspace, though only
> conditional on CONFIG_INITRAMFS.

FWIW, this should be ok for testing, but not a merge... we need to have
a single "do_mounts" code flow, not two code paths that are selected
with a switch.

That's why I see a lot of little klibc binaries, especially initially.
Moving piece-by-piece from do_mounts.c (and other places) to userspace
takes longer, but really maximizes both stability and testing of new code.

Jeff



2003-02-17 17:22:38

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

Kai Germaschewski wrote:

> should work fine (reminder: "make KBUILD_VERBOSE=0 ..." will give you much
> more readable output), but I probably broke some non-x86 architectures
> in the process.

I just tried building on s390x and only needed this trivial fix. Unfortunately,
2.5.61 does not boot on s390x yet, so I could not do run-time tests.

Arnd <><

===== usr/lib/socketcalls.pl 1.4 vs edited =====
--- 1.4/usr/lib/socketcalls.pl Sun Feb 16 06:09:33 2003
+++ edited/usr/lib/socketcalls.pl Mon Feb 17 18:24:39 2003
@@ -39,7 +39,7 @@
print OUT "\tjmp __socketcall_common\n";
print OUT "\t.size ${name},.-${name}\n";
} else {
- open(OUT, "> ${obj}/${name}.c")
+ open(OUT, "> ${obj}/socketcalls/${name}.c")
or die "$0: Cannot open socketcalls/${name}.c\n";
print OUT "#include \"socketcommon.h\"\n\n";

2003-02-17 17:52:50

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Sun, Feb 16, 2003 at 09:06:09PM -0600, Kai Germaschewski wrote:

> I did some work on integrating klibc into kbuild now. I used your patch as
> guide line, though I started from scratch with klibc-0.77. The build
> should work fine (reminder: "make KBUILD_VERBOSE=0 ..." will give you much
> more readable output), but I probably broke some non-x86 architectures
> in the process.

Got this output when compiling user programs:
USERCC usr/lib/snprintf.o
cc1: warning: -malign-loops is obsolete, use -falign-loops
cc1: warning: -malign-jumps is obsolete, use -falign-jumps
cc1: warning: -malign-functions is obsolete, use -falign-functions

$gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

It mostly look OK. I assume the duplication used for host-progs is
momentary?

Sam

2003-02-17 18:04:18

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

> On Sun, Feb 16, 2003 at 09:06:09PM -0600, Kai Germaschewski wrote:
>
>> I did some work on integrating klibc into kbuild now. I used your
>> patch as guide line, though I started from scratch with klibc-0.77.
>> The build should work fine (reminder: "make KBUILD_VERBOSE=0 ..."
>> will give you much more readable output), but I probably broke some
>> non-x86 architectures in the process.
>
> Got this output when compiling user programs:
> USERCC usr/lib/snprintf.o
> cc1: warning: -malign-loops is obsolete, use -falign-loops
> cc1: warning: -malign-jumps is obsolete, use -falign-jumps
> cc1: warning: -malign-functions is obsolete, use -falign-functions
>

I get the same error compiling the kernel proper for Crusoe. This is what
I like to call an "annoyance warning" where maintaining compatibility
between gcc versions emit a neverending stream of annoying messages.

-hpa



2003-02-17 18:27:30

by Jeff Garzik

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile Mon Feb 17 13:35:18 2003
+++ b/arch/i386/Makefile Mon Feb 17 13:35:18 2003
@@ -23,8 +23,10 @@

CFLAGS += -pipe

+check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+
# prevent gcc from keeping the stack 16 byte aligned
-CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi)
+CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)

ifdef CONFIG_M386
CFLAGS += -march=i386
@@ -83,7 +85,8 @@
endif

ifdef CONFIG_MCYRIXIII
-CFLAGS += -march=i486 -malign-functions=0 -malign-jumps=0 -malign-loops=0
+CFLAGS += $(call check_gcc,-march=c3,-march=i486)
+CFLAGS += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
endif

HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o


Attachments:
patch (0.98 kB)

2003-02-17 18:47:03

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Mon, Feb 17, 2003 at 01:36:59PM -0500, Jeff Garzik wrote:
>
> +check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)

Will check_gcc be compatible across architectures?
If thats the case it should be moved to a common place.

Checking.....
The same type of trick is used for alpha and sparc* -
so I will move it to the top-level makefile.

Sam

2003-02-17 19:15:19

by Jeff Garzik

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

Sam Ravnborg wrote:
> On Mon, Feb 17, 2003 at 01:36:59PM -0500, Jeff Garzik wrote:
>
>>
>>+check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
>
>
> Will check_gcc be compatible across architectures?


s/will/is/ Yes.

Jeff



2003-02-18 08:51:51

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

>
> Maintaining gcc compatibility need not imply this annoyance. This has
> been fixed in 2.5.x for ages, for the main kernel build, and I recently
> fixed it in 2.4.x by the attached patch. We just need to move that fix
> over to klibc build...
>


Of course it doesn't ... it's a matter of detecting if the -f options are
usable. It was more of a complaint at the gcc team.

However, I can personally vouch for that it's *not* fixed for the main
kernel build as of 2.5.61.

-hpa



2003-02-18 09:07:44

by Jeff Garzik

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1051 -> 1.1052
# arch/i386/Makefile 1.44 -> 1.45
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/02/18 [email protected] 1.1052
# [ia32] fix Crusoe CFLAGS on newer gcc versions
# --------------------------------------------
#
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile Tue Feb 18 04:15:39 2003
+++ b/arch/i386/Makefile Tue Feb 18 04:15:39 2003
@@ -39,7 +39,8 @@
cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586)
cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4))
-cflags-$(CONFIG_MCRUSOE) += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
+cflags-$(CONFIG_MCRUSOE) += -march=i686
+cflags-$(CONFIG_MCRUSOE) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586)
cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586)
cflags-$(CONFIG_MWINCHIP3D) += -march=i586


Attachments:
patch (1.43 kB)

2003-02-18 09:31:41

by Stelian Pop

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Tue, Feb 18, 2003 at 10:36:01AM +0100, Stelian Pop wrote:

> > H. Peter Anvin wrote:
> > >However, I can personally vouch for that it's *not* fixed for the main
> > >kernel build as of 2.5.61.
> >
> >
> > Well, if I had a Transmeta-powered laptop or handheld, I'm sure that
> > would be fixed too ;-)
> >
> > Can you give the attached patch a quick once-over? It's obvious enough
> > but I would rather the patch got tested nonetheless.

This is required for 2.4 too. Rediffed and tested, Marcelo please apply.

Stelian.

===== arch/i386/Makefile 1.5 vs edited =====
--- 1.5/arch/i386/Makefile Sun Feb 2 08:50:07 2003
+++ edited/arch/i386/Makefile Tue Feb 18 10:03:19 2003
@@ -61,15 +61,16 @@
endif

ifdef CONFIG_MK6
-CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
+CFLAGS += $(call check_gcc,-march=k6,-march=i586)
endif

ifdef CONFIG_MK7
-CFLAGS += $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi)
+CFLAGS += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
endif

ifdef CONFIG_MCRUSOE
-CFLAGS += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
+CFLAGS += -march=i686
+CFLAGS += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
endif

ifdef CONFIG_MWINCHIPC6
--
Stelian Pop <[email protected]>
Alcove - http://www.alcove.com

2003-02-18 09:30:05

by Stelian Pop

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Tue, Feb 18, 2003 at 04:17:16AM -0500, Jeff Garzik wrote:

> H. Peter Anvin wrote:
> >However, I can personally vouch for that it's *not* fixed for the main
> >kernel build as of 2.5.61.
>
>
> Well, if I had a Transmeta-powered laptop or handheld, I'm sure that
> would be fixed too ;-)
>
> Can you give the attached patch a quick once-over? It's obvious enough
> but I would rather the patch got tested nonetheless.

Tested, works ok.

Slighly different patch attached.

Linus, please apply.

Stelian.

===== arch/i386/Makefile 1.44 vs edited =====
--- 1.44/arch/i386/Makefile Fri Feb 7 19:59:54 2003
+++ edited/arch/i386/Makefile Tue Feb 18 09:59:16 2003
@@ -39,12 +39,13 @@
cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586)
cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4))
-cflags-$(CONFIG_MCRUSOE) += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
+cflags-$(CONFIG_MCRUSOE) += -march=i686
cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586)
cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586)
cflags-$(CONFIG_MWINCHIP3D) += -march=i586
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486)
# The alignment flags change with gcc 3.2
+cflags-$(CONFIG_MCRUSOE) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686)

--
Stelian Pop <[email protected]>
Alcove - http://www.alcove.com

2003-02-18 09:36:41

by Jeff Garzik

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

Patch for 2.4 looks good

2003-02-18 09:35:59

by Jeff Garzik

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

Stelian Pop wrote:
> Tested, works ok.

thanks.


> Slighly different patch attached.
>
> Linus, please apply.

um, please don't...


> ===== arch/i386/Makefile 1.44 vs edited =====
> --- 1.44/arch/i386/Makefile Fri Feb 7 19:59:54 2003
> +++ edited/arch/i386/Makefile Tue Feb 18 09:59:16 2003
> @@ -39,12 +39,13 @@
> cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586)
> cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
> cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4))
> -cflags-$(CONFIG_MCRUSOE) += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
> +cflags-$(CONFIG_MCRUSOE) += -march=i686
> cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586)
> cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586)
> cflags-$(CONFIG_MWINCHIP3D) += -march=i586
> cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486)
> # The alignment flags change with gcc 3.2
> +cflags-$(CONFIG_MCRUSOE) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
> cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
> cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686)

...because
(a) the Crusoe cflags are no longer together,
(b) Cyrix-3 cflags are suddenly bisected by Crusoe cflags, and
(c) you just dumped a crusoe-specific line in the middle of a bunch of
Via/Cyrix CPU settings.

None of those choices makes sense. If you want to improve upon my
patch, I would suggest consolidating the -f/-m check above the CPU
cflags section, and then reference the calculated value, rather than
wholly duplicating the calculation. The comment line "# The alignment
flags [...]" is obviously not the start of a new alignment-flags section.

Jeff



2003-02-18 09:50:07

by Stelian Pop

[permalink] [raw]
Subject: Re: [RFC] klibc for 2.5.59 bk

On Tue, Feb 18, 2003 at 04:45:33AM -0500, Jeff Garzik wrote:

> >Linus, please apply.
>
> um, please don't...

[...]
>
> ...because
> (a) the Crusoe cflags are no longer together,
> (b) Cyrix-3 cflags are suddenly bisected by Crusoe cflags, and
> (c) you just dumped a crusoe-specific line in the middle of a bunch of
> Via/Cyrix CPU settings.
>
> None of those choices makes sense. If you want to improve upon my
> patch, I would suggest consolidating the -f/-m check above the CPU
> cflags section, and then reference the calculated value, rather than
> wholly duplicating the calculation. The comment line "# The alignment
> flags [...]" is obviously not the start of a new alignment-flags section.

Agreed, I was overzealous here...

Consolidating the -f/-m check above seems a bit overkill, especially
since we don't want the same align options for all architectures.

Maybe removing the comment is the simplest improvement on your
patch then. Not a big improvement however :)

Stelian.

===== arch/i386/Makefile 1.44 vs edited =====
--- 1.44/arch/i386/Makefile Fri Feb 7 19:59:54 2003
+++ edited/arch/i386/Makefile Tue Feb 18 10:51:40 2003
@@ -39,12 +39,12 @@
cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586)
cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4))
-cflags-$(CONFIG_MCRUSOE) += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
+cflags-$(CONFIG_MCRUSOE) += -march=i686
+cflags-$(CONFIG_MCRUSOE) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586)
cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586)
cflags-$(CONFIG_MWINCHIP3D) += -march=i586
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486)
-# The alignment flags change with gcc 3.2
cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686)


--
Stelian Pop <[email protected]>
Alcove - http://www.alcove.com