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 4/4] MSP430: Deprecate -minrt option


Support for the MSP430 -minrt option has been removed from Newlib, since all the
associated behaviour is now dynamic. Initialization code run before main is only
included when needed.

This patch removes the final traces of -minrt from GCC.

-minrt used to modify the linking process in the following ways:
* Removing .init and .fini sections, by using a reduced crt0 and excluding crtn.
* Removing crtbegin and crtend (thereby not using crtstuff.c at all).
  + This meant that even if the program had constructors for global or
    static objects which must run before main, it would blindly remove them.

These causes of code bloat have been addressed by:
* switching to .{init,fini}_array instead of using .{init,fini} sections
  "Lean" code to run through constructors before main is only included if
  .init_array has contents.
* removing bloat (frame_dummy, *tm_clones*, *do_global_dtors*) from the
  crtstuff.c with the changes in the previous patches

Here are some examples of the total size of different "barebones" C programs to
show that the size previously achieved by -minrt is now matched by default:

program                 |old (with -minrt)      |new (without -minrt)
---------------------------------------------------------------------
Empty main              |20                     |20
Looping main            |14                     |14
Looping main with data  |94                     |94
Looping main with bss   |56                     |56
>From 6e561b45c118540f06d5828ec386d2dd79c13b62 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Wed, 6 Nov 2019 18:12:45 +0000
Subject: [PATCH 4/4] MSP430: Remove -minrt option

gcc/ChangeLog:

2019-11-07  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430.h (STARTFILE_SPEC): Remove -minrt rules.
	Use "if, then, else" syntax for specs.
	(ENDFILE_SPEC): Likewise.
	* config/msp430/msp430.opt: Mark -minrt as deprecated.
	* doc/invoke.texi: Remove -minrt documentation.
---
 gcc/config/msp430/msp430.h   | 9 ++++-----
 gcc/config/msp430/msp430.opt | 4 ++--
 gcc/doc/invoke.texi          | 9 +--------
 3 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h
index 25944125182..3f013a9d315 100644
--- a/gcc/config/msp430/msp430.h
+++ b/gcc/config/msp430/msp430.h
@@ -45,15 +45,14 @@ extern bool msp430x;
   while (0)
 
 #undef  STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}" \
-  "%{!pg:%{minrt:crt0-minrt.o%s}%{!minrt:crt0.o%s}} " \
-  "%{!minrt:%{fexceptions:crtbegin.o%s}%{!fexceptions:crtbegin_no_eh.o%s}}"
+#define STARTFILE_SPEC "%{pg:gcrt0.o%s; :crt0.o%s} " \
+  "%{fexceptions:crtbegin.o%s; :crtbegin_no_eh.o%s}"
 
 /* -lgcc is included because crtend.o needs __mspabi_func_epilog_1.  */
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{!minrt:%{fexceptions:crtend.o%s}%{!fexceptions:crtend_no_eh.o%s}} "  \
-  "%{minrt:%:if-exists(crtn-minrt.o%s)}%{!minrt:%:if-exists(crtn.o%s)} -lgcc"
+  "%{fexceptions:crtend.o%s; :crtend_no_eh.o%s} "  \
+  "%:if-exists(crtn.o%s) -lgcc"
 
 #define ASM_SPEC "-mP " /* Enable polymorphic instructions.  */ \
   "%{mcpu=*:-mcpu=%*} " /* Pass the CPU type on to the assembler.  */ \
diff --git a/gcc/config/msp430/msp430.opt b/gcc/config/msp430/msp430.opt
index 2db2906ca11..74fdcdf0851 100644
--- a/gcc/config/msp430/msp430.opt
+++ b/gcc/config/msp430/msp430.opt
@@ -38,8 +38,8 @@ mOs
 Target Undocumented Mask(OPT_SPACE)
 
 minrt
-Target Report Mask(MINRT) RejectNegative
-Use a minimum runtime (no static initializers or ctors) for memory-constrained devices.
+Target Undocumented WarnRemoved
+This option is deprecated in GCC10 and has no effect.
 
 HeaderInclude
 config/msp430/msp430-opts.h
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6829b949b4b..12a360ed6a7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1009,7 +1009,7 @@ Objective-C and Objective-C++ Dialects}.
 -mwarn-mcu @gol
 -mcode-region=  -mdata-region= @gol
 -msilicon-errata=  -msilicon-errata-warn= @gol
--mhwmult=  -minrt}
+-mhwmult=}
 
 @emph{NDS32 Options}
 @gccoptlist{-mbig-endian  -mlittle-endian @gol
@@ -23262,13 +23262,6 @@ The hardware multiply routines disable interrupts whilst running and
 restore the previous interrupt state when they finish.  This makes
 them safe to use inside interrupt handlers as well as in normal code.
 
-@item -minrt
-@opindex minrt
-Enable the use of a minimum runtime environment - no static
-initializers or constructors.  This is intended for memory-constrained
-devices.  The compiler includes special symbols in some objects
-that tell the linker and runtime which code fragments are required.
-
 @item -mcode-region=
 @itemx -mdata-region=
 @opindex mcode-region
-- 
2.17.1


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