2004-09-20 08:26:24

by Dan Kegel

[permalink] [raw]
Subject: 2.6.8 link failure for powerpc-970?

I'm trying to verify that I can build toolchains and compile
and link kernels for a large set of CPU types using simple kernel config files.
I'm also somewhat foolishly trying to do all this with gcc-3.4.2.
So any problems I run into are a bit hard to pin down to
compiler, kernel, or user error, since this is mostly new territory for me.

Here's one issue.
When I build 2.6.8 for powerpc-970 (using the config file
I got when I ran 'make allnoconfig' on 2.6.5; you can see it at
http://kegel.com/crosstool/crosstool-0.28-rc36/powerpc64.config),
I get a few link errors:

arch/ppc64/kernel/built-in.o(.text+0xdc44): In function `.sys32_ipc':
: undefined reference to `.compat_sys_shmctl'
arch/ppc64/kernel/built-in.o(.text+0xdca0): In function `.sys32_ipc':
: undefined reference to `.compat_sys_semctl'
arch/ppc64/kernel/built-in.o(.text+0xdcbc): In function `.sys32_ipc':
: undefined reference to `.compat_sys_msgsnd'
arch/ppc64/kernel/built-in.o(.text+0xdce0): In function `.sys32_ipc':
: undefined reference to `.compat_sys_msgrcv'
arch/ppc64/kernel/built-in.o(.text+0xdd0c): In function `.sys32_ipc':
: undefined reference to `.compat_sys_msgctl'
arch/ppc64/kernel/built-in.o(.text+0xdd28): In function `.sys32_ipc':
: undefined reference to `.compat_sys_shmat'
arch/ppc64/kernel/built-in.o(.text+0xdd3c): In function `.sys32_ipc':
: undefined reference to `.compat_sys_semtimedop'
arch/ppc64/kernel/built-in.o(.text+0xe9d4): In function `.sys32_sysctl':
: undefined reference to `.do_sysctl'
arch/ppc64/kernel/built-in.o(.text+0x10958): In function `.routing_ioctl':
: undefined reference to `.sockfd_lookup'
net/built-in.o(.text+0x278): In function `.verify_compat_iovec':
: undefined reference to `.move_addr_to_kernel'
net/built-in.o(.text+0x724): In function `.scm_detach_fds_compat':
: undefined reference to `.__scm_destroy'
make: *** [.tmp_vmlinux1] Error 1

Is this user error for using an old config file, is it silliness
from gcc-3.4.2, or is something else going on?

Thanks,
Dan

--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change


2004-09-20 08:35:50

by Arjan van de Ven

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?

On Mon, 2004-09-20 at 10:24, Dan Kegel wrote:
> I'm trying to verify that I can build toolchains and compile
> and link kernels for a large set of CPU types using simple kernel config files.
> I'm also somewhat foolishly trying to do all this with gcc-3.4.2.
> So any problems I run into are a bit hard to pin down to
> compiler, kernel, or user error, since this is mostly new territory for me.

use this patch
--- linux-2.6.8/arch/ppc64/Makefile~ 2004-09-03 13:02:48.372244432
+0200
+++ linux-2.6.8/arch/ppc64/Makefile 2004-09-03 13:02:48.372244432
+0200
@@ -28,5 +28,7 @@
LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext
$(KERNELLOAD)
CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none
+
+CFLAGS += $(call cc-option,-mcall-aixdesc)

ifeq ($(CONFIG_POWER4_ONLY),y)
CFLAGS += $(call cc-option,-mcpu=power4)



Attachments:
signature.asc (189.00 B)
This is a digitally signed message part

2004-09-22 03:22:16

by Dan Kegel

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?

Arjan van de Ven wrote:
> On Mon, 2004-09-20 at 10:24, Dan Kegel wrote:
>
>>I'm trying to verify that I can build toolchains and compile
>>and link kernels for a large set of CPU types using simple kernel config files.
>>I'm also somewhat foolishly trying to do all this with gcc-3.4.2.
>>So any problems I run into are a bit hard to pin down to
>>compiler, kernel, or user error, since this is mostly new territory for me.
>
>
> use this patch
> --- linux-2.6.8/arch/ppc64/Makefile~ 2004-09-03 13:02:48.372244432 +0200
> +++ linux-2.6.8/arch/ppc64/Makefile 2004-09-03 13:02:48.372244432 +0200
> @@ -28,5 +28,7 @@
> LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
> CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none
> +CFLAGS += $(call cc-option,-mcall-aixdesc)

That didn't help. In fact, cc-option is undefined, so it did nothing.
I tried correcting this to check_gcc:

--- linux-2.6.8/arch/ppc64/Makefile.old 2004-09-20 07:04:35.000000000 -0700
+++ linux-2.6.8/arch/ppc64/Makefile 2004-09-20 07:06:38.000000000 -0700
@@ -28,6 +28,7 @@
LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \
-mtraceback=none
+CFLAGS += $(call check_gcc,-mcall-aixdesc)

This actually affected the build in that -mcall-aixdesc was used on many
compiles, but the build still ended with the same errors:

/opt/crosstool/powerpc64-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/bin/powerpc64-unknown-linux-gnu-ld -m elf64ppc -m elf64ppc -Bstatic -e 0xc000000000000000 -Ttext 0xc000000000000000 -T arch/ppc64/kernel/vmlinux.lds.asm
arch/ppc64/kernel/head.o init/built-in.o --start-group usr/built-in.o arch/ppc64/kernel/built-in.o arch/ppc64/mm/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o
lib/lib.a arch/ppc64/lib/lib.a lib/built-in.o arch/ppc64/lib/built-in.o drivers/built-in.o sound/built-in.o net/built-in.o --end-group -o .tmp_vmlinux1
arch/ppc64/kernel/built-in.o(.text+0xdc44): In function `.sys32_ipc':
: undefined reference to `.compat_sys_shmctl'
arch/ppc64/kernel/built-in.o(.text+0xdca0): In function `.sys32_ipc':
: undefined reference to `.compat_sys_semctl'
arch/ppc64/kernel/built-in.o(.text+0xdcbc): In function `.sys32_ipc':
: undefined reference to `.compat_sys_msgsnd'
arch/ppc64/kernel/built-in.o(.text+0xdce0): In function `.sys32_ipc':
: undefined reference to `.compat_sys_msgrcv'
arch/ppc64/kernel/built-in.o(.text+0xdd0c): In function `.sys32_ipc':
: undefined reference to `.compat_sys_msgctl'
arch/ppc64/kernel/built-in.o(.text+0xdd28): In function `.sys32_ipc':
: undefined reference to `.compat_sys_shmat'
arch/ppc64/kernel/built-in.o(.text+0xdd3c): In function `.sys32_ipc':
: undefined reference to `.compat_sys_semtimedop'
arch/ppc64/kernel/built-in.o(.text+0xe9d4): In function `.sys32_sysctl':
: undefined reference to `.do_sysctl'
arch/ppc64/kernel/built-in.o(.text+0x10958): In function `.routing_ioctl':
: undefined reference to `.sockfd_lookup'
net/built-in.o(.text+0x278): In function `.verify_compat_iovec':
: undefined reference to `.move_addr_to_kernel'
net/built-in.o(.text+0x724): In function `.scm_detach_fds_compat':
: undefined reference to `.__scm_destroy'
make: *** [.tmp_vmlinux1] Error 1

Got another suggestion?

Thanks,
Dan

--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change

2004-09-22 16:43:45

by Dan Kegel

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?

Dan Kegel wrote:
>> On Mon, 2004-09-20 at 10:24, Dan Kegel wrote:
>>
>>> I'm trying to verify that I can build toolchains and compile
>>> and link kernels for a large set of CPU types using simple kernel
>>> config files.
>>> I'm also somewhat foolishly trying to do all this with gcc-3.4.2.
>>> So any problems I run into are a bit hard to pin down to
>>> compiler, kernel, or user error, since this is mostly new territory
>>> for me. ...
>
> arch/ppc64/kernel/built-in.o(.text+0xdc44): In function `.sys32_ipc':
> : undefined reference to `.compat_sys_shmctl'
> ...

Could it be a config problem? My config file was from 'allnoconfig', I think, and has
$ egrep 'SYSV|COMPAT' .config
CONFIG_COMPAT=y
# CONFIG_SYSVIPC is not set
compat_sys_shmctl is in ipc/compat.c, and is enabled by CONFIG_SYSVIPC_COMPAT,
which depends on CONFIG_SYSVIPC, which is off.

The reference to compat_sys_shmctl seems to be in
./arch/ia64/ia32/sys_ia32.c
./arch/ppc64/kernel/sys_ppc32.c
./arch/x86_64/ia32/ipc32.c
./arch/s390/kernel/compat_linux.c
and appears to not be conditioned on CONFIG_SYSVIPC_COMPAT.
Seems like linking problems are expected unless you turn on
CONFIG_SYSVIPC and CONFIG_SYSVIPC_COMPAT.

I turned 'em on and am trying again.
- Dan

--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change

2004-09-22 22:27:30

by Herbert Poetzl

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?

On Wed, Sep 22, 2004 at 09:41:33AM -0700, Dan Kegel wrote:
> Dan Kegel wrote:
> >>On Mon, 2004-09-20 at 10:24, Dan Kegel wrote:
> >>
> >>>I'm trying to verify that I can build toolchains and compile
> >>>and link kernels for a large set of CPU types using simple kernel
> >>>config files.

Hi Dan!

once you figured out what 'default' configs
are appropriate for the special archs not working
with allyes/noconfig could you send me a note
and/or post a link to them somewhere?

TIA,
Herbert

> >>>I'm also somewhat foolishly trying to do all this with gcc-3.4.2.
> >>>So any problems I run into are a bit hard to pin down to
> >>>compiler, kernel, or user error, since this is mostly new territory
> >>>for me. ...
> >
> >arch/ppc64/kernel/built-in.o(.text+0xdc44): In function `.sys32_ipc':
> >: undefined reference to `.compat_sys_shmctl'
> > ...
>
> Could it be a config problem? My config file was from 'allnoconfig', I
> think, and has
> $ egrep 'SYSV|COMPAT' .config
> CONFIG_COMPAT=y
> # CONFIG_SYSVIPC is not set
> compat_sys_shmctl is in ipc/compat.c, and is enabled by
> CONFIG_SYSVIPC_COMPAT,
> which depends on CONFIG_SYSVIPC, which is off.
>
> The reference to compat_sys_shmctl seems to be in
> ./arch/ia64/ia32/sys_ia32.c
> ./arch/ppc64/kernel/sys_ppc32.c
> ./arch/x86_64/ia32/ipc32.c
> ./arch/s390/kernel/compat_linux.c
> and appears to not be conditioned on CONFIG_SYSVIPC_COMPAT.
> Seems like linking problems are expected unless you turn on
> CONFIG_SYSVIPC and CONFIG_SYSVIPC_COMPAT.
>
> I turned 'em on and am trying again.
> - Dan
>
> --
> My technical stuff: http://kegel.com
> My politics: see http://www.misleader.org for examples of why I'm for
> regime change
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2004-09-23 02:10:48

by Anton Blanchard

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?


Hi,

> use this patch
> --- linux-2.6.8/arch/ppc64/Makefile~ 2004-09-03 13:02:48.372244432
> +0200
> +++ linux-2.6.8/arch/ppc64/Makefile 2004-09-03 13:02:48.372244432
> +0200
> @@ -28,5 +28,7 @@
> LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext
> $(KERNELLOAD)
> CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none
> +
> +CFLAGS += $(call cc-option,-mcall-aixdesc)

We shouldnt need this with the two recent patches from Alan Modra
(add -synthetic to nm in arch/ppc64/Makefile and add an opd section
in the ppc64 vmlinux.lds).

Anton

2004-09-23 05:26:50

by Dan Kegel

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?

Herbert Poetzl wrote:
>>>arch/ppc64/kernel/built-in.o(.text+0xdc44): In function `.sys32_ipc':
>>>: undefined reference to `.compat_sys_shmctl'
>>>...
>>
>>Could it be a config problem? My config file was from 'allnoconfig', I
>>think, and has
>>$ egrep 'SYSV|COMPAT' .config
>>CONFIG_COMPAT=y
>># CONFIG_SYSVIPC is not set
>>compat_sys_shmctl is in ipc/compat.c, and is enabled by
>>CONFIG_SYSVIPC_COMPAT,
>>which depends on CONFIG_SYSVIPC, which is off. ...
>>Seems like linking problems are expected unless you turn on
>>CONFIG_SYSVIPC and CONFIG_SYSVIPC_COMPAT.
>
> once you figured out what 'default' configs
> are appropriate for the special archs not working
> with allyes/noconfig could you send me a note
> and/or post a link to them somewhere?

Sure. For ppc64, beyond allnoconfig, I had to enable

CONFIG_SYSVIPC
CONFIG_SYSCTL
CONFIG_NET
... um, but that didn't fix everything. Now it fails with

...
make -f scripts/Makefile.build obj=arch/ppc64/boot arch/ppc64/boot/zImage
gzip -f -9 < vmlinux > arch/ppc64/boot/kernel-vmlinux.gz
touch arch/ppc64/boot/kernel-vmlinux.c
gcc -Wp,-MD,arch/ppc64/boot/.kernel-vmlinux.o.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -fno-builtin -c -o arch/ppc64/boot/kernel-vmlinux.o arch/ppc64/boot/kernel-vmlinux.c
objcopy arch/ppc64/boot/kernel-vmlinux.o --add-section=.kernel:vmlinux=arch/ppc64/boot/kernel-vmlinux.gz --set-section-flags=.kernel:vmlinux=contents,alloc,load,readonly,data
gzip -f -9 < .config > arch/ppc64/boot/kernel-.config.gz
touch arch/ppc64/boot/kernel-.config.c
gcc -Wp,-MD,arch/ppc64/boot/.kernel-.config.o.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -fno-builtin -c -o arch/ppc64/boot/kernel-.config.o arch/ppc64/boot/kernel-.config.c
objcopy arch/ppc64/boot/kernel-.config.o --add-section=.kernel:.config=arch/ppc64/boot/kernel-.config.gz --set-section-flags=.kernel:.config=contents,alloc,load,readonly,data
gzip -f -9 < System.map > arch/ppc64/boot/kernel-System.map.gz
touch arch/ppc64/boot/kernel-System.map.c
gcc -Wp,-MD,arch/ppc64/boot/.kernel-System.map.o.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -fno-builtin -c -o arch/ppc64/boot/kernel-System.map.o arch/ppc64/boot/kernel-System.map.c
objcopy arch/ppc64/boot/kernel-System.map.o --add-section=.kernel:System.map=arch/ppc64/boot/kernel-System.map.gz --set-section-flags=.kernel:System.map=contents,alloc,load,readonly,data

gcc -Wp,-MD,arch/ppc64/boot/.crt0.o.d -D__ASSEMBLY__ -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -fno-builtin -traditional -c -o arch/ppc64/boot/crt0.o arch/ppc64/boot/crt0.S

arch/ppc64/boot/crt0.S: Assembler messages:
arch/ppc64/boot/crt0.S:17: Error: no such instruction: `lis 9,_start@h'
...

Um, why is it using the host's gcc? I ran make with
make V=1 ARCH=ppc64 CROSS_COMPILE=/opt/crosstool/powerpc64-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/bin/powerpc64-unknown-linux-gnu-
so it really should know better, shouldn't it?

I'm too sleepy to figure this out at the moment.
Thanks for any tips ("I'm programming... while I sleep")!
- Dan


--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change

2004-09-23 13:29:13

by Anton Blanchard

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?


> Sure. For ppc64, beyond allnoconfig, I had to enable
> CONFIG_SYSVIPC
> CONFIG_SYSCTL
> CONFIG_NET
> ... um, but that didn't fix everything. Now it fails with

OK, I guess we need some better wrapping of compat code.

> Um, why is it using the host's gcc? I ran make with
> make V=1 ARCH=ppc64
> CROSS_COMPILE=/opt/crosstool/powerpc64-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/bin/powerpc64-unknown-linux-gnu-
> so it really should know better, shouldn't it?

Check out arch/ppc64/boot/Makefile, in particular CROSS32_COMPILE. The
boot wrapper is a 32bit binary.

Now that the toolchain is biarch capable we could get rid of that and
use gcc -m32 instead. But for the moment specify a CROSS32_COMPILE ant
things should link.

Anton

2004-09-23 14:16:32

by Dan Kegel

[permalink] [raw]
Subject: Re: 2.6.8 link failure for powerpc-970?

Anton Blanchard wrote:
>
>
>>Sure. For ppc64, beyond allnoconfig, I had to enable
>>CONFIG_SYSVIPC
>>CONFIG_SYSCTL
>>CONFIG_NET
>>... um, but that didn't fix everything. Now it fails with
>
>
> OK, I guess we need some better wrapping of compat code.

Yeah, probably for several of the 64 bit arches. Sounds like
a nice little kernel-janitor project.

>>Um, why is it using the host's gcc? I ran make with
>>make V=1 ARCH=ppc64
>>CROSS_COMPILE=/opt/crosstool/powerpc64-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/bin/powerpc64-unknown-linux-gnu-
>>so it really should know better, shouldn't it?
>
>
> Check out arch/ppc64/boot/Makefile, in particular CROSS32_COMPILE. The
> boot wrapper is a 32bit binary.
>
> Now that the toolchain is biarch capable we could get rid of that and
> use gcc -m32 instead. But for the moment specify a CROSS32_COMPILE ant
> things should link.

Aha! Got it. Thanks!
- Dan

--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change