aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2012-09-05 08:47:50 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2012-09-05 08:47:50 +0000
commitb588ae3074e258f5c736034c212e7499a565746f (patch)
tree9f336c5bfcd0b1ffef11bb616b7591f8823a8ed2 /gcc
parent4efbb06f6737868e79b3791af3462fb58da91013 (diff)
downloadgcc-b588ae3074e258f5c736034c212e7499a565746f.zip
gcc-b588ae3074e258f5c736034c212e7499a565746f.tar.gz
gcc-b588ae3074e258f5c736034c212e7499a565746f.tar.bz2
re PR target/54461 ([avr] add configure option for better AVR-Libc integration)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config.gcc4
-rw-r--r--gcc/config/avr/avr-c.c4
-rw-r--r--gcc/config/avr/avrlibc.h31
-rw-r--r--gcc/doc/invoke.texi4
5 files changed, 55 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 38991a1..9866362 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 514f672..6d9c68d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -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"
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index d689fa0..6eb0eba 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -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
index 0000000..b1c1a80
--- /dev/null
+++ b/gcc/config/avr/avrlibc.h
@@ -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"
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6cf7cec..6794313 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -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