]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/54461 ([avr] add configure option for better AVR-Libc integration)
authorGeorg-Johann Lay <avr@gjlay.de>
Wed, 5 Sep 2012 08:47:50 +0000 (08:47 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Wed, 5 Sep 2012 08:47:50 +0000 (08:47 +0000)
PR target/54461
* configure.ac (noconfigdirs,target=avr-*-*): Add target-newlib,
target-libgloss if not configured --with-avrlibc=no.
* configure: Regenerate.

libgcc/
PR target/54461
* config.host (tmake_file,host=avr-*-*): Add avr/t-avrlibc if
not configured --with-avrlibc=no.
* config/avr/t-avrlibc: New file.
* Makefile.in (FPBIT_FUNCS): filter-out LIB2FUNCS_EXCLUDE.
(DPBIT_FUNCS): Ditto.
(TPBIT_FUNCS): Ditto.

gcc/
PR target/54461
* config.gcc (tm_file,target=avr-*-*): Add avr/avrlibc.h if
not configured --with-avrlibc=no.
(tm_defines,target=avr-*-*): Add WITH_AVRLIBC if not configured
--with-avrlibc=no.
* config/avr/avrlibc.h: New file.
* config/avr/avr-c.c: Build-in define __WITH_AVRLIBC__ if
not configured --with-avrlibc=no.
* doc/invoke.texi (AVR Built-in Macros): Document __WITH_AVRLIBC__

From-SVN: r190967

12 files changed:
ChangeLog
configure
configure.ac
gcc/ChangeLog
gcc/config.gcc
gcc/config/avr/avr-c.c
gcc/config/avr/avrlibc.h [new file with mode: 0644]
gcc/doc/invoke.texi
libgcc/ChangeLog
libgcc/Makefile.in
libgcc/config.host
libgcc/config/avr/t-avrlibc [new file with mode: 0644]

index 86c63a2166893ed6075367015146319e81f4b003..db2206c44309c1e4b673e0e4ecc0520fff140829 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-05  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/54461
+       * configure.ac (noconfigdirs,target=avr-*-*): Add target-newlib,
+       target-libgloss if not configured --with-avrlibc=no.
+       * configure: Regenerate.
+
 2012-09-04  Jason Merrill  <jason@redhat.com>
 
        * configure.ac: Fix --enable-languages=all.
index cd06e4ef0d65daa9cd63d5c3ca30bc001c6accd7..8272ed05b28d95ed7325d7978ff243dc88667b3a 100755 (executable)
--- a/configure
+++ b/configure
@@ -3499,6 +3499,13 @@ case "${target}" in
   arm-*-riscix*)
     noconfigdirs="$noconfigdirs ld target-libgloss"
     ;;
+  avr-*-rtems*)
+    ;;
+  avr-*-*)
+    if test x${with_avrlibc} != xno; then
+      noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    fi
+    ;;
   c4x-*-* | tic4x-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
index 9bee624ec1c8ffd238207b79e3850d42d160d70d..36830d1de2fd368d9b2e352ed77376ae7b4c6950 100644 (file)
@@ -891,6 +891,13 @@ case "${target}" in
   arm-*-riscix*)
     noconfigdirs="$noconfigdirs ld target-libgloss"
     ;;
+  avr-*-rtems*)
+    ;;
+  avr-*-*)
+    if test x${with_avrlibc} != xno; then
+      noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    fi
+    ;;
   c4x-*-* | tic4x-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
index 38991a1351c980a55384375c3f7103f67a4c11c0..9866362b50b4da8cd161f1f5c4addf360747f181 100644 (file)
@@ -1,3 +1,15 @@
+2012-09-05  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/54461
+       * config.gcc (tm_file,target=avr-*-*): Add avr/avrlibc.h if
+       not configured --with-avrlibc=no.
+       (tm_defines,target=avr-*-*): Add WITH_AVRLIBC if not configured
+       --with-avrlibc=no.
+       * config/avr/avrlibc.h: New file.
+       * config/avr/avr-c.c: Build-in define __WITH_AVRLIBC__ if
+       not configured --with-avrlibc=no.
+       * doc/invoke.texi (AVR Built-in Macros): Document __WITH_AVRLIBC__
+
 2012-09-04  Teresa Johnson  <tejohnson@google.com>
 
        * gcov-io.c (gcov_write_summary): Write out non-zero histogram
index 514f672a97aed06b0d8e6493e1b8253a8086ff9b..6d9c68d81ffd83166fccdb980f7820820e51e6e2 100644 (file)
@@ -892,6 +892,10 @@ avr-*-rtems*)
        ;;
 avr-*-*)
        tm_file="elfos.h avr/elf.h avr/avr.h dbxelf.h avr/avr-stdint.h"
+       if test x${with_avrlibc} != xno; then
+           tm_file="${tm_file} ${cpu_type}/avrlibc.h"
+           tm_defines="${tm_defines} WITH_AVRLIBC"
+       fi
        tmake_file="avr/t-avr avr/t-multilib"
        use_gcc_stdint=wrap
        extra_gcc_objs="driver-avr.o avr-devices.o"
index d689fa0238057819a428c867fab4515bc12e4726..6eb0ebaed5a107ad78e322977ab4346b5ce77d1b 100644 (file)
@@ -148,6 +148,10 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
   cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x",
                         avr_current_arch->sfr_offset);
     
+#ifdef WITH_AVRLIBC
+  cpp_define (pfile, "__WITH_AVRLIBC__");
+#endif /* WITH_AVRLIBC */
+      
   /* Define builtin macros so that the user can easily query if or if not
      non-generic address spaces (and which) are supported.
      This is only supported for C.  For C++, a language extension is needed
diff --git a/gcc/config/avr/avrlibc.h b/gcc/config/avr/avrlibc.h
new file mode 100644 (file)
index 0000000..b1c1a80
--- /dev/null
@@ -0,0 +1,31 @@
+/* Definitions of target machine for the GNU compiler collection
+   for Atmel AVR micro controller if configured for AVR-Libc.
+   Copyright (C) 2012
+   Free Software Foundation, Inc.
+   Contributed by Georg-Johann Lay (avr@gjlay.de)
+
+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 3, 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 COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* AVR-Libc implements functions from libgcc.a in libm.a, see PR54461.  */
+
+#undef  LIBGCC_SPEC
+#define LIBGCC_SPEC                                                     \
+  "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc -lm }}}}}"
+
+#undef  LINK_GCC_C_SEQUENCE_SPEC
+#define LINK_GCC_C_SEQUENCE_SPEC \
+  "--start-group %G %L --end-group"
index 6cf7cec0bd6eff30e09f3e7a57484e1e60f992b3..6794313ab777d0551020b4f4bac7c8d68936ed0d 100644 (file)
@@ -11496,6 +11496,10 @@ or @code{STS}. This offset depends on the device architecture and has
 to be subtracted from the RAM address in order to get the
 respective I/O@tie{}address.
 
+@item __WITH_AVRLIBC__
+The compiler is configured to be used together with AVR-Libc.
+See the @code{--with-avrlibc} configure option.
+
 @end table
 
 @node Blackfin Options
index ed5b2af2e22a38280acdd85b36f0569373bd70d8..7ffb58c3d245cdffc9e031820d4b8ccbfb13a7ff 100644 (file)
@@ -1,3 +1,13 @@
+2012-09-05  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/54461
+       * config.host (tmake_file,host=avr-*-*): Add avr/t-avrlibc if
+       not configured --with-avrlibc=no.
+       * config/avr/t-avrlibc: New file.
+       * Makefile.in (FPBIT_FUNCS): filter-out LIB2FUNCS_EXCLUDE.
+       (DPBIT_FUNCS): Ditto.
+       (TPBIT_FUNCS): Ditto.
+
 2012-09-04  Teresa Johnson  <tejohnson@google.com>
 
        * libgcov.c (struct gcov_summary_buffer): New structure.
index 1de1b8e5a48b2645e033c1b7e37dbda841746b4a..43b14a01f93ccc93e380cc64ccf53083a59fc5dc 100644 (file)
@@ -516,6 +516,10 @@ FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
 endif
 
+FPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS))
+DPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS))
+TPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS))
+
 fpbit-src := $(srcdir)/fp-bit.c
 
 # Build FPBIT.
index f9bab01c094b33a2af6643f827f805e3fe3fa64e..486b7152551d0d93f0fd02af46b89542e15b5933 100644 (file)
@@ -380,6 +380,9 @@ avr-*-rtems*)
 avr-*-*)
        # Make HImode functions for AVR
        tmake_file="${cpu_type}/t-avr t-fpbit"
+       if test x${with_avrlibc} != xno; then
+           tmake_file="$tmake_file ${cpu_type}/t-avrlibc"
+       fi
        tm_file="$tm_file avr/avr-lib.h"
        ;;
 bfin*-elf*)
diff --git a/libgcc/config/avr/t-avrlibc b/libgcc/config/avr/t-avrlibc
new file mode 100644 (file)
index 0000000..d2c8b87
--- /dev/null
@@ -0,0 +1,66 @@
+# This file is used if not configured --with-avrlibc=no
+#
+# AVR-Libc comes with hand-optimized float routines.
+# For historical reasons, these routines live in AVR-Libc
+# and not in libgcc and use the same function names like libgcc.
+# To get the best support, i.e. always use the routines from
+# AVR-Libc, we remove these routines from libgcc.
+#
+# See also PR54461.
+#
+#
+# Arithmetic:
+#     __addsf3 __subsf3 __divsf3 __mulsf3 __negsf2
+#
+# Comparison:
+#     __cmpsf2 __unordsf2
+#     __eqsf2 __lesf2 __ltsf2 __nesf2 __gesf2 __gtsf2
+#
+# Conversion:
+#     __fixsfdi __fixunssfdi __floatdisf __floatundisf
+#     __fixsfsi __fixunssfsi __floatsisf __floatunsisf
+#
+#
+# These functions are contained in modules:
+#
+# _addsub_sf.o:   __addsf3  __subsf3
+# _mul_sf.o:      __mulsf3
+# _div_sf.o:      __divsf3
+# _negate_sf.o:   __negsf2
+#
+# _compare_sf.o:  __cmpsf2
+# _unord_sf.o:    __unordsf2
+# _eq_sf.o:       __eqsf2
+# _ne_sf.o:       __nesf2
+# _ge_sf.o:       __gesf2
+# _gt_sf.o:       __gtsf2
+# _le_sf.o:       __lesf2
+# _lt_sf.o:       __ltsf2
+#
+# _fixsfdi.o:     __fixsfdi
+# _fixunssfdi.o:  __fixunssfdi
+# _fixunssfsi.o:  __fixunssfsi
+# _floatdisf.o:   __floatdisf
+# _floatundisf.o: __floatundisf
+# _sf_to_si.o:    __fixsfsi
+# _si_to_sf.o:    __floatsisf
+# _usi_to_sf.o:   __floatunsisf
+
+
+# SFmode
+LIB2FUNCS_EXCLUDE += \
+       _addsub_sf \
+       _negate_sf \
+       _mul_sf _div_sf \
+       \
+       _compare_sf \
+       _unord_sf \
+       _eq_sf _ne_sf \
+       _gt_sf _ge_sf \
+       _lt_sf _le_sf \
+       \
+       _si_to_sf  _sf_to_si \
+       _usi_to_sf _sf_to_usi \
+       _fixunssfsi _fixsfdi \
+       _fixunssfdi \
+       _floatdisf _floatundisf