This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: AM33/2.0 support added to mn10300-elf
On Jul 10, 2003, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Jul 9, 2003, Alexandre Oliva <aoliva@redhat.com> wrote:
>> This patch introduces AM33/2.0 support in the mn10300-elf toolchain.
>> AM33/2.0 introduces a single-precision floating point unit to the
>> original AM33.
> This patch adds PIC support to mn10300-elf, including linker
> relaxations, and the ability to create shared libraries. At some
> point, this was used to build an old port of glibc to AM33/2.0, and it
> even worked :-)
And here's the patch that adds the am33_2.0-unknown-linux-gnu port.
The one important difference between mn10300-elf and
am33_2.0-*-linux-gnu is that the latter doesn't prefix symbol names
with underscores. The patch for the toplevel will be posted
separately.
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
2001-09-12 Alexandre Oliva <aoliva@redhat.com>
* elf32-am33lin.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
(ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
2001-06-02 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-am33lin.c: Rename global functions.
2001-05-09 Alexandre Oliva <aoliva@redhat.com>
* config.bfd (am33_2.0, am33_2.0-*-linux*): Added.
* configure.in (bfd_elf32_am33lin_vec): Added.
* Makefile.am (BFD32_BACKENDS): Added elf32-am33lin.lo.
(elf32-am33lin.lo): List dependencies.
* aclocal.m4, configure, Makefile.in: Rebuilt.
* elf-m10300.c (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME,
ELF_ARCH, ELF_MACHINE_CODE, ELF_MAXPAGESIZE): Define only if
ELF_ARCH was not defined before.
(elf_symbol_leading_char): Define if not defined.
* elf32-am33lin.c: Override the definitions above.
* targets.c (bfd_elf32_am33lin_vec): New.
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/uberbaum/bfd/Makefile.am,v
retrieving revision 1.122
diff -u -p -r1.122 Makefile.am
--- bfd/Makefile.am 10 Jun 2003 23:44:39 -0000 1.122
+++ bfd/Makefile.am 10 Jul 2003 04:13:46 -0000
@@ -372,6 +372,7 @@ BFD32_BACKENDS_CFILES = \
ecofflink.c \
efi-app-ia32.c \
elf.c \
+ elf32-am33lin.lo \
elf32-arc.c \
elfarm-oabi.c \
elfarm-nabi.c \
@@ -1123,6 +1124,10 @@ efi-app-ia32.lo: efi-app-ia32.c $(INCDIR
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
+elf32-am33lin.lo: elf32-am33lin.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h elf-m10300.c
elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
Index: bfd/Makefile.in
===================================================================
RCS file: /cvs/uberbaum/bfd/Makefile.in,v
retrieving revision 1.133
diff -u -p -r1.133 Makefile.in
--- bfd/Makefile.in 4 Jul 2003 14:46:13 -0000 1.133
+++ bfd/Makefile.in 10 Jul 2003 04:13:50 -0000
@@ -500,6 +500,7 @@ BFD32_BACKENDS_CFILES = \
ecofflink.c \
efi-app-ia32.c \
elf.c \
+ elf32-am33lin.lo \
elf32-arc.c \
elfarm-oabi.c \
elfarm-nabi.c \
@@ -1656,6 +1657,10 @@ efi-app-ia32.lo: efi-app-ia32.c $(INCDIR
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
+elf32-am33lin.lo: elf32-am33lin.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h elf-m10300.c
elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
Index: bfd/config.bfd
===================================================================
RCS file: /cvs/uberbaum/bfd/config.bfd,v
retrieving revision 1.139
diff -u -p -r1.139 config.bfd
--- bfd/config.bfd 20 Jun 2003 08:36:19 -0000 1.139
+++ bfd/config.bfd 10 Jul 2003 04:13:51 -0000
@@ -60,6 +60,7 @@ x86_64) targ_archs=bfd_i386_arc
xscale*) targ_archs=bfd_arm_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
+am33_2.0) targ_archs=bfd_mn10300_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -134,6 +135,9 @@ case "${targ}" in
;;
#endif /* BFD64 */
+ am33_2.0-*-linux*)
+ targ_defvec=bfd_elf32_am33lin_vec
+ ;;
arc-*-elf*)
targ_defvec=bfd_elf32_littlearc_vec
targ_selvecs=bfd_elf32_bigarc_vec
@@ -830,6 +834,7 @@ case "${targ}" in
mn10300-*-*)
targ_defvec=bfd_elf32_mn10300_vec
+ targ_underscore=yes
;;
msp430-*-*)
Index: bfd/configure
===================================================================
RCS file: /cvs/uberbaum/bfd/configure,v
retrieving revision 1.153
diff -u -p -r1.153 configure
--- bfd/configure 11 Jun 2003 13:38:07 -0000 1.153
+++ bfd/configure 10 Jul 2003 04:13:57 -0000
@@ -6106,6 +6106,7 @@ do
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
+ bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
Index: bfd/configure.in
===================================================================
RCS file: /cvs/uberbaum/bfd/configure.in,v
retrieving revision 1.132
diff -u -p -r1.132 configure.in
--- bfd/configure.in 11 Jun 2003 13:38:07 -0000 1.132
+++ bfd/configure.in 10 Jul 2003 04:13:58 -0000
@@ -568,6 +568,7 @@ do
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
+ bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/uberbaum/bfd/elf-m10300.c,v
retrieving revision 1.36
diff -u -p -r1.36 elf-m10300.c
--- bfd/elf-m10300.c 10 Jul 2003 03:20:00 -0000 1.36
+++ bfd/elf-m10300.c 10 Jul 2003 04:14:00 -0000
@@ -4842,12 +4842,14 @@ _bfd_mn10300_elf_finish_dynamic_sections
return TRUE;
}
+#ifndef ELF_ARCH
#define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec
#define TARGET_LITTLE_NAME "elf32-mn10300"
#define ELF_ARCH bfd_arch_mn10300
#define ELF_MACHINE_CODE EM_MN10300
#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300
#define ELF_MAXPAGESIZE 0x1000
+#endif
#define elf_info_to_howto mn10300_info_to_howto
#define elf_info_to_howto_rel 0
@@ -4864,7 +4866,9 @@ _bfd_mn10300_elf_finish_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_free \
elf32_mn10300_link_hash_table_free
+#ifndef elf_symbol_leading_char
#define elf_symbol_leading_char '_'
+#endif
/* So we can set bits in e_flags. */
#define elf_backend_final_write_processing \
Index: bfd/elf32-am33lin.c
===================================================================
RCS file: bfd/elf32-am33lin.c
diff -N bfd/elf32-am33lin.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ bfd/elf32-am33lin.c 10 Jul 2003 04:14:00 -0000
@@ -0,0 +1,35 @@
+/* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF
+ Copyright 2001
+ Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define elf_symbol_leading_char 0
+
+#define TARGET_LITTLE_SYM bfd_elf32_am33lin_vec
+#define TARGET_LITTLE_NAME "elf32-am33lin"
+#define ELF_ARCH bfd_arch_mn10300
+#define ELF_MACHINE_CODE EM_MN10300
+#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300
+#define ELF_MAXPAGESIZE 0x1000
+
+/* Rename global functions. */
+#define _bfd_mn10300_elf_merge_private_bfd_data _bfd_am33_elf_merge_private_bfd_data
+#define _bfd_mn10300_elf_object_p _bfd_am33_elf_object_p
+#define _bfd_mn10300_elf_final_write_processing _bfd_am33_elf_final_write_processing
+
+#include "elf-m10300.c"
Index: bfd/targets.c
===================================================================
RCS file: /cvs/uberbaum/bfd/targets.c,v
retrieving revision 1.93
diff -u -p -r1.93 targets.c
--- bfd/targets.c 29 Jun 2003 10:06:39 -0000 1.93
+++ bfd/targets.c 10 Jul 2003 04:14:01 -0000
@@ -743,6 +743,7 @@ extern const bfd_target ptrace_core_vec;
extern const bfd_target sco5_core_vec;
extern const bfd_target trad_core_vec;
+extern const bfd_target bfd_elf32_am33lin_vec;
static const bfd_target * const _bfd_target_vector[] = {
#ifdef SELECT_VECS
@@ -1061,6 +1062,7 @@ static const bfd_target * const _bfd_tar
&w65_vec,
&we32kcoff_vec,
&z8kcoff_vec,
+ &bfd_elf32_am33lin_vec,
#endif /* not SELECT_VECS */
/* Always support S-records, for convenience. */
Index: gas/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
2002-12-12 Alexandre Oliva <aoliva@redhat.com>
* config/tc-mn10300.h (EXTERN_FORCE_RELOC): Don't define to zero.
2001-05-09 Alexandre Oliva <aoliva@redhat.com>
* configure.in (am33_2.0, mn10300-*-linux*): Added.
* configure: Rebuilt.
* config/tc-mn10300.h (TARGET_FORMAT) [TE_LINUX]: Define to
elf32-am33lin.
* config/tc-mn10300.c (md_begin) [TE_LINUX]: Choose AM33/2.0
by default.
Index: gas/configure.in
===================================================================
RCS file: /cvs/uberbaum/gas/configure.in,v
retrieving revision 1.135
diff -u -p -r1.135 configure.in
--- gas/configure.in 18 Jun 2003 09:49:58 -0000 1.135
+++ gas/configure.in 10 Jul 2003 04:14:10 -0000
@@ -114,6 +114,7 @@ changequote([,])dnl
arch=
endian=
case ${cpu} in
+ am33_2.0) cpu_type=mn10300 endian=little ;;
alpha*) cpu_type=alpha ;;
arm*b|xscale*b|strongarm*b) cpu_type=arm endian=big ;;
arm*|xscale*|strongarm*) cpu_type=arm endian=little ;;
@@ -185,6 +186,9 @@ changequote([,])dnl
alpha*-*-linux-gnu*) fmt=elf em=linux ;;
alpha*-*-netbsd*) fmt=elf em=nbsd ;;
alpha*-*-openbsd*) fmt=elf em=obsd ;;
+
+ # cpu_type for am33_2.0 is set to mn10300
+ mn10300-*-linux*) fmt=elf bfd_gas=yes em=linux ;;
arc-*-elf*) fmt=elf ;;
Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/uberbaum/gas/config/tc-mn10300.c,v
retrieving revision 1.44
diff -u -p -r1.44 tc-mn10300.c
--- gas/config/tc-mn10300.c 10 Jul 2003 03:20:14 -0000 1.44
+++ gas/config/tc-mn10300.c 10 Jul 2003 04:14:11 -0000
@@ -1213,10 +1213,17 @@ md_begin ()
}
/* Set the default machine type. */
+#ifdef TE_LINUX
+ if (!bfd_set_arch_mach (stdoutput, bfd_arch_mn10300, AM33_2))
+ as_warn (_("could not set architecture and machine"));
+
+ current_machine = AM33_2;
+#else
if (!bfd_set_arch_mach (stdoutput, bfd_arch_mn10300, MN103))
as_warn (_("could not set architecture and machine"));
current_machine = MN103;
+#endif
}
static symbolS *GOT_symbol;
Index: gas/config/tc-mn10300.h
===================================================================
RCS file: /cvs/uberbaum/gas/config/tc-mn10300.h,v
retrieving revision 1.13
diff -u -p -r1.13 tc-mn10300.h
--- gas/config/tc-mn10300.h 10 Jul 2003 03:20:14 -0000 1.13
+++ gas/config/tc-mn10300.h 10 Jul 2003 04:14:11 -0000
@@ -55,11 +55,12 @@ void mn10300_cons_fix_new PARAMS ((fragS
/* The target BFD architecture. */
#define TARGET_ARCH bfd_arch_mn10300
+#ifdef TE_LINUX
+#define TARGET_FORMAT "elf32-am33lin"
+#else
#define TARGET_FORMAT "elf32-mn10300"
+#endif
-/* No shared lib support, so we don't need to ensure externally
- visible symbols can be overridden. */
-#define EXTERN_FORCE_RELOC 0
/* Do not adjust relocations involving symbols in code sections,
because it breaks linker relaxations. This could be fixed in the
Index: ld/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
2001-08-22 Alexandre Oliva <aoliva@redhat.com>
* emulparams/elf32am33lin.sh: Adjust to match kernel parameters.
2001-05-09 Alexandre Oliva <aoliva@redhat.com>
* configure.host (am33_2.0-*-linux*): Added.
* configure.tgt (am33_2.0-*-linux*): Likewise.
* emulparams/elf32am33lin.sh: New.
* Makefile.am (eelf32am33lin.c): New rule.
* Makefile.in: Rebuilt.
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/uberbaum/ld/Makefile.am,v
retrieving revision 1.136
diff -u -p -r1.136 Makefile.am
--- ld/Makefile.am 28 Jun 2003 05:28:54 -0000 1.136
+++ ld/Makefile.am 10 Jul 2003 04:14:18 -0000
@@ -607,6 +607,9 @@ eelf32xstormy16.c: $(srcdir)/emulparams/
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32xstormy16 "$(tdir_xstormy16)"
+eelf32am33lin.c: $(srcdir)/emulparams/elf32am33lin.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32am33lin "$(tdir_mn10300)"
eelf32vax.c: $(srcdir)/emulparams/elf32vax.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32vax "$(tdir_elf32vax)"
Index: ld/Makefile.in
===================================================================
RCS file: /cvs/uberbaum/ld/Makefile.in,v
retrieving revision 1.147
diff -u -p -r1.147 Makefile.in
--- ld/Makefile.in 28 Jun 2003 05:28:54 -0000 1.147
+++ ld/Makefile.in 10 Jul 2003 04:14:19 -0000
@@ -1333,6 +1333,9 @@ eelf32xstormy16.c: $(srcdir)/emulparams/
$(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \
$(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32xstormy16 "$(tdir_xstormy16)"
+eelf32am33lin.c: $(srcdir)/emulparams/elf32am33lin.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32am33lin "$(tdir_mn10300)"
eelf32vax.c: $(srcdir)/emulparams/elf32vax.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32vax "$(tdir_elf32vax)"
Index: ld/configure.host
===================================================================
RCS file: /cvs/uberbaum/ld/configure.host,v
retrieving revision 1.30
diff -u -p -r1.30 configure.host
--- ld/configure.host 17 Jun 2003 11:01:17 -0000 1.30
+++ ld/configure.host 10 Jul 2003 04:14:19 -0000
@@ -80,6 +80,11 @@ case "${host}" in
# No further tweaking needed
;;
+am33_2.0-*-linux*)
+ HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
arm*-*-linux-gnu*)
HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux,g"`
;;
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/uberbaum/ld/configure.tgt,v
retrieving revision 1.133
diff -u -p -r1.133 configure.tgt
--- ld/configure.tgt 16 Jun 2003 00:03:48 -0000 1.133
+++ ld/configure.tgt 10 Jul 2003 04:14:20 -0000
@@ -16,6 +16,7 @@ targ_extra_emuls=
targ_extra_ofiles=
case "${targ}" in
+am33_2.0-*-linux*) targ_emul=elf32am33lin ;;
arm-epoc-pe) targ_emul=arm_epoc_pe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
arm-*-wince) targ_emul=armpe ;
Index: ld/emulparams/elf32am33lin.sh
===================================================================
RCS file: ld/emulparams/elf32am33lin.sh
diff -N ld/emulparams/elf32am33lin.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/emulparams/elf32am33lin.sh 10 Jul 2003 04:14:20 -0000
@@ -0,0 +1,11 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-am33lin"
+TEXT_START_ADDR=0x8000000
+MAXPAGESIZE=0x1000
+NONPAGED_TEXT_START_ADDR=0x8000000
+ARCH=mn10300
+MACHINE=
+NOP=0xcbcb
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer