Commit 4f50b9ff by DJ Delorie Committed by DJ Delorie

msp430.h (LIB_SPEC): Add -lcrt

* config/msp430/msp430.h (LIB_SPEC): Add -lcrt
* config/msp430/msp430.md (msp430_refsym_need_exit): New.
* config/msp430/msp430.c (msp430_expand_epilogue): Call it
whenever main() has an epilogue.

From-SVN: r207334
parent f221dc81
2014-01-30 DJ Delorie <dj@redhat.com>
* config/msp430/msp430.h (LIB_SPEC): Add -lcrt
* config/msp430/msp430.md (msp430_refsym_need_exit): New.
* config/msp430/msp430.c (msp430_expand_epilogue): Call it
whenever main() has an epilogue.
2014-01-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> 2014-01-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* config/rs6000/rs6000.c (rs6000_expand_vector_init): Remove * config/rs6000/rs6000.c (rs6000_expand_vector_init): Remove
......
...@@ -1429,6 +1429,9 @@ msp430_expand_epilogue (int is_eh) ...@@ -1429,6 +1429,9 @@ msp430_expand_epilogue (int is_eh)
emit_insn (gen_epilogue_start_marker ()); emit_insn (gen_epilogue_start_marker ());
if (cfun->decl && strcmp (IDENTIFIER_POINTER (DECL_NAME (cfun->decl)), "main") == 0)
emit_insn (gen_msp430_refsym_need_exit ());
if (is_wakeup_func ()) if (is_wakeup_func ())
/* Clear the SCG1, SCG0, OSCOFF and CPUOFF bits in the saved copy of the /* Clear the SCG1, SCG0, OSCOFF and CPUOFF bits in the saved copy of the
status register current residing on the stack. When this function status register current residing on the stack. When this function
......
...@@ -68,6 +68,7 @@ extern bool msp430x; ...@@ -68,6 +68,7 @@ extern bool msp430x;
--start-group \ --start-group \
-lc \ -lc \
-lgcc \ -lgcc \
-lcrt \
%{msim:-lsim} \ %{msim:-lsim} \
%{!msim:-lnosys} \ %{!msim:-lnosys} \
--end-group \ --end-group \
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
UNS_POP_INTR UNS_POP_INTR
UNS_BIC_SR UNS_BIC_SR
UNS_BIS_SR UNS_BIS_SR
UNS_REFSYM_NEED_EXIT
]) ])
(include "predicates.md") (include "predicates.md")
...@@ -938,6 +940,14 @@ ...@@ -938,6 +940,14 @@
"; start of epilogue" "; start of epilogue"
) )
;; This makes the linker add a call to exit() after the call to main()
;; in crt0
(define_insn "msp430_refsym_need_exit"
[(unspec_volatile [(const_int 0)] UNS_REFSYM_NEED_EXIT)]
""
".refsym\t__crt0_call_exit"
)
;;------------------------------------------------------------ ;;------------------------------------------------------------
;; Jumps ;; Jumps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment