Skip to contentSkip to conversation

sh64 build error - sh, kbuild or binutils problem?

DISCUSSION Applied Yoshinori Sato 2 participants 4 messages Jul 3, 2008 – Jul 4, 2008 SuperH

lore
Share & tools
lore

Yoshinori Sato

author maintainer
#0 lore raw

At Sun, 1 Jun 2008 14:30:47 +0900,

Quoted 10 lines · Paul Mundt
Quoted 8 lines · Adrian Bunk

Minimal example demonstrating the problem:

$ sh64-linux-ar rcs tmp.o
$ sh64-linux-ld -EL -r -o tmp2.o tmp.o
$ sh64-linux-ld -EL -r -o out.o tmp2.o 
sh64-linux-ld: sh3 architecture of input file `tmp2.o' is incompatible with sh5 output
$ 
Quoted 3 lines

Yes, it's a binutils bug. I've hit this on SH-2A zImage builds too, and hacked together a patch for it. I'll see about fixing it up fo sh64 too and then posting it to the list.

I think ld is strict machine type check.

This is workaround.
SH-2A build success.

sh/boot/compressed/Makefile_32 renamed from arch/sh/boot/compressed/Makefile_32 +2 -3
diff -uN ../org/arch/sh/boot/compressed/Makefile_32 arch/sh/boot/compressed/Makefile_32
@@ -35,8 +35,7 @@
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
 	$(call if_changed,gzip)
 
-LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh-linux -T
 OBJCOPYFLAGS += -R .empty_zero_page
 
-$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
-	$(call if_changed,ld)
+$(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE
+	$(call if_changed,as_o_S)
sh/boot/compressed/piggy.S renamed from org/arch/sh/boot/compressed/piggy.S +8 -0
diff -uN ../org/arch/sh/boot/compressed/piggy.S arch/sh/boot/compressed/piggy.S
@@ -0,0 +1,8 @@
+	.global	input_len, input_data
+	.data
+input_len:
+	.long	input_data_end - input_data
+input_data:
+	.incbin	"arch/sh/boot/compressed/vmlinux.bin.gz"
+input_data_end:
+	.end
Quoted 5 lines

--
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/

Signature · 2 lines
Yoshinori Sato
<[email protected]>
#1 lore raw
Quoted 12 lines · Yoshinori Sato

At Sun, 1 Jun 2008 14:30:47 +0900,

Quoted 10 lines · Paul Mundt
Quoted 8 lines · Adrian Bunk

Minimal example demonstrating the problem:

$ sh64-linux-ar rcs tmp.o
$ sh64-linux-ld -EL -r -o tmp2.o tmp.o
$ sh64-linux-ld -EL -r -o out.o tmp2.o 
sh64-linux-ld: sh3 architecture of input file `tmp2.o' is incompatible with sh5 output
$ 
Quoted 9 lines
Quoted 3 lines

Yes, it's a binutils bug. I've hit this on SH-2A zImage builds too, and hacked together a patch for it. I'll see about fixing it up fo sh64 too and then posting it to the list.

I think ld is strict machine type check.

This is workaround.
SH-2A build success.

This is probably a reasonable workaround until fixed versions of binutils are more readily available. Please re-send this with a Signed-off-by and I'll add it to my queue.

author maintainer
#2 lore raw
In reply to Yoshinori Sato

At Thu, 3 Jul 2008 19:03:23 +0900,

Quoted 18 lines · Paul Mundt
Quoted 16 lines · Yoshinori Sato

At Sun, 1 Jun 2008 14:30:47 +0900,

Quoted 13 lines · Paul Mundt
Quoted 8 lines · Adrian Bunk

Minimal example demonstrating the problem:

$ sh64-linux-ar rcs tmp.o
$ sh64-linux-ld -EL -r -o tmp2.o tmp.o
$ sh64-linux-ld -EL -r -o out.o tmp2.o 
sh64-linux-ld: sh3 architecture of input file `tmp2.o' is incompatible with sh5 output
$ 

Yes, it's a binutils bug. I've hit this on SH-2A zImage builds too, and hacked together a patch for it. I'll see about fixing it up fo sh64 too and then posting it to the list.

Quoted 8 lines
Quoted 5 lines

I think ld is strict machine type check.

This is workaround.
SH-2A build success.

This is probably a reasonable workaround until fixed versions of binutils are more readily available. Please re-send this with a Signed-off-by and I'll add it to my queue.

arch/sh/boot/compressed/Makefile_32 +2 -3
index c0d25fb..47685f6 100644
@@ -35,8 +35,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
 	$(call if_changed,gzip)
 
-LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh-linux -T
 OBJCOPYFLAGS += -R .empty_zero_page
 
-$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
-	$(call if_changed,ld)
+$(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE
+	$(call if_changed,as_o_S)
arch/sh/boot/compressed/Makefile_64 +2 -3
index 912f3e2..658d4f9 100644
@@ -37,8 +37,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
 	$(call if_changed,gzip)
 
-LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T
 OBJCOPYFLAGS += -R .empty_zero_page
 
-$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
-	$(call if_changed,ld)
+$(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE
+	$(call if_changed,as_o_S)
arch/sh/boot/compressed/piggy.S new file +8 -0
new file mode 100644
index 0000000..5660719
@@ -0,0 +1,8 @@
+	.global	input_len, input_data
+	.data
+input_len:
+	.long	input_data_end - input_data
+input_data:
+	.incbin	"arch/sh/boot/compressed/vmlinux.bin.gz"
+input_data_end:
+	.end
arch/sh/boot/compressed/vmlinux.scr deleted +0 -9
deleted file mode 100644
index 1ed9d79..0000000
@@ -1,9 +0,0 @@
-SECTIONS
-{
-  .data : { 
-	input_len = .;
-	LONG(input_data_end - input_data) input_data = .; 
-	*(.data) 
-	input_data_end = .; 
-	}
-}
Signature · 2 lines
Yoshinori Sato
<[email protected]>
Applied
#3 lore raw
In reply to Yoshinori Sato
Quoted 22 lines · Yoshinori Sato

At Thu, 3 Jul 2008 19:03:23 +0900,

Quoted 20 lines · Paul Mundt
Quoted 18 lines · Yoshinori Sato

At Sun, 1 Jun 2008 14:30:47 +0900,

Quoted 10 lines · Paul Mundt
Quoted 8 lines · Adrian Bunk

Minimal example demonstrating the problem:

$ sh64-linux-ar rcs tmp.o
$ sh64-linux-ld -EL -r -o tmp2.o tmp.o
$ sh64-linux-ld -EL -r -o out.o tmp2.o 
sh64-linux-ld: sh3 architecture of input file `tmp2.o' is incompatible with sh5 output
$ 
Quoted 3 lines

Yes, it's a binutils bug. I've hit this on SH-2A zImage builds too, and hacked together a patch for it. I'll see about fixing it up fo sh64 too and then posting it to the list.

I think ld is strict machine type check.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

This is workaround.
SH-2A build success.

This is probably a reasonable workaround until fixed versions of binutils are more readily available. Please re-send this with a Signed-off-by and I'll add it to my queue.

Applied, thanks.