public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32
@ 2006-07-07 19:00 Matthew R. Dempsky
  2006-07-09  9:34 ` Matthew R. Dempsky
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew R. Dempsky @ 2006-07-07 19:00 UTC (permalink / raw)
  To: binutils

(I'm not subscribed, so I would appreciate CC's, but I'll watch the
archives anyways just in case.)

When trying to link two or more cpu32 object files with ld from binutils
2.17, I get a warning that the m68k:cpu32 architecture of any input
files beyond the first is incompatible with m68k:cpu32 output, which
seems very nonsensical.

Should I be concerned with these warnings?  ld from binutils 2.15 and
2.16.1 do not give this warning.  I found a somewhat similar report in
the archive from about a week and a half ago[1], but this seems to 
differ enough to be a different problem.  (Also, no one appears to have 
replied to it yet.)

To reproduce, configure binutils 2.17 with --target=m68k-elf, install,
and proceed as follows:

$ m68k-elf-as -mcpu32 -o start.o << EOF
.globl _start
_start:
jbsr foo
jbra _start
EOF
$ m68k-elf-as -mcpu32 -o foo.o << EOF
.globl foo
foo:
rts
EOF
$ m68k-elf-ld start.o foo.o
m68k-elf-ld: warning: m68k:cpu32 architecture of input file `foo.o' is
incompatible with m68k:cpu32 output

Thanks.

[1] http://sources.redhat.com/ml/binutils/2006-06/msg00402.html

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

* Re: binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32
  2006-07-07 19:00 binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32 Matthew R. Dempsky
@ 2006-07-09  9:34 ` Matthew R. Dempsky
  2006-07-10 15:36   ` Richard Sandiford
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew R. Dempsky @ 2006-07-09  9:34 UTC (permalink / raw)
  To: binutils

On Fri, Jul 07, 2006 at 01:59:52PM -0500, Matthew R. Dempsky wrote:
> When trying to link two or more cpu32 object files with ld from binutils
> 2.17, I get a warning that the m68k:cpu32 architecture of any input
> files beyond the first is incompatible with m68k:cpu32 output, which
> seems very nonsensical.

Below are two alternative patches that fix this problem for me.  (Be 
warned, however, I have not done any testing beyond the test case in my 
previous mail.)

Thanks.

--- binutils-2.17/bfd/cpu-m68k.c.orig   Sun Jul  9 03:43:28 2006
+++ binutils-2.17/bfd/cpu-m68k.c        Sun Jul  9 03:56:43 2006
@@ -202,6 +202,11 @@ bfd_m68k_compatible (const bfd_arch_info
   if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
     /* Merge m68k machine. */
     return a->mach > b->mach ? a : b;
+  else if (a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_cpu32)
+    /* CPU32 is compatible with itself. */
+    return a;
   else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
           && b->mach >= bfd_mach_mcf_isa_a_nodiv)
     {

--- binutils-2.17/bfd/archures.c.orig   Sun Jul  9 03:54:33 2006
+++ binutils-2.17/bfd/archures.c        Sun Jul  9 03:55:53 2006
@@ -690,6 +690,10 @@ bfd_arch_get_compatible (const bfd *abfd
       return NULL;
     }
 
+  /* An architecture is compatible with itself. */
+  if (abfd->arch_info == bbfd->arch_info)
+    return abfd->arch_info;
+
   /* Otherwise architecture-specific code has to decide.  */
   return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
 }

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

* Re: binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32
  2006-07-09  9:34 ` Matthew R. Dempsky
@ 2006-07-10 15:36   ` Richard Sandiford
  2006-07-10 15:52     ` Daniel Jacobowitz
  2006-07-11 14:08     ` Nick Clifton
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Sandiford @ 2006-07-10 15:36 UTC (permalink / raw)
  To: mrd; +Cc: binutils

"Matthew R. Dempsky" <mrd@alkemio.org> writes:
> On Fri, Jul 07, 2006 at 01:59:52PM -0500, Matthew R. Dempsky wrote:
>> When trying to link two or more cpu32 object files with ld from binutils
>> 2.17, I get a warning that the m68k:cpu32 architecture of any input
>> files beyond the first is incompatible with m68k:cpu32 output, which
>> seems very nonsensical.
>
> Below are two alternative patches that fix this problem for me.  (Be 
> warned, however, I have not done any testing beyond the test case in my 
> previous mail.)

You beat me to it!  I'd been planning on looking at your report today.

> --- binutils-2.17/bfd/cpu-m68k.c.orig   Sun Jul  9 03:43:28 2006
> +++ binutils-2.17/bfd/cpu-m68k.c        Sun Jul  9 03:56:43 2006
> @@ -202,6 +202,11 @@ bfd_m68k_compatible (const bfd_arch_info
>    if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
>      /* Merge m68k machine. */
>      return a->mach > b->mach ? a : b;
> +  else if (a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_cpu32)
> +    /* CPU32 is compatible with itself. */
> +    return a;
>    else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
>            && b->mach >= bfd_mach_mcf_isa_a_nodiv)
>      {

This looks right to me.  I've added a changelog and testcase below.
OK to install?

Richard


bfd/
2006-07-10  Matthew R. Dempsky  <mrd@alkemio.org>

	* cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.

ld/testsuite/
2006-07-10  Richard Sandiford  <richard@codesourcery.com>

	* ld-m68k/merge-ok-1c.d: New test.
	* ld-m68k/m68k.exp: Run it.

Index: bfd/cpu-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-m68k.c,v
retrieving revision 1.13
diff -u -p -r1.13 cpu-m68k.c
--- bfd/cpu-m68k.c	25 Mar 2006 10:24:27 -0000	1.13
+++ bfd/cpu-m68k.c	10 Jul 2006 15:32:58 -0000
@@ -202,6 +202,9 @@ bfd_m68k_compatible (const bfd_arch_info
   if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
     /* Merge m68k machine. */
     return a->mach > b->mach ? a : b;
+  else if (a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_cpu32)
+    /* CPU32 is compatible with itself. */
+    return a;
   else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
 	   && b->mach >= bfd_mach_mcf_isa_a_nodiv)
     {
Index: ld/testsuite/ld-m68k/m68k.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-m68k/m68k.exp,v
retrieving revision 1.3
diff -u -p -r1.3 m68k.exp
--- ld/testsuite/ld-m68k/m68k.exp	14 Jun 2006 08:27:41 -0000	1.3
+++ ld/testsuite/ld-m68k/m68k.exp	10 Jul 2006 15:32:58 -0000
@@ -53,6 +53,7 @@ run_dump_test "merge-error-1d"
 run_dump_test "merge-error-1e"
 run_dump_test "merge-ok-1a"
 run_dump_test "merge-ok-1b"
+run_dump_test "merge-ok-1c"
 
 foreach { id sources } { a { plt1.s } b { plt1-empty.s plt1.s } } {
     foreach arch { 68020 cpu32 isab } {
Index: ld/testsuite/ld-m68k/merge-ok-1c.d
===================================================================
RCS file: ld/testsuite/ld-m68k/merge-ok-1c.d
diff -N ld/testsuite/ld-m68k/merge-ok-1c.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-m68k/merge-ok-1c.d	10 Jul 2006 15:32:58 -0000
@@ -0,0 +1,6 @@
+#source: merge-error-1a.s -march=cpu32
+#source: merge-error-1b.s -march=cpu32
+#ld: -r
+#objdump: -p
+#...
+private flags = 810000: \[cpu32\]

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

* Re: binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32
  2006-07-10 15:36   ` Richard Sandiford
@ 2006-07-10 15:52     ` Daniel Jacobowitz
  2006-07-11 14:08     ` Nick Clifton
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2006-07-10 15:52 UTC (permalink / raw)
  To: mrd, binutils, richard

On Mon, Jul 10, 2006 at 04:36:29PM +0100, Richard Sandiford wrote:
> This looks right to me.  I've added a changelog and testcase below.
> OK to install?

If this is approved, please commit it to the 2.17 branch also.  TIA!

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32
  2006-07-10 15:36   ` Richard Sandiford
  2006-07-10 15:52     ` Daniel Jacobowitz
@ 2006-07-11 14:08     ` Nick Clifton
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2006-07-11 14:08 UTC (permalink / raw)
  To: mrd, richard; +Cc: binutils

Hi Richard, Hi Matthew,

> bfd/
> 2006-07-10  Matthew R. Dempsky  <mrd@alkemio.org>
> 
> 	* cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.
> 
> ld/testsuite/
> 2006-07-10  Richard Sandiford  <richard@codesourcery.com>
> 
> 	* ld-m68k/merge-ok-1c.d: New test.
> 	* ld-m68k/m68k.exp: Run it.

Approved - please apply (to mainline and the 2.17 branch).

Cheers
   Nick

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

end of thread, other threads:[~2006-07-11 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07 19:00 binutils 2.17 warns m68k:cpu32 is incompatible with m68k:cpu32 Matthew R. Dempsky
2006-07-09  9:34 ` Matthew R. Dempsky
2006-07-10 15:36   ` Richard Sandiford
2006-07-10 15:52     ` Daniel Jacobowitz
2006-07-11 14:08     ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).