This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libtool litter
- To: dave at hiauly1 dot hia dot nrc dot ca
- Subject: Re: libtool litter
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 17 May 2001 11:12:17 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <20010514203404S.mitchell@codesourcery.com><200105151740.NAA22226@hiauly1.hia.nrc.ca>
>>>>> "John" == John David Anglin <dave@hiauly1.hia.nrc.ca> writes:
John> I am building with hppa1.1-hp-hpux10.20. Yes, I believe
John> that the first C++ file that you try to compile will cause a
John> segmentation fault.
Here is the fix.
Note the new assert in assemble_external to prevent similar errors.
Bootstrapped and tested on i686-pc-linux-gnu, applied on the mainline
and on the branch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001-05-17 Mark Mitchell <mark@codesourcery.com>
* except.h (protect_cleanup_actions): Remove it.
(lang_protect_cleanup_actions): Declare it.
* except.c (protect_cleanup_actions): Remove it.
(lang_protect_cleanup_actions): New variable.
(init_eh): Don't make protect_cleanup_actions a GC root.
(expand_eh_region_and_cleanup): Call
lang_protect_cleanup_actions.
(output_function_exception_table): Remove unused `align'
variable.
* varasm.c (assemble_external): Abort if we have not yet
opened the assembly output file.
2001-05-17 Mark Mitchell <mark@codesourcery.com>
* except.c (cp_protect_cleanup_actions): New function.
(init_exception_processing): Don't set protect_cleanup_actions
here. Do set lang_protect_cleanup_actions.
Index: gcc/except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/except.c,v
retrieving revision 1.143.2.8
diff -c -p -r1.143.2.8 except.c
*** except.c 2001/05/16 19:29:55 1.143.2.8
--- except.c 2001/05/17 17:59:17
*************** int flag_non_call_exceptions;
*** 88,94 ****
/* Protect cleanup actions with must-not-throw regions, with a call
to the given failure handler. */
! tree protect_cleanup_actions;
/* Return true if type A catches type B. */
int (*lang_eh_type_covers) PARAMS ((tree a, tree b));
--- 88,94 ----
/* Protect cleanup actions with must-not-throw regions, with a call
to the given failure handler. */
! tree (*lang_protect_cleanup_actions) PARAMS ((void));
/* Return true if type A catches type B. */
int (*lang_eh_type_covers) PARAMS ((tree a, tree b));
*************** void
*** 367,373 ****
init_eh ()
{
ggc_add_rtx_root (&exception_handler_labels, 1);
- ggc_add_tree_root (&protect_cleanup_actions, 1);
if (! flag_exceptions)
return;
--- 367,372 ----
*************** expand_eh_region_end_cleanup (handler)
*** 691,696 ****
--- 690,696 ----
tree handler;
{
struct eh_region *region;
+ tree protect_cleanup_actions;
rtx around_label;
rtx data_save[2];
*************** expand_eh_region_end_cleanup (handler)
*** 707,712 ****
--- 707,719 ----
emit_label (region->label);
+ /* Give the language a chance to specify an action to be taken if an
+ exception is thrown that would propogate out of the HANDLER. */
+ protect_cleanup_actions
+ = (lang_protect_cleanup_actions
+ ? (*lang_protect_cleanup_actions) ()
+ : NULL_TREE);
+
if (protect_cleanup_actions)
expand_eh_region_start ();
*************** output_function_exception_table ()
*** 3559,3565 ****
ASM_OUTPUT_LABEL (asm_out_file, ttype_after_disp_label);
#else
/* Ug. Alignment queers things. */
! unsigned int before_disp, after_disp, last_disp, disp, align;
before_disp = 1 + 1;
after_disp = (1 + size_of_uleb128 (call_site_len)
--- 3566,3572 ----
ASM_OUTPUT_LABEL (asm_out_file, ttype_after_disp_label);
#else
/* Ug. Alignment queers things. */
! unsigned int before_disp, after_disp, last_disp, disp;
before_disp = 1 + 1;
after_disp = (1 + size_of_uleb128 (call_site_len)
Index: gcc/except.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/except.h,v
retrieving revision 1.42.6.4
diff -c -p -r1.42.6.4 except.h
*** except.h 2001/05/13 07:09:53 1.42.6.4
--- except.h 2001/05/17 17:59:17
*************** extern int duplicate_eh_regions PARAMS
*** 147,154 ****
extern void sjlj_emit_function_exit_after PARAMS ((rtx));
! /* Nonzero to protect cleanup actions with must-not-throw regions. */
! extern tree protect_cleanup_actions;
/* Return true if type A catches type B. */
extern int (*lang_eh_type_covers) PARAMS ((tree a, tree b));
--- 147,159 ----
extern void sjlj_emit_function_exit_after PARAMS ((rtx));
! /* If non-NULL, this is a function that returns an expression to be
! executed if an unhandled exception is propogated out of a cleanup
! region. For example, in C++, an exception thrown by a destructor
! during stack unwinding is required to result in a call to
! `std::terminate', so the C++ version of this function returns a
! CALL_EXPR for `std::terminate'. */
! extern tree (*lang_protect_cleanup_actions) PARAMS ((void));
/* Return true if type A catches type B. */
extern int (*lang_eh_type_covers) PARAMS ((tree a, tree b));
Index: gcc/varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.161.2.11
diff -c -p -r1.161.2.11 varasm.c
*** varasm.c 2001/05/13 21:36:15 1.161.2.11
--- varasm.c 2001/05/17 17:59:19
*************** void
*** 1625,1630 ****
--- 1625,1637 ----
assemble_external (decl)
tree decl ATTRIBUTE_UNUSED;
{
+ /* Because most platforms do not define ASM_OUTPUT_EXTERNAL, the
+ main body of this code is only rarely exercised. To provide some
+ testing, on all platforms, we make sure that the ASM_OUT_FILE is
+ open. If it's not, we should not be calling this function. */
+ if (!asm_out_file)
+ abort ();
+
#ifdef ASM_OUTPUT_EXTERNAL
if (DECL_P (decl) && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
{
Index: gcc/cp/except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/except.c,v
retrieving revision 1.120.2.9
diff -c -p -r1.120.2.9 except.c
*** except.c 2001/05/13 07:10:21 1.120.2.9
--- except.c 2001/05/17 17:59:19
*************** static int complete_ptr_ref_or_void_ptr_
*** 50,55 ****
--- 50,56 ----
static bool is_admissible_throw_operand PARAMS ((tree));
static int can_convert_eh PARAMS ((tree, tree));
static void check_handlers_1 PARAMS ((tree, tree));
+ static tree cp_protect_cleanup_actions PARAMS ((void));
#include "decl.h"
#include "obstack.h"
*************** init_exception_processing ()
*** 73,80 ****
if (flag_honor_std)
pop_namespace ();
- protect_cleanup_actions = build_call (terminate_node, NULL_TREE);
-
/* void __cxa_call_unexpected(void *); */
tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
tmp = build_function_type (void_type_node, tmp);
--- 74,79 ----
*************** init_exception_processing ()
*** 86,92 ****
--- 85,105 ----
: "__gxx_personality_v0");
lang_eh_runtime_type = build_eh_type_type;
+ lang_protect_cleanup_actions = &cp_protect_cleanup_actions;
}
+
+ /* Returns an expression to be executed if an unhandled exception is
+ propogated out of a cleanup region. */
+
+ static tree
+ cp_protect_cleanup_actions ()
+ {
+ /* [except.terminate]
+
+ When the destruction of an object during stack unwinding exits
+ using an exception ... void terminate(); is called. */
+ return build_call (terminate_node, NULL_TREE);
+ }
static tree
prepare_eh_type (type)