From: Alan Modra Date: Sat, 3 Jan 2004 11:09:07 +0000 (+0000) Subject: * ldfile.c (ldfile_set_output_arch): Add defarch param. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e2f15758b3831ad6fa9f8eee34dbefb689a8d68;p=binutils-gdb.git * ldfile.c (ldfile_set_output_arch): Add defarch param. * ldfile.h (ldfile_set_output_arch): Ditto. * emultempl/aix.em (gld${EMULATION_NAME}_before_parse): Use ldfile_set_output_arch. * emultempl/beos.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/mipsecoff.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/pe.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/sunos.em (gld${EMULATION_NAME}_before_parse): Ditto. * ldgram.y: Adjust ldfile_set_output_arch call. * emultempl/armcoff.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/armelf_oabi.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/generic.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/gld960c.em (gld960_set_output_arch): Ditto. * emultempl/m68kcoff.em (gld${EMULATION_NAME}_before_parse): Ditto. * emultempl/ticoff.em (gld${EMULATION_NAME}_before_parse): Ditto. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 45877d63970..549abb2a836 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,24 @@ +2004-01-03 Alan Modra + + * ldfile.c (ldfile_set_output_arch): Add defarch param. + * ldfile.h (ldfile_set_output_arch): Ditto. + * emultempl/aix.em (gld${EMULATION_NAME}_before_parse): Use + ldfile_set_output_arch. + * emultempl/beos.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/mipsecoff.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/pe.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/sunos.em (gld${EMULATION_NAME}_before_parse): Ditto. + * ldgram.y: Adjust ldfile_set_output_arch call. + * emultempl/armcoff.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/armelf_oabi.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/generic.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/gld960c.em (gld960_set_output_arch): Ditto. + * emultempl/m68kcoff.em (gld${EMULATION_NAME}_before_parse): Ditto. + * emultempl/ticoff.em (gld${EMULATION_NAME}_before_parse): Ditto. + 2004-01-02 Bernardo Innocenti * configure.tgt: Add m68k-uClinux target. diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index 842911e2c48..513cd50d859 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -9,7 +9,7 @@ cat >e${EMULATION_NAME}.c < AIX support by Ian Lance Taylor @@ -133,15 +133,7 @@ static char *command_line_blibpath = NULL; static void gld${EMULATION_NAME}_before_parse (void) { - const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); - if (arch) - { - ldfile_output_architecture = arch->arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); config.has_shared = TRUE; diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em index 2368b909a87..468c3b08beb 100644 --- a/ld/emultempl/armcoff.em +++ b/ld/emultempl/armcoff.em @@ -4,8 +4,8 @@ cat >e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); output_filename = "a.exe"; } diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index c386be8ce2f..9f68a8a2116 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -13,7 +13,7 @@ cat >e${EMULATION_NAME}.c < ELF support by Ian Lance Taylor @@ -81,15 +81,7 @@ cat >>e${EMULATION_NAME}.c <arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); config.dynamic_link = ${DYNAMIC_LINK-TRUE}; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; } diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em index c33d86b098c..4d17ca261ab 100644 --- a/ld/emultempl/generic.em +++ b/ld/emultempl/generic.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < Linux support by Eric Youngdale @@ -47,15 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static void gld${EMULATION_NAME}_before_parse (void) { - const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); - if (arch) - { - ldfile_output_architecture = arch->arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); config.dynamic_link = TRUE; config.has_shared = TRUE; } diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em index eefa32746b7..162dcf7ed7a 100644 --- a/ld/emultempl/m68kcoff.em +++ b/ld/emultempl/m68kcoff.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <, based on generic.em by Steve Chamberlain , embedded relocs code based on mipsecoff.em by Ian Lance Taylor . @@ -43,7 +43,7 @@ static void gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ - ldfile_set_output_arch ("`echo ${ARCH}`"); + ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown); #endif /* not TARGET_ */ } diff --git a/ld/emultempl/mipsecoff.em b/ld/emultempl/mipsecoff.em index c0e8093ef7e..dde33c24be5 100644 --- a/ld/emultempl/mipsecoff.em +++ b/ld/emultempl/mipsecoff.em @@ -9,7 +9,7 @@ cat >e${EMULATION_NAME}.c < based on generic.em. @@ -50,15 +50,7 @@ static void gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ - const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); - if (arch) - { - ldfile_output_architecture = arch->arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); #endif /* not TARGET_ */ } diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 38120b101bd..ccf7a8e9f4f 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -9,7 +9,7 @@ rm -f e${EMULATION_NAME}.c (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-) cat >>e${EMULATION_NAME}.c <arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); output_filename = "${EXECUTABLE_NAME:-a.exe}"; #ifdef DLL_SUPPORT config.dynamic_link = TRUE; diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em index 80ce2de643b..358bc9aabb9 100644 --- a/ld/emultempl/sunos.em +++ b/ld/emultempl/sunos.em @@ -9,8 +9,8 @@ cat >e${EMULATION_NAME}.c < SunOS shared library support by Ian Lance Taylor @@ -83,15 +83,7 @@ static void gld${EMULATION_NAME}_set_need static void gld${EMULATION_NAME}_before_parse (void) { - const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); - if (arch) - { - ldfile_output_architecture = arch->arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); config.dynamic_link = TRUE; config.has_shared = TRUE; } diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em index 29b1afb1863..8f86b04f0c7 100644 --- a/ld/emultempl/ticoff.em +++ b/ld/emultempl/ticoff.em @@ -3,7 +3,7 @@ (echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-) cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <mach; ldfile_output_machine_name = arch->printable_name; } + else if (defarch != bfd_arch_unknown) + ldfile_output_architecture = defarch; else - { - einfo (_("%P%F: cannot represent machine `%s'\n"), string); - } + einfo (_("%P%F: cannot represent machine `%s'\n"), string); } diff --git a/ld/ldfile.h b/ld/ldfile.h index 8b2e6e99c59..6d5f09d1183 100644 --- a/ld/ldfile.h +++ b/ld/ldfile.h @@ -1,5 +1,5 @@ /* ldfile.h - - Copyright 1991, 1992, 1993, 1994, 1995, 2000, 2002, 2003 + Copyright 1991, 1992, 1993, 1994, 1995, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -57,7 +57,7 @@ extern bfd_boolean ldfile_try_open_bfd extern FILE *ldfile_find_command_file (const char *name, const char *extend); extern void ldfile_set_output_arch - (const char *); + (const char *, enum bfd_architecture); extern bfd_boolean ldfile_open_file_search (const char *arch, struct lang_input_statement_struct *, const char *lib, const char *suffix); diff --git a/ld/ldgram.y b/ld/ldgram.y index c00b7af617b..17717fbbbb3 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -328,7 +328,7 @@ ifile_p1: | OUTPUT_FORMAT '(' NAME ',' NAME ',' NAME ')' { lang_add_output_format ($3, $5, $7, 1); } | OUTPUT_ARCH '(' NAME ')' - { ldfile_set_output_arch($3); } + { ldfile_set_output_arch ($3, bfd_arch_unknown); } | FORCE_COMMON_ALLOCATION { command_line.force_common_definition = TRUE ; } | INHIBIT_COMMON_ALLOCATION