Skip to content

Instantly share code, notes, and snippets.

@cyphunk
Created May 27, 2012 23:55
Show Gist options
  • Save cyphunk/2816445 to your computer and use it in GitHub Desktop.
Save cyphunk/2816445 to your computer and use it in GitHub Desktop.
superh sh4 crosscompile
Setting up a SH4 SuperH cross compilation environment with a couple pecularities. Mainly I want to cross compile for a much older system/target.
Workstation: Ubuntu 11.10
Target: sh4 gcc-3.3.6 glibc-2.2.5 kernel-2.4.20
ISSUE 1: *** These critical programs are missing or too old: gcc
To fix edit patches/glibc-2.2.5/glibc-2.2.5-allow-gcc-4.0-configure.patch to support he host gcc version.
ISSUE 2: "In function ‘open’, inlined from ‘collect_execute’ at"
More details:
In file included from /usr/include/fcntl.h:252:0,
from /home/ubuntu/sh4/crossdir2/crosstool-0.43/build/sh4-unknown-linux-gnu/gcc-3.3.6-glibc-2.2.5/gcc-3.3.6/gcc/system.h:208,
from /home/ubuntu/sh4/crossdir2/crosstool-0.43/build/sh4-unknown-linux-gnu/gcc-3.3.6-glibc-2.2.5/gcc-3.3.6/gcc/collect2.c:30:
In function ‘open’,
inlined from ‘collect_execute’ at /home/ubuntu/sh4/crossdir2/crosstool-0.43/build/sh4-unknown-linux-gnu/gcc-3.3.6-glibc-2.2.5/gcc-3.3.6/gcc/collect2.c:1575:20:
/usr/include/i386-linux-gnu/bits/fcntl2.h:51:24: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[1]: *** [collect2.o] Error 1
make[1]: Leaving directory `/home/ubuntu/sh4/crossdir2/crosstool-0.43/build/sh4-unknown-linux-gnu/gcc-3.3.6-glibc-2.2.5/build-gcc-core/gcc'
make: *** [all-gcc] Error 2
FIX:
$ cat > patches/gcc-3.3.6/gcc-3.3.6-O_CREATE_ERR.patch
--- gcc-3.3.6.orig/gcc/collect2.c 2012-05-28 07:30:30.447513330 +0200
+++ gcc-3.3.6/gcc/collect2.c 2012-05-28 07:31:14.759512676 +0200
@@ -1572,7 +1572,7 @@
if (redir)
{
/* Open response file. */
- redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);
+ redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, 0644);
/* Duplicate the stdout and stderr file handles
so they can be restored later. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment