From b74fa2cd15f80f123495fad4f2f3edc092e90138 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 13 Mar 2002 07:30:45 +0000 Subject: [PATCH] * archures.c (bfd_default_compatible): Test bits_per_word. * cpu-i386.c (i386_compatible): Remove. Replace occurrences with bfd_default_compatible. * cpu-i370.c (i370_compatible): Likewise. * cpu-sparc.c (sparc_compatible): Likewise. * cpu-h8300.c (compatible): Test in->arch == out->arch. --- bfd/ChangeLog | 7 +++++++ bfd/archures.c | 3 +++ bfd/cpu-h8300.c | 2 +- bfd/cpu-i370.c | 27 +++------------------------ bfd/cpu-i386.c | 26 +++++--------------------- bfd/cpu-sparc.c | 39 ++++++++++++--------------------------- 6 files changed, 31 insertions(+), 73 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 463adc01a8..4392665377 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,12 @@ 2002-03-13 Alan Modra + * archures.c (bfd_default_compatible): Test bits_per_word. + * cpu-i386.c (i386_compatible): Remove. Replace occurrences with + bfd_default_compatible. + * cpu-i370.c (i370_compatible): Likewise. + * cpu-sparc.c (sparc_compatible): Likewise. + * cpu-h8300.c (compatible): Test in->arch == out->arch. + * elflink.h: Formatting fixes. (elf_link_output_extsym): Merge undefined and undef weak cases. diff --git a/bfd/archures.c b/bfd/archures.c index fb2ba9b79e..9a91424a6e 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -722,6 +722,9 @@ bfd_default_compatible (a, b) if (a->arch != b->arch) return NULL; + if (a->bits_per_word != b->bits_per_word) + return NULL; + if (a->mach > b->mach) return a; diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index 929ebd15c0..ba50fd0d16 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -91,7 +91,7 @@ compatible (in, out) const bfd_arch_info_type *out; { /* It's really not a good idea to mix and match modes. */ - if (in->mach != out->mach) + if (in->arch != out->arch || in->mach != out->mach) return 0; else return in; diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c index c6c599a1b7..3f60ae6d95 100644 --- a/bfd/cpu-i370.c +++ b/bfd/cpu-i370.c @@ -24,27 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -/* The common i360/370 architecture comes in many forms */ - -static const bfd_arch_info_type *i370_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -static const bfd_arch_info_type * -i370_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - BFD_ASSERT (a->arch == bfd_arch_i370); - switch (b->arch) - { - default: - return NULL; - case bfd_arch_i370: - return bfd_default_compatible (a, b); - } - /*NOTREACHED*/ -} - static const bfd_arch_info_type arch_info_struct[] = { /* hack alert: old old machines are really 16 and 24 bit arch ... */ @@ -58,7 +37,7 @@ static const bfd_arch_info_type arch_info_struct[] = "i370:360", 3, false, /* not the default */ - i370_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[1] }, @@ -72,7 +51,7 @@ static const bfd_arch_info_type arch_info_struct[] = "i370:370", 3, false, /* not the default */ - i370_compatible, + bfd_default_compatible, bfd_default_scan, 0 }, @@ -89,7 +68,7 @@ const bfd_arch_info_type bfd_i370_arch = "i370:common", 3, true, /* the default */ - i370_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[0] }; diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c index 25b7e249bd..5110e959ef 100644 --- a/bfd/cpu-i386.c +++ b/bfd/cpu-i386.c @@ -22,22 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -/* Don't mix 32 bit and 64 bit files. */ - -static const bfd_arch_info_type *i386_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -static const bfd_arch_info_type * -i386_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->bits_per_word != b->bits_per_word) - return NULL; - - return bfd_default_compatible (a, b); -} - const bfd_arch_info_type bfd_i386_arch_intel_syntax = { 32, /* 32 bits in a word */ @@ -49,7 +33,7 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax = "i386:intel", 3, true, - i386_compatible, + bfd_default_compatible, bfd_default_scan , 0, }; @@ -64,7 +48,7 @@ const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = "x86-64:intel", 3, true, - i386_compatible, + bfd_default_compatible, bfd_default_scan , &bfd_i386_arch_intel_syntax, }; @@ -79,7 +63,7 @@ static const bfd_arch_info_type i8086_arch = "i8086", 3, false, - i386_compatible, + bfd_default_compatible, bfd_default_scan , &bfd_x86_64_arch_intel_syntax, }; @@ -95,7 +79,7 @@ const bfd_arch_info_type bfd_x86_64_arch = "x86-64", 3, true, - i386_compatible, + bfd_default_compatible, bfd_default_scan , &i8086_arch, }; @@ -111,7 +95,7 @@ const bfd_arch_info_type bfd_i386_arch = "i386", 3, true, - i386_compatible, + bfd_default_compatible, bfd_default_scan , &bfd_x86_64_arch }; diff --git a/bfd/cpu-sparc.c b/bfd/cpu-sparc.c index dbc83bad53..e3b8ecbbe2 100644 --- a/bfd/cpu-sparc.c +++ b/bfd/cpu-sparc.c @@ -1,5 +1,6 @@ /* BFD support for the SPARC architecture. - Copyright 1992, 1995, 1996, 1998, 2000 Free Software Foundation, Inc. + Copyright 1992, 1995, 1996, 1998, 2000, 2002 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,22 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" -/* Don't mix 32 bit and 64 bit files. */ - -static const bfd_arch_info_type *sparc_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -static const bfd_arch_info_type * -sparc_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->bits_per_word != b->bits_per_word) - return NULL; - - return bfd_default_compatible (a, b); -} - static const bfd_arch_info_type arch_info_struct[] = { { @@ -49,7 +34,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:sparclet", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[1], }, @@ -63,7 +48,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:sparclite", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[2], }, @@ -77,7 +62,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:v8plus", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[3], }, @@ -91,7 +76,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:v8plusa", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[4], }, @@ -105,7 +90,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:sparclite_le", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[5], }, @@ -119,7 +104,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:v9", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[6], }, @@ -133,7 +118,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:v9a", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[7], }, @@ -147,7 +132,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:v8plusb", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[8], }, @@ -161,7 +146,7 @@ static const bfd_arch_info_type arch_info_struct[] = "sparc:v9b", 3, false, - sparc_compatible, + bfd_default_compatible, bfd_default_scan, 0, } @@ -178,7 +163,7 @@ const bfd_arch_info_type bfd_sparc_arch = "sparc", 3, true, /* the default */ - sparc_compatible, + bfd_default_compatible, bfd_default_scan, &arch_info_struct[0], };