diff options
author | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-31 04:17:38 +0000 |
---|---|---|
committer | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-31 04:17:38 +0000 |
commit | 9d636c0524660b8784d50f39869bf3751402804b (patch) | |
tree | 1b34d89312b9772a7fe6aebe72dee13a81c256d9 /gcc/config/msp430 | |
parent | 79d65ad68a52450dba21668b3647419142a10045 (diff) | |
download | gcc-9d636c0524660b8784d50f39869bf3751402804b.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/msp430')
-rw-r--r-- | gcc/config/msp430/msp430.c | 3 | ||||
-rw-r--r-- | gcc/config/msp430/msp430.h | 1 | ||||
-rw-r--r-- | gcc/config/msp430/msp430.md | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 8b0af1a3e01..97fa3f5a18b 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1429,6 +1429,9 @@ msp430_expand_epilogue (int is_eh) 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 ()) /* Clear the SCG1, SCG0, OSCOFF and CPUOFF bits in the saved copy of the status register current residing on the stack. When this function diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h index 1afbfd44dbe..f31247489d2 100644 --- a/gcc/config/msp430/msp430.h +++ b/gcc/config/msp430/msp430.h @@ -68,6 +68,7 @@ extern bool msp430x; --start-group \ -lc \ -lgcc \ +-lcrt \ %{msim:-lsim} \ %{!msim:-lnosys} \ --end-group \ diff --git a/gcc/config/msp430/msp430.md b/gcc/config/msp430/msp430.md index ee01cd1943c..0037d8b16f8 100644 --- a/gcc/config/msp430/msp430.md +++ b/gcc/config/msp430/msp430.md @@ -45,6 +45,8 @@ UNS_POP_INTR UNS_BIC_SR UNS_BIS_SR + + UNS_REFSYM_NEED_EXIT ]) (include "predicates.md") @@ -938,6 +940,14 @@ "; 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 |