This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
new arm option -mabort-on-noreturn
- To: egcs-patches at cygnus dot com
- Subject: new arm option -mabort-on-noreturn
- From: "Catherine L. Moore" <clm at cygnus dot com>
- Date: Wed, 13 Jan 1999 17:18:07 -0600
The arm port was generating a call to abort if a function
that was declared noreturn tried to return. This patch
causes the compiler to generate the call to abort only if
the -mabort-on-noreturn option is specified. I checked in this
patch this afternoon. Nick Clifton approved it.
Catherine
Index: arm.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/arm/arm.c,v
retrieving revision 1.21
diff -p -r1.21 arm.c
*** arm.c 1998/12/16 21:01:29 1.21
--- arm.c 1999/01/13 22:25:37
*************** output_func_epilogue (f, frame_size)
*** 5006,5012 ****
goto epilogue_done;
/* A volatile function should never return. Call abort. */
! if (volatile_func)
{
rtx op = gen_rtx (SYMBOL_REF, Pmode, "abort");
assemble_external_libcall (op);
--- 5006,5012 ----
goto epilogue_done;
/* A volatile function should never return. Call abort. */
! if (TARGET_ABORT_NORETURN && volatile_func)
{
rtx op = gen_rtx (SYMBOL_REF, Pmode, "abort");
assemble_external_libcall (op);
Index: arm.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/arm/arm.h,v
retrieving revision 1.16
diff -p -r1.16 arm.h
*** arm.h 1998/12/16 21:01:30 1.16
--- arm.h 1999/01/13 22:26:04
*************** extern char *target_fp_name;
*** 312,317 ****
--- 312,321 ----
big-endian (for backwards compatibility with older versions of GCC). */
#define ARM_FLAG_LITTLE_WORDS (0x2000)
+ /* Nonzero if a call to abort should be generated if a noreturn
+ function tries to return. */
+ #define ARM_FLAG_ABORT_NORETURN (0x8000)
+
#define TARGET_APCS (target_flags & ARM_FLAG_APCS_FRAME)
#define TARGET_POKE_FUNCTION_NAME (target_flags & ARM_FLAG_POKE)
#define TARGET_FPE (target_flags & ARM_FLAG_FPE)
*************** extern char *target_fp_name;
*** 327,332 ****
--- 331,337 ----
#define TARGET_BIG_END (target_flags & ARM_FLAG_BIG_END)
#define TARGET_THUMB_INTERWORK (target_flags & ARM_FLAG_THUMB)
#define TARGET_LITTLE_WORDS (target_flags & ARM_FLAG_LITTLE_WORDS)
+ #define TARGET_ABORT_NORETURN (target_flags & ARM_FLAG_ABORT_NORETURN)
/* SUBTARGET_SWITCHES is used to add flags on a per-config basis.
Bit 31 is reserved. See riscix.h. */
*************** extern char *target_fp_name;
*** 377,382 ****
--- 382,391 ----
{"thumb-interwork", ARM_FLAG_THUMB, \
"Support calls between THUMB and ARM instructions sets" }, \
{"no-thumb-interwork", -ARM_FLAG_THUMB, "" }, \
+ {"abort-on-noreturn", ARM_FLAG_ABORT_NORETURN, \
+ "Generate a call to abort if a noreturn function returns"}, \
+ {"no-abort-on-noreturn", -ARM_FLAG_ABORT_NORETURN, ""}, \
+
SUBTARGET_SWITCHES \
{"", TARGET_DEFAULT } \
}