This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Add support for arm-none-linux-gnueabi (Take 2)


Hi,

Attached is a revised patch to add support for arm-none-linux-gnueabi.

The previous version is at

  http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01221.html

In this iteration, I have ported all changes relevant to
arm-none-linux-gnueabi from the csl-arm branch.  In fact,
config/arm/{linux-eabi.h,t-linux-eabi} provided in this patch are
identical to those on csl-arm branch.

One note about the top-level configure change.  Since ARM uses its own
unwinding routines, libjava and libobjc don't build.  For now, I've
put them in nonconfigdirs.

The hunk from boehm-gc/include/private/gc_locks.h is to prevent an
invalid instruction

 swp r0, r4, [r0]

At least the assembler didn't like this.

Admittedly, this patch has gottten rather big and possibly intrusive.
Richard, it's your call whether this is acceptable for stage 3.

Built "Hello, world" in both C and C++ using a patched version of
glibc-2.3.4 and confirmed that it runs on real hardware.  OK to apply?

Kazu Hirata

/
2005-09-15  Kazu Hirata  <kazu@codesourcery.com>

	* configure.in (arm-*-linux-gnueabi): Add to noconfigdirs
	target-libffi, target-qthreads, target-libjava, and
	targetlibobjc.
	* configure: Regenerate.

gcc/
2005-09-15  Kazu Hirata  <kazu@codesourcery.com>

	Merge from csl-arm-20050325-branch:
	2005-09-07  Paul Brook  <paul@codesourcery.com>
	* config/arm/linux-eabi.h (SUBTARGET_EXTRA_LINK_SPEC): Prepend a
	space to string.

	2005-04-30  Paul Brook  <paul@codesourcery.com>
	* config/arm/bpabi.h (TARGET_DEFAULT): Define.
	* config/arm/linux-eabi.h (SUBTARGET_CPU_DEFAULT): Define.

	2005-03-07  Daniel Jacobowitz  <dan@codesourcery.com>
	* config/arm/arm.c (arm_all_abis): Add aapcs-linux.
	(arm_override_options): Use TARGET_AAPCS_BASED.
	* config/arm/arm.h (enum arm_abi_type): Add ARM_ABI_AAPCS_LINUX.
	(PTRDIFF_TYPE): Use int for AAPCS.
	(DEFAULT_SHORT_ENUMS): Use false for aapcs-linux.
	* config/arm/linux-eabi.h (ARM_DEFAULT_ABI, WCHAR_TYPE): Define.
	(DEFAULT_SHORT_ENUMS): Delete.
	* doc/invoke.texi (ARM Options): Document -mabi=aapcs-linux.

	2004-12-15  Daniel Jacobowitz  <dan@codesourcery.com>
	* config/arm/arm.h (DEFAULT_SHORT_ENUMS): Wrap in #ifndef.
	* config/arm/linux-eabi.h (DEFAULT_SHORT_ENUMS): Define to 0.
	* config/arm/t-linux-eabi (TARGET_LIBGCC2_CFLAGS): Set to -fPIC.

	2004-12-03  Mark Mitchell  <mark@codesourcery.com>
	* config/arm/linux-eabi.h (LIBGCC_SPEC): Do not define.

	2004-11-22  Mark Mitchell  <mark@codesourcery.com>
	* config.gcc (arm*-*-linux-gnueabi): Use __cxa_atexit.
 
	2004-11-19  Mark Mitchell  <mark@codesourcery.com>
	* config.gcc (arm*-*-linux-gnueabi): Add it.
	* config/arm/bpabi.h (FPUTYPE_DEFAULT): Undefine it before
	redefining it.
	(TARGET_OS_CPP_BUILTINS): Likeiwse.
	* config/arm/linux-eabi.h: New file.
	* config/arm/linux-elf.h (LINUX_TARGET_INTERPRETER): New macro.
	(LINUX_TARET_LINK_SPEC): Likewise.
	(LINK_SPEC): Use it.
	* config/arm/t-linux-eabi: New file.

boehm-gc/
2005-09-10  Kazu Hirata  <kazu@codesourcery.com>

	* include/private/gc_locks.h (GC_test_and_set): Change the
	constraint of the first operand to '0'.

libcpp/
2005-09-10  Kazu Hirata  <kazu@codesourcery.com>

	* configure.ac: Require 64-bit int for arm*-*-*eabi*.
	* configure: Regenerate.

libstdc++/
2005-09-10  Kazu Hirata  <kazu@codesourcery.com>

	Merge from csl-arm-20050325-branch:
	2004-12-15  Daniel Jacobowitz  <dan@codesourcery.com>
	* libstdc++-v3/config/linker-map.gnu: Add ARM EABI symbols.

Index: configure.in
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/configure.in,v
retrieving revision 1.364
diff -u -d -p -r1.364 configure.in
--- configure.in	1 Sep 2005 17:42:55 -0000	1.364
+++ configure.in	15 Sep 2005 16:46:14 -0000
@@ -475,6 +475,10 @@ case "${target}" in
   arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
     noconfigdirs="$noconfigdirs target-libffi target-qthreads"
     ;;
+  arm-*-linux-gnueabi)
+    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+    noconfigdirs="$noconfigdirs target-libjava target-libobjc"
+    ;;
   arm*-*-symbianelf*)
     noconfigdirs="$noconfigdirs ${libgcj} target-libiberty"
     ;;
Index: boehm-gc/include/private/gc_locks.h
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/boehm-gc/include/private/gc_locks.h,v
retrieving revision 1.10
diff -u -d -p -r1.10 gc_locks.h
--- boehm-gc/include/private/gc_locks.h	19 Apr 2005 16:01:38 -0000	1.10
+++ boehm-gc/include/private/gc_locks.h	15 Sep 2005 20:50:20 -0000
@@ -209,7 +209,7 @@
           /* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
           __asm__ __volatile__("swp %0, %1, [%2]"
       		  	     : "=r"(oldval)
-      			     : "r"(1), "r"(addr)
+      			     : "0"(1), "r"(addr)
 			     : "memory");
           return oldval;
         }
Index: gcc/config.gcc
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.565
diff -u -d -p -r1.565 config.gcc
--- gcc/config.gcc	1 Sep 2005 17:44:37 -0000	1.565
+++ gcc/config.gcc	13 Sep 2005 05:14:24 -0000
@@ -671,10 +671,26 @@ arm*-*-netbsd*)
 	use_collect2=yes
 	;;
 arm*-*-linux*)			# ARM GNU/Linux with ELF
-	tm_file="dbxelf.h elfos.h linux.h arm/elf.h  arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
-	tmake_file="${tmake_file} arm/t-arm arm/t-linux"
+	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" 
+	tmake_file="${tmake_file} t-linux arm/t-arm"
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
 	gnu_ld=yes
+	case ${target} in
+	arm*-*-linux-gnueabi)
+	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
+	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
+  	    # The BPABI long long divmod functions return a 128-bit value in 
+	    # registers r0-r3.  Correctly modeling that requires the use of
+	    # TImode.
+	    need_64bit_hwint=yes
+	    # The EABI requires the use of __cxa_atexit.
+	    default_use_cxa_atexit=yes
+	    ;;
+	*)
+	    tmake_file="$tmake_file arm/t-linux"
+	    ;;
+	esac
+	tm_file="$tm_file arm/aout.h arm/arm.h"
 	;;
 arm*-*-uclinux*)		# ARM ucLinux
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h arm/uclinux-elf.h"
Index: gcc/config/arm/arm.c
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.479
diff -u -d -p -r1.479 arm.c
--- gcc/config/arm/arm.c	10 Sep 2005 08:28:28 -0000	1.479
+++ gcc/config/arm/arm.c	13 Sep 2005 05:14:24 -0000
@@ -673,7 +673,8 @@ static const struct abi_name arm_all_abi
   {"apcs-gnu",    ARM_ABI_APCS},
   {"atpcs",   ARM_ABI_ATPCS},
   {"aapcs",   ARM_ABI_AAPCS},
-  {"iwmmxt",  ARM_ABI_IWMMXT}
+  {"iwmmxt",  ARM_ABI_IWMMXT},
+  {"aapcs-linux",   ARM_ABI_AAPCS_LINUX}
 };
 
 /* Return the number of bits set in VALUE.  */
@@ -1194,7 +1195,7 @@ arm_override_options (void)
     flag_schedule_insns = flag_schedule_insns_after_reload = 0;
 
   /* Override the default structure alignment for AAPCS ABI.  */
-  if (arm_abi == ARM_ABI_AAPCS)
+  if (TARGET_AAPCS_BASED)
     arm_structure_size_boundary = 8;
 
   if (structure_size_string != NULL)
@@ -14527,7 +14528,7 @@ arm_promote_prototypes (tree t ATTRIBUTE
 static bool
 arm_default_short_enums (void)
 {
-  return TARGET_AAPCS_BASED;
+  return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX;
 }
 
 
Index: gcc/config/arm/arm.h
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/config/arm/arm.h,v
retrieving revision 1.289
diff -u -d -p -r1.289 arm.h
--- gcc/config/arm/arm.h	20 Aug 2005 10:31:41 -0000	1.289
+++ gcc/config/arm/arm.h	13 Sep 2005 05:14:24 -0000
@@ -279,7 +279,8 @@ enum arm_abi_type
   ARM_ABI_APCS,
   ARM_ABI_ATPCS,
   ARM_ABI_AAPCS,
-  ARM_ABI_IWMMXT
+  ARM_ABI_IWMMXT,
+  ARM_ABI_AAPCS_LINUX
 };
 
 extern enum arm_abi_type arm_abi;
@@ -501,6 +502,10 @@ extern int arm_structure_size_boundary;
 #define SIZE_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long unsigned int")
 #endif
 
+#ifndef PTRDIFF_TYPE
+#define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int")
+#endif
+
 /* AAPCS requires that structure alignment is affected by bitfields.  */
 #ifndef PCC_BITFIELD_TYPE_MATTERS
 #define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED
Index: gcc/config/arm/bpabi.h
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/config/arm/bpabi.h,v
retrieving revision 1.13
diff -u -d -p -r1.13 bpabi.h
--- gcc/config/arm/bpabi.h	28 Jun 2005 19:51:30 -0000	1.13
+++ gcc/config/arm/bpabi.h	13 Sep 2005 05:14:24 -0000
@@ -30,8 +30,13 @@
 #define TARGET_UNWIND_INFO 1
 
 /* Section 4.1 of the AAPCS requires the use of VFP format.  */
+#undef FPUTYPE_DEFAULT
 #define FPUTYPE_DEFAULT FPUTYPE_VFP
 
+/* EABI targets should enable interworking by default.  */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT MASK_INTERWORK
+
 /* The ARM BPABI functions return a boolean; they use no special
    calling convention.  */
 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) TARGET_BPABI
@@ -101,6 +106,7 @@
     }							\
   while (false)
 
+#undef TARGET_OS_CPP_BUILTINS
 #define TARGET_OS_CPP_BUILTINS() \
   TARGET_BPABI_CPP_BUILTINS()
 
Index: gcc/config/arm/linux-elf.h
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/config/arm/linux-elf.h,v
retrieving revision 1.55
diff -u -d -p -r1.55 linux-elf.h
--- gcc/config/arm/linux-elf.h	5 Aug 2005 03:20:10 -0000	1.55
+++ gcc/config/arm/linux-elf.h	13 Sep 2005 05:14:24 -0000
@@ -81,18 +81,22 @@
 #define ENDFILE_SPEC \
   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
 
-#undef  LINK_SPEC
-#define LINK_SPEC "%{h*} %{version:-v} \
+#define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2"
+
+#define LINUX_TARGET_LINK_SPEC  "%{h*} %{version:-v} \
    %{b} \
    %{static:-Bstatic} \
    %{shared:-shared} \
    %{symbolic:-Bsymbolic} \
    %{rdynamic:-export-dynamic} \
-   %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
+   %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
    -X \
    %{mbig-endian:-EB}" \
    SUBTARGET_EXTRA_LINK_SPEC
 
+#undef  LINK_SPEC
+#define LINK_SPEC LINUX_TARGET_LINK_SPEC
+
 #define TARGET_OS_CPP_BUILTINS()		\
   do						\
     {						\
Index: gcc/doc/invoke.texi
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.676
diff -u -d -p -r1.676 invoke.texi
--- gcc/doc/invoke.texi	6 Sep 2005 10:59:50 -0000	1.676
+++ gcc/doc/invoke.texi	13 Sep 2005 05:14:24 -0000
@@ -7137,7 +7137,7 @@ architectures:
 @item -mabi=@var{name}
 @opindex mabi
 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
-@samp{atpcs}, @samp{aapcs} and @samp{iwmmxt}.
+@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
 
 @item -mapcs-frame
 @opindex mapcs-frame
Index: libcpp/configure
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/libcpp/configure,v
retrieving revision 1.19
diff -u -d -p -r1.19 configure
--- libcpp/configure	24 Jul 2005 03:44:26 -0000	1.19
+++ libcpp/configure	13 Sep 2005 05:14:24 -0000
@@ -8218,7 +8218,7 @@ fi
 
 case $target in
 	alpha*-*-* | \
-	arm*-*-eabi* | \
+	arm*-*-*eabi* | \
 	arm*-*-symbianelf* | \
 	x86_64-*-* | \
 	ia64-*-* | \
Index: libcpp/configure.ac
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/libcpp/configure.ac,v
retrieving revision 1.16
diff -u -d -p -r1.16 configure.ac
--- libcpp/configure.ac	24 Jul 2005 03:44:26 -0000	1.16
+++ libcpp/configure.ac	13 Sep 2005 05:14:24 -0000
@@ -113,7 +113,7 @@ fi
 m4_changequote(,)
 case $target in
 	alpha*-*-* | \
-	arm*-*-eabi* | \
+	arm*-*-*eabi* | \
 	arm*-*-symbianelf* | \
 	x86_64-*-* | \
 	ia64-*-* | \
Index: libstdc++-v3/config/linker-map.gnu
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/libstdc++-v3/config/linker-map.gnu,v
retrieving revision 1.84
diff -u -d -p -r1.84 linker-map.gnu
--- libstdc++-v3/config/linker-map.gnu	26 Aug 2005 21:10:58 -0000	1.84
+++ libstdc++-v3/config/linker-map.gnu	13 Sep 2005 05:14:24 -0000
@@ -581,10 +581,12 @@ CXXABI_1.3 {
     __cxa_bad_cast;
     __cxa_bad_typeid;
     __cxa_begin_catch;
+    __cxa_begin_cleanup;
     __cxa_call_unexpected;
     __cxa_current_exception_type;
     __cxa_demangle;
     __cxa_end_catch;
+    __cxa_end_cleanup;
     __cxa_free_exception;
     __cxa_get_globals;
     __cxa_get_globals_fast;
@@ -594,6 +596,7 @@ CXXABI_1.3 {
     __cxa_pure_virtual;
     __cxa_rethrow;
     __cxa_throw;
+    __cxa_type_match;
     __cxa_vec_cctor;
     __cxa_vec_cleanup;
     __cxa_vec_ctor;
--- /dev/null	2005-09-01 09:08:28.063949816 -0700
+++ gcc/config/arm/linux-eabi.h	2005-09-12 22:14:24.723729289 -0700
@@ -0,0 +1,70 @@
+/* Configuration file for ARM GNU/Linux EABI targets.
+   Copyright (C) 2004
+   Free Software Foundation, Inc.
+   Contributed by CodeSourcery, LLC   
+
+   This file is part of GCC.
+
+   GCC 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, or (at your
+   option) any later version.
+
+   GCC 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 GCC; see the file COPYING.  If not, write to
+   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* On EABI GNU/Linux, we want both the BPABI builtins and the
+   GNU/Linux builtins.  */
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() 		\
+  do 						\
+    {						\
+      TARGET_BPABI_CPP_BUILTINS();		\
+      LINUX_TARGET_OS_CPP_BUILTINS();		\
+    }						\
+  while (false)
+
+/* We default to a soft-float ABI so that binaries can run on all
+   target hardware.  */
+#undef TARGET_DEFAULT_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+
+/* We default to the "aapcs-linux" ABI so that enums are int-sized by
+   default.  */
+#undef ARM_DEFAULT_ABI
+#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
+
+/* Default to armv5t so that thumb shared libraries work.
+   The ARM10TDMI core is the default for armv5t, so set
+   SUBTARGET_CPU_DEFAULT to achieve this.  */
+#undef SUBTARGET_CPU_DEFAULT
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
+
+#undef SUBTARGET_EXTRA_LINK_SPEC
+#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
+
+/* Use ld-linux.so.3 so that it will be possible to run "classic"
+   GNU/Linux binaries on an EABI system.  */
+#undef LINUX_TARGET_INTERPRETER
+#define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3"
+
+/* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+   use the GNU/Linux version, not the generic BPABI version.  */
+#undef LINK_SPEC
+#define LINK_SPEC LINUX_TARGET_LINK_SPEC
+
+/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
+   do not use -lfloat.  */
+#undef LIBGCC_SPEC
+
+/* Use the AAPCS type for wchar_t, or the previous Linux default for
+   non-AAPCS.  */
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long int")
--- /dev/null	2005-09-01 09:08:28.063949816 -0700
+++ gcc/config/arm/t-linux-eabi	2005-09-12 22:14:24.723729289 -0700
@@ -0,0 +1,7 @@
+# These functions are included in shared libraries.
+TARGET_LIBGCC2_CFLAGS = -fPIC
+
+# We do not build a Thumb multilib for Linux because the definition of
+# CLEAR_INSN_CACHE in linux-gas.h does not work in Thumb mode.
+MULTILIB_OPTIONS	=
+MULTILIB_DIRNAMES	=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]