[PATCH] add m68k-uclinux-* target (rev 2)

Bernardo Innocenti bernie@develer.com
Sat Dec 27 18:48:00 GMT 2003


Hello,

This second release of the patch includes an additional fix for
gas to prevent it from generating short relocs on m68k-*-uclinux
as it does for *-*-elf targets.

The way the extern_force_reloc macro works is kludgy.
Adding a new flag in configure.tgt for this purpose would be much
cleaner, but it will have to be done for all embedded targets and
I was worried it would make the patch a bit too intrusive.

Original patch discussion follows:

---------------------------------------------------------------------

these binutils/GDB patches add the required bits to enable
the m68k-*-uclinux-* target.

For years, the uClinux toolchain has been based on m68k-elf
with rogue patches.  In 3.4, uClinux support has been merged
into GDB and binutils and the target triplet changed to
m68k-unknown-uclinux-uclibc.

So far, the only toolchain component that needs to handle
uClinux differently from m68k-elf is GCC, so these bits
are not strictly required except for consistency.  These
additions are definitely required (but not sufficient)
to build the toolchain in a combined tree.

I have no CVS write access to the src repository, so
please commit these patches for me  (the diffs don't
include the regenerated configure scripts).


2003-12-27  Bernardo Innocenti  <bernie@develer.com>

	* config.bfd: Add uClinux target.

2003-12-27  Bernardo Innocenti  <bernie@develer.com>

	* configure.in: Add uClinux target.
	* configure: Regenerate.
	* config/tc-m68k.h (EXTERN_FORCE_RELOC): Add special handling for
	uClinux.
	* config/tc-m68k.c (relaxable_symbol): Use EXTERN_FORCE_RELOC instead
	of hard-coded test for TARGET_OS=elf.

2003-12-27  Bernardo Innocenti  <bernie@develer.com>

	* configure.tgt: Add uClinux target.

2003-12-27  Bernardo Innocenti  <bernie@develer.com>

	* configure.tgt: Add uClinux target.

diff -u -p -r1.150 binutils.orig/bfd/config.bfd binutils/bfd/config.bfd
--- binutils.orig/bfd/config.bfd	19 dec 2003 11:43:52 -0000	1.150
+++ binutils/bfd/config.bfd	21 dec 2003 02:56:31 -0000
@@ -651,7 +651,7 @@ case "${targ}" in
     targ_defvec=m68kcoff_vec
     targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
     ;;
-  m68*-*-elf* | m68*-*-sysv4*)
+  m68*-*-elf* | m68*-*-sysv4* | m68*-*-uclinux)
     targ_defvec=bfd_elf32_m68k_vec
     targ_selvecs="m68kcoff_vec ieee_vec"
     ;;
diff -u -p -r1.146 binutils.orig/gas/configure.in binutils/gas/configure.in
--- binutils.orig/gas/configure.in	19 dec 2003 11:43:42 -0000	1.146
+++ binutils/gas/configure.in	21 dec 2003 02:57:07 -0000
@@ -359,6 +359,7 @@ changequote([,])dnl
       m68k-*-hpux*)			fmt=hp300 em=hp300 ;;
       m68k-*-linux*aout*)		fmt=aout em=linux ;;
       m68k-*-linux-gnu*)		fmt=elf em=linux ;;
+      m68k-*-uclinux*)			fmt=elf ;;
       m68k-*-gnu*)			fmt=elf ;;
       m68k-*-lynxos*)			fmt=coff em=lynx ;;
       m68k-*-netbsdelf*)		fmt=elf em=nbsd ;;
diff -u -p -r1.161 binutils.orig/gas/configure binutils/gas/configure
--- binutils.orig/gas/configure	19 dec 2003 11:43:39 -0000	1.161
+++ binutils/gas/configure	22 dec 2003 06:27:36 -0000
@@ -4202,6 +4202,7 @@ echo "$as_me: warning: gas support for $
       m68k-*-hpux*)			fmt=hp300 em=hp300 ;;
       m68k-*-linux*aout*)		fmt=aout em=linux ;;
       m68k-*-linux-gnu*)		fmt=elf em=linux ;;
+      m68k-*-uclinux*)			fmt=elf ;;
       m68k-*-gnu*)			fmt=elf ;;
       m68k-*-lynxos*)			fmt=coff em=lynx ;;
       m68k-*-netbsdelf*)		fmt=elf em=nbsd ;;
diff -nru binutils.orig/gas/config/tc-m68k.c binutils/gas/config/tc-m68k.c
--- binutils.orig/gas/config/tc-m68k.c	2003-10-29 18:37:48.000000000 +0100
+++ binutils/gas/config/tc-m68k.c	2003-12-22 08:26:02.361994153 +0100
@@ -732,7 +732,7 @@
    libraries, and we can relax any external sym.  */
 
 #define relaxable_symbol(symbol) \
-  (!((s_is_external (symbol) && strcmp (target_os, "elf") != 0)		\
+  (!((s_is_external (symbol) && extern_force_reloc) \
      || s_is_weak (symbol)))
 
 /* compute the relocation code for a fixup of size bytes, using pc
diff -nru binutils.orig/gas/config/tc-m68k.h binutils/gas/config/tc-m68k.h
--- binutils.orig/gas/config/tc-m68k.h	2003-08-21 17:28:48.000000000 +0200
+++ binutils/gas/config/tc-m68k.h	2003-12-22 08:22:53.982617970 +0100
@@ -169,8 +169,11 @@
 #define tc_fix_adjustable(x) tc_m68k_fix_adjustable(x)
 extern int tc_m68k_fix_adjustable params ((struct fix *));
 
-/* target *-*-elf implies an embedded target.  no shared libs.  */
-#define extern_force_reloc (strcmp (target_os, "elf") != 0)
+/* target *-*-elf implies an embedded target.  no shared libs.
+   *-*-uclinux also requires special casing to prevent gas from
+   generating unsupported r_68k_pc16 relocs.  */
+#define extern_force_reloc \
+  ((strcmp (target_os, "elf") != 0) && (strcmp (target_os, "uclinux") != 0))
 
 /* values passed to md_apply_fix3 don't include symbol values.  */
 #define md_apply_sym_value(fix) 0
diff -u -p -r1.142 binutils.orig/ld/configure.tgt binutils/ld/configure.tgt
--- binutils.orig/ld/configure.tgt	19 dec 2003 11:43:59 -0000	1.142
+++ binutils/ld/configure.tgt	21 dec 2003 02:58:15 -0000
@@ -367,6 +367,7 @@ m68k-*-linux-gnu*)	targ_emul=m68kelf
 			targ_extra_emuls=m68klinux
 			tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
 			;;
+m68k-*-uclinux*)	targ_emul=m68kelf ;;
 m68*-*-gnu*)		targ_emul=m68kelf ;;
 m68*-*-lynxos*)		targ_emul=m68klynx ;;
 m68*-*-netbsd*4k*)	targ_emul=m68k4knbsd
diff -u -p -r1.122 binutils.orig/gdb/configure.tgt binutils/gdb/configure.tgt 
--- binutils.orig/gdb/configure.tgt	1 Dec 2003 21:10:46 -0000	1.122
+++ binutils/gdb/configure.tgt	21 Dec 2003 02:57:39 -0000
@@ -120,6 +120,7 @@ m68*-tandem-*)		gdb_target=st2000 ;;
 m68*-*-aout*)		gdb_target=monitor ;;
 m68*-*-coff*)		gdb_target=monitor ;;
 m68*-*-elf*)		gdb_target=monitor ;;
+m68*-*-uclinux*)	gdb_target=monitor ;;
 m68*-*-linux*)		gdb_target=linux
 			build_gdbserver=yes
 			;;

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/




More information about the Gdb-patches mailing list