KOZOS (6)

(4) の続き。3.4.6 な gcc の make 時に出たエラーはソース修正が必要だった模様。再度 gcc-3.4.6 を展開して以下。

$ cd gcc-3.4.6
$ mkdir object
$ cd object
$ ../configure --target=h8300-elf --disable-nls --disable-threads \
--disable-shared --enable-languages=c
$ make

これで make 失敗するはず。

出た

ので

      /* Open response file.  */
	redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);

      /* Open response file.  */
		redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, 0755);

にして make を kickoff するも次は以下なナニが

../../gcc/libgcc2.c: In function `__muldi3':
../../gcc/libgcc2.c:537: error: unrecognizable insn:
(insn 244 243 245 0 ../../gcc/libgcc2.c:528 (set:HI (reg:HI 3 r3)
        (const_int 4294967222 [0xffffffb6])) -1 (nil)
    (nil))
../../gcc/libgcc2.c:537: internal compiler error: in extract_insn, at recog.c:2083
Please submit a full bug report,

これ、一旦 clean した方が良いのかな。なんとなく libgcc2.c って自動生成されたナニのように見える。

$ make clean; make

げ。同じエラーだorz
ググッたら KOZOS 友の会にて既出な問題らしい

ええとここから patch をナニして手で適用します。

Index: h8300.c
===================================================================
--- h8300.c	(revision 117513)
+++ h8300.c	(working copy)
@@ -83,8 +83,8 @@
 static int h8300_saveall_function_p (tree);
 static int h8300_monitor_function_p (tree);
 static int h8300_os_task_function_p (tree);
-static void h8300_emit_stack_adjustment (int, unsigned int);
-static int round_frame_size (int);
+static void h8300_emit_stack_adjustment (int, HOST_WIDE_INT);
+static HOST_WIDE_INT round_frame_size (HOST_WIDE_INT);
 static unsigned int compute_saved_regs (void);
 static void push (int);
 static void pop (int);
@@ -510,7 +510,7 @@
    SIZE to adjust the stack pointer.  */
 
 static void
-h8300_emit_stack_adjustment (int sign, unsigned int size)
+h8300_emit_stack_adjustment (int sign, HOST_WIDE_INT size)
 {
   /* If the frame size is 0, we don't have anything to do.  */
   if (size == 0)
@@ -546,8 +546,8 @@
 
 /* Round up frame size SIZE.  */
 
-static int
-round_frame_size (int size)
+static HOST_WIDE_INT
+round_frame_size (HOST_WIDE_INT size)
 {
   return ((size + STACK_BOUNDARY / BITS_PER_UNIT - 1)
 	  & -STACK_BOUNDARY / BITS_PER_UNIT);

gcc/config/h8300/h8300.c か。。
上記 diff については

  • h8300_emit_stack_adjustment 手続き
  • round_frame_size 手続き

の関数プロトタイプの変更にともなう手続き定義の修正のみ。これでようやくできたのか。sudo make install して /usr/local/bin の中を覗いてみた。

$ ls /usr/local/bin -lt
total 48332
-rwxr-xr-x 2 root root  246916 2011-04-12 21:09 h8300-elf-gcc
-rwxr-xr-x 2 root root  246916 2011-04-12 21:09 h8300-elf-gcc-3.4.6
-rwxr-xr-x 1 root root  253795 2011-04-12 21:09 h8300-elf-cpp
-rwxr-xr-x 1 root root   15717 2011-04-12 21:09 h8300-elf-gccbug
-rwxr-xr-x 1 root root   81897 2011-04-12 21:09 h8300-elf-gcov
-rwxr-xr-x 4 root root 4154548 2011-04-12 08:58 h8300-elf-ld
-rwxr-xr-x 4 root root 4154548 2011-04-12 08:58 h8300-elf-ld.bfd
-rwxr-xr-x 1 root root 3135134 2011-04-12 08:58 h8300-elf-gprof
-rwxr-xr-x 2 root root 5242032 2011-04-12 08:57 h8300-elf-as
-rwxr-xr-x 1 root root 2666685 2011-04-12 08:57 h8300-elf-c++filt
-rwxr-xr-x 2 root root 3391176 2011-04-12 08:57 h8300-elf-strip
-rwxr-xr-x 2 root root 2733998 2011-04-12 08:57 h8300-elf-nm
-rwxr-xr-x 1 root root   67103 2011-04-12 08:57 h8300-elf-elfedit
-rwxr-xr-x 1 root root  780719 2011-04-12 08:57 h8300-elf-readelf
-rwxr-xr-x 1 root root 2689689 2011-04-12 08:57 h8300-elf-addr2line
-rwxr-xr-x 2 root root 3391177 2011-04-12 08:57 h8300-elf-objcopy
-rwxr-xr-x 2 root root 2845150 2011-04-12 08:57 h8300-elf-ranlib
-rwxr-xr-x 1 root root 2695362 2011-04-12 08:57 h8300-elf-strings
-rwxr-xr-x 2 root root 2845151 2011-04-12 08:57 h8300-elf-ar
-rwxr-xr-x 2 root root 5095410 2011-04-12 08:57 h8300-elf-objdump
-rwxr-xr-x 1 root root 2720658 2011-04-12 08:57 h8300-elf-size
$

お願いします、と神さんに祈るばかりだな。
とりあえず今日はブツが届いてないのでこれで終了。