[msp430] add -minrt
diff mbox

Message ID 201401300257.s0U2vhBS016662@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Jan. 30, 2014, 2:57 a.m. UTC
Minor change to support some new functionality in newlib.  Committed.

	* config/msp430/msp430.opt (-minrt): New.
	* config/msp430/msp430.h (STARTFILE_SPEC): Link alternate runtime
	if -minrt given.
	(ENDFILE_SPEC): Likewise.

Patch
diff mbox

Index: gcc/config/msp430/msp430.opt
===================================================================
--- gcc/config/msp430/msp430.opt	(revision 207293)
+++ gcc/config/msp430/msp430.opt	(working copy)
@@ -25,6 +25,10 @@  Select small model - 16-bit addresses/po
 mrelax
 Target Report
 Optimize opcode sizes at link time
 
 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.
Index: gcc/config/msp430/msp430.h
===================================================================
--- gcc/config/msp430/msp430.h	(revision 207293)
+++ gcc/config/msp430/msp430.h	(working copy)
@@ -42,17 +42,17 @@  extern bool msp430x;
       else					\
 	builtin_assert ("cpu=MSP430"); 		\
     }                                           \
   while (0)
 
 #undef  STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s} crtbegin.o%s"
+#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{minrt:crt0-minrt.o%s}%{!minrt:crt0.o%s}} %{!minrt:crtbegin.o%s}"
 
 /* -lgcc is included because crtend.o needs __mspabi_func_epilog_1.  */
 #undef  ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s -lgcc"
+#define ENDFILE_SPEC "%{!minrt:crtend.o%s} %{minrt:crtn-minrt.o%s}%{!minrt:crtn.o%s} -lgcc"
 
 #define ASM_SPEC "-mP " /* Enable polymorphic instructions.  */ \
   "%{mcpu=*:-mcpu=%*}%{!mcpu=*:%{mmcu=*:-mmcu=%*}} " /* Pass the CPU type on to the assembler.  */ \
   "%{mrelax=-mQ} " /* Pass the relax option on to the assembler.  */ \
   "%{mlarge:-ml} " /* Tell the assembler if we are building for the LARGE pointer model.  */ \
   "%{!msim:-md} %{msim:%{mlarge:-md}}" /* Copy data from ROM to RAM if necessary.  */ \