Skip to contentSkip to conversation

Linux kernel cross-compilers

DISCUSSION Guenter Roeck 4 participants 18 messages Aug 15, 2013 – Aug 17, 2013

lore
Share & tools
lore
#0 lore raw

Hi Tony,

would it be possible to provide an arm64 cross-compiler on https://www.kernel.org/pub/tools/crosstool/ ? Also, the xtensa compiler fails for me with an odd error message on one of my servers. Have you heard about any problems with it from others ?

c6x is supposed to be supported by gcc now. No idea if that helps anything, though.

Thanks,
Guenter

#1 lore raw

Hi Guenter,

Quoted 2 lines · Guenter Roeck

Also, the xtensa compiler fails for me with an odd error message on one of my servers.

What is the message?

Quoted 1 line

Have you heard about any problems with it from others ?

Yes, xtensa compiler/linker is known to have issues with link-time relaxation; e.g. it may fail to build linux image without CONFIG_LD_NO_RELAX.

Signature · 2 lines
Thanks.
-- Max
#2 lore raw
Quoted 8 lines · Max Filippov

Hi Guenter,

Quoted 2 lines · Guenter Roeck

Also, the xtensa compiler fails for me with an odd error message on one of my servers.

What is the message?

It complains about being unable to change the byte order in an object file.

Actually, the message is from the linker, but I have no idea what is causing it. It works on two servers but fails on the third. At least in theory the installation on all servers should be the same.

Guenter

#3 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Max Filippov

Hi Guenter,

Quoted 4 lines · Guenter Roeck

Also, the xtensa compiler fails for me with an odd error message on one of
my servers.

Quoted 6 lines
Quoted 2 lines

What is the message?

It complains about being unable to change the byte order in an object file.

Actually, the message is from the linker, but I have no idea what is causing it.

I've seen such message when I attempted to link a kernel, parts of which were by mistake compiled for different xtensa core variants. Clean rebuild fixed that.

Quoted 3 lines

It works on two servers but fails on the third. At least in theory the installation
on all servers should be the same.

Signature · 2 lines
Thanks.
-- Max
#4 lore raw
Quoted 14 lines · Max Filippov
Quoted 13 lines · Guenter Roeck
Quoted 12 lines · Max Filippov

Hi Guenter,

Quoted 4 lines · Guenter Roeck

Also, the xtensa compiler fails for me with an odd error message on one of
my servers.

What is the message?

Quoted 9 lines
Quoted 4 lines

It complains about being unable to change the byte order in an object file.

Actually, the message is from the linker, but I have no idea what is causing it.

I've seen such message when I attempted to link a kernel, parts of which were by mistake compiled for different xtensa core variants. Clean rebuild fixed that.

"clean -f -q -d -x" did not help in my case. It can't get much cleaner than that.

Guenter

#5 lore raw
In reply to Max Filippov
Quoted 2 lines · Max Filippov

Yes, xtensa compiler/linker is known to have issues with link-time relaxation; e.g. it may fail to build linux image without CONFIG_LD_NO_RELAX.

Is there something I can do at linker build time to help with this?

Yours Tony

#6 lore raw
Quoted 6 lines · Tony Breeds
Quoted 2 lines · Max Filippov

Yes, xtensa compiler/linker is known to have issues with link-time relaxation; e.g. it may fail to build linux image without CONFIG_LD_NO_RELAX.

Is there something I can do at linker build time to help with this?

I don't think so. Apparently it's not a linker configuration issue, it's a bug.

Signature · 2 lines
Thanks.
-- Max
#7 lore raw
Quoted 10 lines · Max Filippov
Quoted 6 lines · Tony Breeds
Quoted 2 lines · Max Filippov

Yes, xtensa compiler/linker is known to have issues with link-time relaxation; e.g. it may fail to build linux image without CONFIG_LD_NO_RELAX.

Is there something I can do at linker build time to help with this?

I don't think so. Apparently it's not a linker configuration issue, it's a bug.

CONFIG_LD_NO_RELAX doesn't help.

For reference, here is the error:

xtensa-linux-objcopy: Unable to change endianness of input file(s) make[2]: *** [arch/xtensa/boot/boot-elf/Image.o] Error 1 make[1]: *** [boot-elf] Error 2
make: *** [zImage] Error 2

Oddly enough, I only see the problem on one of three servers.

Guenter

#8 lore raw
Quoted 20 lines · Guenter Roeck
Quoted 11 lines · Max Filippov
Quoted 8 lines · Tony Breeds
Quoted 3 lines · Max Filippov

Yes, xtensa compiler/linker is known to have issues with link-time relaxation; e.g. it may fail to build linux image without CONFIG_LD_NO_RELAX.

Quoted 6 lines
Quoted 1 line

Is there something I can do at linker build time to help with this?

I don't think so. Apparently it's not a linker configuration issue, it's a bug.

CONFIG_LD_NO_RELAX doesn't help.

Quoted 8 lines

For reference, here is the error:

xtensa-linux-objcopy: Unable to change endianness of input file(s) make[2]: *** [arch/xtensa/boot/boot-elf/Image.o] Error 1 make[1]: *** [boot-elf] Error 2
make: *** [zImage] Error 2

Oddly enough, I only see the problem on one of three servers.

Guenter,
can you share a complete build log with V=1?

Signature · 2 lines
Thanks.
-- Max
#9 lore raw
Quoted 28 lines · Max Filippov
Quoted 27 lines · Guenter Roeck
Quoted 11 lines · Max Filippov
Quoted 8 lines · Tony Breeds
Quoted 3 lines · Max Filippov

Yes, xtensa compiler/linker is known to have issues with link-time relaxation; e.g. it may fail to build linux image without CONFIG_LD_NO_RELAX.

Quoted 6 lines
Quoted 1 line

Is there something I can do at linker build time to help with this?

I don't think so. Apparently it's not a linker configuration issue, it's a bug.

CONFIG_LD_NO_RELAX doesn't help.

For reference, here is the error:

xtensa-linux-objcopy: Unable to change endianness of input file(s) make[2]: *** [arch/xtensa/boot/boot-elf/Image.o] Error 1 make[1]: *** [boot-elf] Error 2
make: *** [zImage] Error 2

Quoted 5 lines
Quoted 1 line

Oddly enough, I only see the problem on one of three servers.

Guenter,
can you share a complete build log with V=1?

http://roeck-us.net/linux/logs/make.xtensa.log.bad
http://roeck-us.net/linux/logs/make.xtensa.log.ok

Key difference: the failing command in the bad case is
xtensa-linux-objcopy -O elf32-xtensa-le
and in the good case
xtensa-linux-objcopy -O elf32-xtensa-be

Same compiler (4.6.3 from kernel.org), same configuration file, same command line. Configuration file is generated from defconfig, and the resulting .config file is the same in both cases.

If I execute make and expicitly set BIG_ENDIAN=1 on the failing system as parameter to it, it works fine. If I set BIG_ENDIAN=0 on the passing system, it fails.

I am puzzled. Guess there must be something different, but I have no idea what it might be.

If I execute the command which sets BIG_ENDIAN manually from the shell (from arch/xtensa/boot/Makefile), it returns 1 on both systems.

If you have an idea what is going on please let me know.

Thanks,
Guenter

#10 lore raw
Quoted 18 lines
Quoted 3 lines

Guenter,
can you share a complete build log with V=1?

http://roeck-us.net/linux/logs/make.xtensa.log.bad
http://roeck-us.net/linux/logs/make.xtensa.log.ok

Key difference: the failing command in the bad case is
xtensa-linux-objcopy -O elf32-xtensa-le
and in the good case
xtensa-linux-objcopy -O elf32-xtensa-be

Same compiler (4.6.3 from kernel.org), same configuration file, same command line.
Configuration file is generated from defconfig, and the resulting .config file
is the same in both cases.

Quoted 6 lines

If I execute make and expicitly set BIG_ENDIAN=1 on the failing system as parameter to it,
it works fine. If I set BIG_ENDIAN=0 on the passing system, it fails.

I am puzzled. Guess there must be something different, but I have no idea what it might be.

What is the output of

echo -e __XTENSA_EB__ | xtensa-linux-gcc -E -

on the failing system?

Signature · 2 lines
Thanks.
-- Max
#11 lore raw
Quoted 22 lines · Max Filippov
Quoted 22 lines
Quoted 3 lines

Guenter,
can you share a complete build log with V=1?

http://roeck-us.net/linux/logs/make.xtensa.log.bad
http://roeck-us.net/linux/logs/make.xtensa.log.ok

Key difference: the failing command in the bad case is
xtensa-linux-objcopy -O elf32-xtensa-le
and in the good case
xtensa-linux-objcopy -O elf32-xtensa-be

Same compiler (4.6.3 from kernel.org), same configuration file, same command line.
Configuration file is generated from defconfig, and the resulting .config file
is the same in both cases.

If I execute make and expicitly set BIG_ENDIAN=1 on the failing system as parameter to it,
it works fine. If I set BIG_ENDIAN=0 on the passing system, it fails.

Quoted 9 lines
Quoted 2 lines

I am puzzled. Guess there must be something different, but I have no idea what it might be.

What is the output of

echo -e __XTENSA_EB__ | xtensa-linux-gcc -E -

on the failing system?

It is "1", but that let me pinpoint the problem.

On the failing system, the version of echo executed by make does not understand the "-e" option. Thus, when running arch/xtensa/boot/Makefile, "echo -e __XTENSA_EB__" returns "-e __XTENSA_EB__", which doesn't compile, and BIG_ENDIAN ends up being 0. So the compiler is completely innocent.

I found out the root source: SHELL is set the /bin/sh, which on the failing system points to /bin/dash (default in Ubuntu, or at least it used to be). dash apparently has a built-in version of echo which does not understand '-e'. Oh well.

Thanks a lot for helping me to track this down!

Guenter

#12 lore raw
Quoted 34 lines · Guenter Roeck
Quoted 22 lines · Max Filippov
Quoted 22 lines
Quoted 3 lines

Guenter,
can you share a complete build log with V=1?

http://roeck-us.net/linux/logs/make.xtensa.log.bad
http://roeck-us.net/linux/logs/make.xtensa.log.ok

Key difference: the failing command in the bad case is
xtensa-linux-objcopy -O elf32-xtensa-le
and in the good case
xtensa-linux-objcopy -O elf32-xtensa-be

Same compiler (4.6.3 from kernel.org), same configuration file, same command line.
Configuration file is generated from defconfig, and the resulting .config file
is the same in both cases.

If I execute make and expicitly set BIG_ENDIAN=1 on the failing system as parameter to it,
it works fine. If I set BIG_ENDIAN=0 on the passing system, it fails.

Quoted 9 lines
Quoted 2 lines

I am puzzled. Guess there must be something different, but I have no idea what it might be.

What is the output of

echo -e __XTENSA_EB__ | xtensa-linux-gcc -E -

on the failing system?

It is "1", but that let me pinpoint the problem.

Quoted 8 lines

On the failing system, the version of echo executed by make does not understand the "-e" option. Thus, when running arch/xtensa/boot/Makefile, "echo -e __XTENSA_EB__" returns "-e __XTENSA_EB__", which doesn't compile, and BIG_ENDIAN ends up being 0. So the compiler is completely innocent.

I found out the root source: SHELL is set the /bin/sh, which on the failing system points to /bin/dash (default in Ubuntu, or at least it used to be). dash apparently has a built-in version of echo which does not understand '-e'.

Could you try to replace "echo -e bla" with "printf "bla". Kbuild.include uses some similar tricks but here printf is used. Maybe this can be dash compatible then

Sam

#13 lore raw
Quoted 40 lines · Sam Ravnborg
Quoted 39 lines · Guenter Roeck
Quoted 22 lines · Max Filippov
Quoted 22 lines
Quoted 3 lines

Guenter,
can you share a complete build log with V=1?

http://roeck-us.net/linux/logs/make.xtensa.log.bad
http://roeck-us.net/linux/logs/make.xtensa.log.ok

Key difference: the failing command in the bad case is
xtensa-linux-objcopy -O elf32-xtensa-le
and in the good case
xtensa-linux-objcopy -O elf32-xtensa-be

Same compiler (4.6.3 from kernel.org), same configuration file, same command line.
Configuration file is generated from defconfig, and the resulting .config file
is the same in both cases.

If I execute make and expicitly set BIG_ENDIAN=1 on the failing system as parameter to it,
it works fine. If I set BIG_ENDIAN=0 on the passing system, it fails.

Quoted 9 lines
Quoted 2 lines

I am puzzled. Guess there must be something different, but I have no idea what it might be.

What is the output of

echo -e __XTENSA_EB__ | xtensa-linux-gcc -E -

on the failing system?

It is "1", but that let me pinpoint the problem.

On the failing system, the version of echo executed by make does not understand the "-e" option. Thus, when running arch/xtensa/boot/Makefile, "echo -e __XTENSA_EB__" returns "-e __XTENSA_EB__", which doesn't compile, and BIG_ENDIAN ends up being 0. So the compiler is completely innocent.

Quoted 8 lines
Quoted 3 lines

I found out the root source: SHELL is set the /bin/sh, which on the failing system points to /bin/dash (default in Ubuntu, or at least it used to be). dash apparently has a built-in version of echo which does not understand '-e'.

Could you try to replace "echo -e bla" with "printf "bla". Kbuild.include uses some similar tricks but here printf is used. Maybe this can be dash compatible then

"echo" would do perfectly fine in this case. Besides, there are more "echo -e" in arch/xtensa/Makefile. Those only cause unpredictable build results (because neither big endian not little endian is set because of it), but no errors.

Problem is that "echo -e" is used elsewhere in various kernel makefiles, not just for xtensa. Those don't cause odd errors like the one I observed, but may result in unpredictable behavior. I am not sure if I should try to fix that.

Maybe we should just put "don't try to compile the linux kernel with dash as default shell" as a note somewhere.

Guenter

#14 lore raw
In reply to Guenter Roeck
Quoted 43 lines · Guenter Roeck
Quoted 28 lines · Max Filippov
Quoted 20 lines
Quoted 4 lines

Guenter,
can you share a complete build log with V=1?

http://roeck-us.net/linux/logs/make.xtensa.log.bad
http://roeck-us.net/linux/logs/make.xtensa.log.ok

Key difference: the failing command in the bad case is
xtensa-linux-objcopy -O elf32-xtensa-le
and in the good case
xtensa-linux-objcopy -O elf32-xtensa-be

Same compiler (4.6.3 from kernel.org), same configuration file, same command
line.
Configuration file is generated from defconfig, and the resulting .config file
is the same in both cases.

Quoted 6 lines

If I execute make and expicitly set BIG_ENDIAN=1 on the failing system as parameter to it,
it works fine. If I set BIG_ENDIAN=0 on the passing system, it fails.

I am puzzled. Guess there must be something different, but I have no idea what it might be.

Quoted 6 lines

What is the output of

echo -e __XTENSA_EB__ | xtensa-linux-gcc -E -

on the failing system?

It is "1", but that let me pinpoint the problem.

On the failing system, the version of echo executed by make does not understand the "-e" option. Thus, when running arch/xtensa/boot/Makefile,
"echo -e __XTENSA_EB__" returns "-e __XTENSA_EB__", which doesn't compile, and BIG_ENDIAN ends up being 0. So the compiler is completely innocent.

Quoted 5 lines

I found out the root source: SHELL is set the /bin/sh, which on the failing system points to /bin/dash (default in Ubuntu, or at least it used to be). dash apparently has a built-in version of echo which does not understand '-e'.
Oh well.

Cool. OTOH I don't think that we need to -e to output __XTENSA_EB__. Will send a patch for that.

Signature · 2 lines
Thanks.
-- Max
#15 lore raw
Quoted 9 lines
Quoted 6 lines

I found out the root source: SHELL is set the /bin/sh, which on the failing system points to /bin/dash (default in Ubuntu, or at least it used to be). dash apparently has a built-in version of echo which does not understand '-e'.
Oh well.

Cool. OTOH I don't think that we need to -e to output __XTENSA_EB__. Will send a patch for that.

Could you please take a look at the other places that uses "echo -e". At least one usage inarch/x86/Makefiel looks questionable. grep did not turn up many uses.

Sam

#16 lore raw
In reply to Guenter Roeck
Quoted 3 lines · Guenter Roeck

Hi Tony,

would it be possible to provide an arm64 cross-compiler on https://www.kernel.org/pub/tools/crosstool/ ?

I have one built I just need to upload it. I'll try and do it this weekend.

Quoted 2 lines

Also, the xtensa compiler fails for me with an odd error message on one of my servers. Have you heard about any problems with it from others ?

Nope. Sorry, but it looks like you're being looked after there.

Quoted 1 line

c6x is supposed to be supported by gcc now. No idea if that helps anything, though.

Thanks. I have tried to build a 4.8.1 cx6 toolchain but It hasn't worked todate. I'll keep trying as time permits.

Quoted 4 lines

Thanks,
Guenter

Yours Tony

#17 lore raw
Quoted 8 lines · Tony Breeds
Quoted 3 lines · Guenter Roeck

Hi Tony,

would it be possible to provide an arm64 cross-compiler on https://www.kernel.org/pub/tools/crosstool/ ?

I have one built I just need to upload it. I'll try and do it this weekend.

Would be great.

Quoted 5 lines
Quoted 2 lines

Also, the xtensa compiler fails for me with an odd error message on one of my servers. Have you heard about any problems with it from others ?

Nope. Sorry, but it looks like you're being looked after there.

No far not helping. I had hoped it is a known problem that has been fixed with a later gcc or binutils version, but it looks like it isn't widely seen.

Quoted 4 lines
Quoted 1 line

c6x is supposed to be supported by gcc now. No idea if that helps anything, though.

Thanks. I have tried to build a 4.8.1 cx6 toolchain but It hasn't worked todate. I'll keep trying as time permits.

Too bad. Thanks for trying!

Guenter