public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* offsets.h and 32 -> 64 bit cross-compiling
@ 2004-02-02  1:19 Dan Kegel
  2004-02-10 21:16 ` David Mosberger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Kegel @ 2004-02-02  1:19 UTC (permalink / raw)
  To: linux-ia64

I recently updated my toolchain build script (http://kegel.com/crosstool)
to use linux-2.4.21 headers instead of linux-2.4.20, and can no longer generate
an x86 -> ia64 cross toolchain.  The new kernel source tree no longer has
asm-ia64/offsets.h, since that is now generated from other .h files at
'make dep' time.   Keith Owens noticed back in Sept '03 that this
had a chicken-and-egg problem when cross-compiling, and posted
http://www.gelato.unsw.edu.au/linux-ia64/0309/6667.html to fix that.

Sadly, that fix seems to be insufficient.
On my x86 build machine, 'make ARCH=ia64 dep' for linux-2.4.21 now fails with errors like

gcc -g -O2 -Wall -D__KERNEL__ -I/cross/linux-2.4.21/include -DKBUILD_BASENAME= print_offsets.c -o print_offsets
In file included ... from print_offsets.c:17:
/cross/linux-2.4.21/include/asm/page.h:75: warning: width of `off' exceeds its type
In file included ... from print_offsets.c:17:
/cross/linux-2.4.21/include/asm/byteorder.h: In function `__ia64_swab32':
/cross/linux-2.4.21/include/asm/byteorder.h:23: warning: right shift count >= width of type

(I suspect this has not changed in newer 2.4 kernels.)
Note that plain old gcc is used to compile this file, since it
has to generate an executable that can run on the build machine.

This doesn't seem to work when the build machine and the target architecture
have different bit widths!
Looking at the first error, page.h uses 'unsigned long' to indicate a 64 bit integer.
That could be fixed by using __u64 or uint64_t, assuming we change
<asm-*/types.h>'s definition of __u64 to work when cross-compiling.
To check whether the fix is complete, one would compare offsets.h
generated by a cross-compile run with one generated by a native run.

Has anyone looked at fixing this yet?  I'm going to drop back to
building with linux-2.4.20 headers or something for a while,
but it'd be nice to have this actually work sometime, and I'm
willing to do the work if nobody else has yet.

Thanks,
Dan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: offsets.h and 32 -> 64 bit cross-compiling
  2004-02-02  1:19 offsets.h and 32 -> 64 bit cross-compiling Dan Kegel
@ 2004-02-10 21:16 ` David Mosberger
  2004-02-11  5:59 ` Dan Kegel
  2004-02-11  6:17 ` Keith Owens
  2 siblings, 0 replies; 4+ messages in thread
From: David Mosberger @ 2004-02-10 21:16 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Sun, 01 Feb 2004 17:19:08 -0800, Dan Kegel <dank@kegel.com> said:

  Dan> Sadly, that fix seems to be insufficient.

  Dan> On my x86 build machine, 'make ARCH=ia64 dep' for linux-2.4.21 now fails with errors like

  Dan> gcc -g -O2 -Wall -D__KERNEL__ -I/cross/linux-2.4.21/include -DKBUILD_BASENAME= print_offsets.c -o print_offsets

Umh, you're using the wrong compiler.  You must use the IA-64
cross-compiler for print_offsets.c.  That's the entire point of
generating offsets.h at build-time: to ensure the definitions match
your (IA-64) compiler (and kernel-configuration).

When cross-compiling, you must set CROSS_COMPILE to the path that
contains the cross-tools.  When you do that, print_offsets.c will only
be translated to print_offsets.s and then converted to offsets.h via a
small awk-script.  Something like:

	make CROSS_COMPILE=/opt/ia64-cross-compiler/bin/

should do (with the correct path of course...).

	--david

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: offsets.h and 32 -> 64 bit cross-compiling
  2004-02-02  1:19 offsets.h and 32 -> 64 bit cross-compiling Dan Kegel
  2004-02-10 21:16 ` David Mosberger
@ 2004-02-11  5:59 ` Dan Kegel
  2004-02-11  6:17 ` Keith Owens
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Kegel @ 2004-02-11  5:59 UTC (permalink / raw)
  To: linux-ia64

David Mosberger wrote:
>>>>>>On Sun, 01 Feb 2004 17:19:08 -0800, Dan Kegel <dank@kegel.com> said:
> 
> 
>   Dan> Sadly, that fix seems to be insufficient.
> 
>   Dan> On my x86 build machine, 'make ARCH=ia64 dep' for linux-2.4.21 now fails with errors like
> 
>   Dan> gcc -g -O2 -Wall -D__KERNEL__ -I/cross/linux-2.4.21/include -DKBUILD_BASENAME= print_offsets.c -o print_offsets
> 
> Umh, you're using the wrong compiler.  You must use the IA-64
> cross-compiler for print_offsets.c.  That's the entire point of
> generating offsets.h at build-time: to ensure the definitions match
> your (IA-64) compiler (and kernel-configuration).
> 
> When cross-compiling, you must set CROSS_COMPILE to the path that
> contains the cross-tools.  When you do that, print_offsets.c will only
> be translated to print_offsets.s and then converted to offsets.h via a
> small awk-script.  Something like:
> 
> 	make CROSS_COMPILE=/opt/ia64-cross-compiler/bin/
> 
> should do (with the correct path of course...).

But how do I do that when I'm building the cross-compiler?
As far as I can tell, it looks like offsets.h is needed to
compile the cross-compiler.  Perhaps I can compile the bootstrap
compiler with a dummy version of offsets.h?

Have you ever tried to build a cross-compiler for ia64 from
virgin gnu tarballs without referring to any installed tools?
That's what I am trying to do with http://kegel.com/crosstool
Works great for most architectures, and it used to work fine for
ia64, but it broke when y'all took offsets.h out of the kernel source
tree, I think.
- Dan


-- 
US citizens: if you're considering voting for Bush, look at these first:
http://www.misleader.org/
http://www.cbc.ca/news/background/arar/
http://www.house.gov/reform/min/politicsandscience/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: offsets.h and 32 -> 64 bit cross-compiling
  2004-02-02  1:19 offsets.h and 32 -> 64 bit cross-compiling Dan Kegel
  2004-02-10 21:16 ` David Mosberger
  2004-02-11  5:59 ` Dan Kegel
@ 2004-02-11  6:17 ` Keith Owens
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Owens @ 2004-02-11  6:17 UTC (permalink / raw)
  To: linux-ia64

On Tue, 10 Feb 2004 21:59:58 -0800, 
Dan Kegel <dank@kegel.com> wrote:
>David Mosberger wrote:
>> Umh, you're using the wrong compiler.  You must use the IA-64
>> cross-compiler for print_offsets.c.  That's the entire point of
>> generating offsets.h at build-time: to ensure the definitions match
>> your (IA-64) compiler (and kernel-configuration).
>
>But how do I do that when I'm building the cross-compiler?
>As far as I can tell, it looks like offsets.h is needed to
>compile the cross-compiler.  Perhaps I can compile the bootstrap
>compiler with a dummy version of offsets.h?

Which compiler file needs asm/offsets.h?  I doubt that any user space
code should be using that file, it is probably being included by
mistake.

QAD workaround, copy /usr/include/asm/offsets.h from an ia64 system to
/usr/include/asm.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-11  6:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-02  1:19 offsets.h and 32 -> 64 bit cross-compiling Dan Kegel
2004-02-10 21:16 ` David Mosberger
2004-02-11  5:59 ` Dan Kegel
2004-02-11  6:17 ` Keith Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox