diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2019-12-16 11:02:10 +0000 |
---|---|---|
committer | Jozef Lawrynowicz <jozefl@gcc.gnu.org> | 2019-12-16 11:02:10 +0000 |
commit | e8aa9f55f6486a9503d4f9e6b88b8f81d1daab15 (patch) | |
tree | 7d8a497de23ddd18c6c1a5a753ff27c1d0f9e89d /gcc | |
parent | 1edfb10a5aa9b8943ea9971dd8261b39327eeae2 (diff) | |
download | gcc-e8aa9f55f6486a9503d4f9e6b88b8f81d1daab15.zip gcc-e8aa9f55f6486a9503d4f9e6b88b8f81d1daab15.tar.gz gcc-e8aa9f55f6486a9503d4f9e6b88b8f81d1daab15.tar.bz2 |
MSP430: Add new msp430-elfbare target
contrib/ChangeLog:
2019-12-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config-list.mk: Add msp430-elfbare.
gcc/ChangeLog:
2019-12-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config.gcc: s/msp430*-*-*/msp430-*-*.
Handle msp430-*-elfbare.
* config/msp430/msp430-devices.c (TARGET_SUBDIR): Define.
(_MSPMKSTR): Define.
(__MSPMKSTR): Define.
(rest_of_devices_path): Use TARGET_SUBDIR value in string.
* config/msp430/msp430.c (msp430_option_override): Error if
-fuse-cxa-atexit is used when it has been disabled at configure time.
* config/msp430/t-msp430: Define TARGET_SUBDIR when building
msp430-devices.o.
* doc/install.texi: Document msp430-*-elf and msp430-*-elfbare.
* doc/invoke.texi: Update documentation about which path devices.csv is
searched for.
gcc/testsuite/ChangeLog:
2019-12-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* g++.dg/init/dso_handle1.C: Require cxa_atexit support.
* g++.dg/init/dso_handle2.C: Likewise.
* g++.dg/other/cxa-atexit1.C: Likewise.
* gcc.target/msp430/msp430.exp: Update csv-using-installed.c test to
handle msp430-elfbare configuration.
libgcc/ChangeLog:
2019-12-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config.host: s/msp430*-*-elf/msp430-*-elf*.
Override default "extra_parts" variable.
* configure: Regenerate.
* configure.ac: Disable TM clone registry by default for
msp430-elfbare.
From-SVN: r279442
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/config.gcc | 14 | ||||
-rw-r--r-- | gcc/config/msp430/msp430-devices.c | 17 | ||||
-rw-r--r-- | gcc/config/msp430/msp430.c | 10 | ||||
-rw-r--r-- | gcc/config/msp430/t-msp430 | 2 | ||||
-rw-r--r-- | gcc/doc/install.texi | 16 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/dso_handle1.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/dso_handle2.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/cxa-atexit1.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/msp430/msp430.exp | 8 |
12 files changed, 89 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acf14a5..08d769a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2019-12-16 Jozef Lawrynowicz <jozef.l@mittosystems.com> + + * config.gcc: s/msp430*-*-*/msp430-*-*. + Handle msp430-*-elfbare. + * config/msp430/msp430-devices.c (TARGET_SUBDIR): Define. + (_MSPMKSTR): Define. + (__MSPMKSTR): Define. + (rest_of_devices_path): Use TARGET_SUBDIR value in string. + * config/msp430/msp430.c (msp430_option_override): Error if + -fuse-cxa-atexit is used when it has been disabled at configure time. + * config/msp430/t-msp430: Define TARGET_SUBDIR when building + msp430-devices.o. + * doc/install.texi: Document msp430-*-elf and msp430-*-elfbare. + * doc/invoke.texi: Update documentation about which path devices.csv is + searched for. + 2019-12-16 Andreas Krebbel <krebbel@linux.ibm.com> PR target/92950 diff --git a/gcc/config.gcc b/gcc/config.gcc index 5aa0130..9802f43 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2624,7 +2624,7 @@ mn10300-*-*) use_collect2=no use_gcc_stdint=wrap ;; -msp430*-*-*) +msp430-*-*) tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" c_target_objs="msp430-c.o" cxx_target_objs="msp430-c.o" @@ -2637,6 +2637,18 @@ msp430*-*-*) if test x${disable_initfini_array} != xyes; then gcc_cv_initfini_array=yes fi + case ${target} in + msp430-*-elfbare) + # __cxa_atexit increases code size, and we don't need to support + # dynamic shared objects on MSP430, so regular Newlib atexit is a + # fine replacement as it also supports registration of more than 32 + # functions. + default_use_cxa_atexit=no + # This target does not match the generic *-*-elf case above which + # sets use_gcc_stdint=wrap, so explicitly set it here. + use_gcc_stdint=wrap + ;; + esac ;; nds32*-*-*) target_cpu_default="0" diff --git a/gcc/config/msp430/msp430-devices.c b/gcc/config/msp430/msp430-devices.c index 600a111..b379bb2 100644 --- a/gcc/config/msp430/msp430-devices.c +++ b/gcc/config/msp430/msp430-devices.c @@ -71,8 +71,23 @@ msp430_dirname (char *path) return path; } +/* We need to support both the msp430-elf and msp430-elfbare target aliases. + gcc/config/msp430/t-msp430 will define TARGET_SUBDIR to the target_subdir + Makefile variable, which will evaluate to the correct subdirectory that + needs to be searched for devices.csv. */ +#ifndef TARGET_SUBDIR +#define TARGET_SUBDIR msp430-elf +#endif + +#define _MSPMKSTR(x) __MSPMKSTR(x) +#define __MSPMKSTR(x) #x + /* devices.csv path from the toolchain root. */ -static const char rest_of_devices_path[] = "/msp430-elf/include/devices/"; +static const char rest_of_devices_path[] = + "/" _MSPMKSTR (TARGET_SUBDIR) "/include/devices/"; + +#undef _MSPMKSTR +#undef __MSPMKSTR /* "The default value of GCC_EXEC_PREFIX is prefix/lib/gcc". Strip lib/gcc from GCC_EXEC_PREFIX to get the path to the installed toolchain. */ diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 4ebdcf5..cce4101 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -288,6 +288,16 @@ msp430_option_override (void) if (TARGET_OPT_SPACE && optimize < 3) optimize_size = 1; +#if !DEFAULT_USE_CXA_ATEXIT + /* For some configurations, we use atexit () instead of __cxa_atexit () by + default to save on code size and remove the declaration of __dso_handle + from the CRT library. + Configuring GCC with --enable-__cxa-atexit re-enables it by defining + DEFAULT_USE_CXA_ATEXIT to 1. */ + if (flag_use_cxa_atexit) + error ("%<-fuse-cxa-atexit%> is not supported for msp430-elf"); +#endif + #ifndef HAVE_NEWLIB_NANO_FORMATTED_IO if (TARGET_TINY_PRINTF) error ("GCC must be configured with %<--enable-newlib-nano-formatted-io%> " diff --git a/gcc/config/msp430/t-msp430 b/gcc/config/msp430/t-msp430 index e180ce3..d481696 100644 --- a/gcc/config/msp430/t-msp430 +++ b/gcc/config/msp430/t-msp430 @@ -24,7 +24,7 @@ driver-msp430.o: $(srcdir)/config/msp430/driver-msp430.c \ msp430-devices.o: $(srcdir)/config/msp430/msp430-devices.c \ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -DTARGET_SUBDIR=$(target_subdir) $(INCLUDES) $< # Enable multilibs: diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 19d649c..656410a 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -4330,10 +4330,24 @@ The moxie processor. <hr /> @end html @anchor{msp430-x-elf} -@heading msp430-*-elf +@heading msp430-*-elf* TI MSP430 processor. This configuration is intended for embedded systems. +@samp{msp430-*-elf} is the standard configuration with most GCC +features enabled by default. + +@samp{msp430-*-elfbare} is tuned for a bare-metal environment, and disables +features related to shared libraries and other functionality not used for +this device. This reduces code and data usage of the GCC libraries, resulting +in a minimal run-time environment by default. + +Features disabled by default include: +@itemize +@item transactional memory +@item __cxa_atexit +@end itemize + @html <hr /> @end html diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 519bd7a..f04e915 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -23311,8 +23311,8 @@ this directory for devices.csv. If devices.csv is found, this directory will also be registered as an include path, and linker library path. Header files and linker scripts in this directory can therefore be used without manually specifying @code{-I} and @code{-L} on the command line. -@item The @samp{msp430-elf/include/devices} directory -Finally, GCC will examine @samp{msp430-elf/include/devices} from the +@item The @samp{msp430-elf@{,bare@}/include/devices} directory +Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the toolchain root directory. This directory does not exist in a default installation, but if the user has created it and copied @samp{devices.csv} there, then the MCU data will be read. As above, this directory will diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 247064b..7272aba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-12-16 Jozef Lawrynowicz <jozef.l@mittosystems.com> + + * g++.dg/init/dso_handle1.C: Require cxa_atexit support. + * g++.dg/init/dso_handle2.C: Likewise. + * g++.dg/other/cxa-atexit1.C: Likewise. + * gcc.target/msp430/msp430.exp: Update csv-using-installed.c test to + handle msp430-elfbare configuration. + 2019-12-16 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/specs/clause_on_volatile.ads, diff --git a/gcc/testsuite/g++.dg/init/dso_handle1.C b/gcc/testsuite/g++.dg/init/dso_handle1.C index 97f67ca..0377c4e 100644 --- a/gcc/testsuite/g++.dg/init/dso_handle1.C +++ b/gcc/testsuite/g++.dg/init/dso_handle1.C @@ -1,6 +1,7 @@ // PR c++/17042 // { dg-do assemble } /* { dg-require-weak "" } */ +// { dg-require-effective-target cxa_atexit } // { dg-options "-fuse-cxa-atexit" } struct A diff --git a/gcc/testsuite/g++.dg/init/dso_handle2.C b/gcc/testsuite/g++.dg/init/dso_handle2.C index b219dc0..a4daaf3 100644 --- a/gcc/testsuite/g++.dg/init/dso_handle2.C +++ b/gcc/testsuite/g++.dg/init/dso_handle2.C @@ -1,4 +1,5 @@ // PR c++/58846 +// { dg-require-effective-target cxa_atexit } // { dg-options "-fuse-cxa-atexit" } extern "C" { char* __dso_handle; } diff --git a/gcc/testsuite/g++.dg/other/cxa-atexit1.C b/gcc/testsuite/g++.dg/other/cxa-atexit1.C index a51f334..b22911d 100644 --- a/gcc/testsuite/g++.dg/other/cxa-atexit1.C +++ b/gcc/testsuite/g++.dg/other/cxa-atexit1.C @@ -1,4 +1,5 @@ // { dg-do compile } +// { dg-require-effective-target cxa_atexit } // { dg-options "-O2 -fuse-cxa-atexit" } # 1 "cxa-atexit1.C" diff --git a/gcc/testsuite/gcc.target/msp430/msp430.exp b/gcc/testsuite/gcc.target/msp430/msp430.exp index 3758661..42dc911 100644 --- a/gcc/testsuite/gcc.target/msp430/msp430.exp +++ b/gcc/testsuite/gcc.target/msp430/msp430.exp @@ -141,18 +141,20 @@ proc msp430_device_permutations_runtest { tests } { } -# Return $TOOLCHAIN_ROOT/msp430-elf/include/devices/ +# Return $TOOLCHAIN_ROOT/$target_alias/include/devices/ +# target_alias is expected to be either msp430-elf or msp430-elfbare. proc get_installed_device_data_path { } { + global target_alias set compiler [lindex [regexp -all -inline {\S+} \ [board_info [target_info name] compiler]] 0] # $compiler is actually a file, but normalize will still get us the desired # result. return [file normalize \ - "$compiler/../../msp430-elf/include/devices/devices.csv"] + "$compiler/../../$target_alias/include/devices/devices.csv"] } # If the devices.csv is installed in -# $TOOLCHAIN_ROOT/msp430-elf/include/devices/, rename it so it doesn't +# $TOOLCHAIN_ROOT/$target_alias/include/devices/, rename it so it doesn't # interfere with the hard-coded device data tests. proc msp430_hide_installed_devices_data { } { set devices_path [get_installed_device_data_path] |