Commit 895de5a8 by Geoffrey Keating Committed by Geoffrey Keating

[multiple changes]

2006-03-23  Geoffrey Keating  <geoffk@apple.com>

	PR 26793
	* config/t-darwin (crt3.o): Work around bug 26840.
	* config/darwin-crt3.c: Rewrite.
	* config/darwin.h (STARTFILE_SPEC): Don't use -l for crt3.o.

Index: gcc/testsuite/ChangeLog
2006-03-24  Geoffrey Keating  <geoffk@apple.com>

	* g++.old-deja/g++.other/init19.C: New.

From-SVN: r112361
parent e713adf6
2006-03-24 Geoffrey Keating <geoffk@apple.com>
PR 26793
* config/t-darwin (crt3.o): Work around bug 26840.
* config/darwin-crt3.c: Rewrite.
* config/darwin.h (STARTFILE_SPEC): Don't use -l for crt3.o.
2006-03-24 Carlos O'Donell <carlos@codesourcery.com> 2006-03-24 Carlos O'Donell <carlos@codesourcery.com>
* doc/invoke.texi: Document -femit-class-debug-always * doc/invoke.texi: Document -femit-class-debug-always
......
...@@ -341,7 +341,7 @@ Boston, MA 02110-1301, USA. */ ...@@ -341,7 +341,7 @@ Boston, MA 02110-1301, USA. */
%{!static:%{object:-lcrt0.o} \ %{!static:%{object:-lcrt0.o} \
%{!object:%{preload:-lcrt0.o} \ %{!object:%{preload:-lcrt0.o} \
%{!preload:-lcrt1.o %(darwin_crt2)}}}}}} \ %{!preload:-lcrt1.o %(darwin_crt2)}}}}}} \
%{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= -lcrt3.o)}" %{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}"
/* The native Darwin linker doesn't necessarily place files in the order /* The native Darwin linker doesn't necessarily place files in the order
that they're specified on the link line. Thus, it is pointless that they're specified on the link line. Thus, it is pointless
......
...@@ -14,9 +14,11 @@ gt-darwin.h : s-gtype ; @true ...@@ -14,9 +14,11 @@ gt-darwin.h : s-gtype ; @true
# How to build crt3.o # How to build crt3.o
EXTRA_MULTILIB_PARTS=crt3.o EXTRA_MULTILIB_PARTS=crt3.o
# Pass -fno-tree-dominator-opts to work around bug 26840.
$(T)crt3$(objext): $(srcdir)/config/darwin-crt3.c $(GCC_PASSES) \ $(T)crt3$(objext): $(srcdir)/config/darwin-crt3.c $(GCC_PASSES) \
$(TCONFIG_H) stmp-int-hdrs tsystem.h $(TCONFIG_H) stmp-int-hdrs tsystem.h
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
-fno-tree-dominator-opts \
-c $(srcdir)/config/darwin-crt3.c -o $(T)crt3$(objext) -c $(srcdir)/config/darwin-crt3.c -o $(T)crt3$(objext)
# Use unwind-dw2-fde-darwin # Use unwind-dw2-fde-darwin
......
...@@ -5326,8 +5326,9 @@ is_c_family (void) ...@@ -5326,8 +5326,9 @@ is_c_family (void)
{ {
unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language); unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
return (lang == DW_LANG_C || lang == DW_LANG_C89 return (lang == DW_LANG_C || lang == DW_LANG_C89 || lang == DW_LANG_ObjC
|| lang == DW_LANG_C_plus_plus); || lang == DW_LANG_C99
|| lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus);
} }
/* Return TRUE if the language is C++. */ /* Return TRUE if the language is C++. */
...@@ -5335,8 +5336,9 @@ is_c_family (void) ...@@ -5335,8 +5336,9 @@ is_c_family (void)
static inline bool static inline bool
is_cxx (void) is_cxx (void)
{ {
return (get_AT_unsigned (comp_unit_die, DW_AT_language) unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
== DW_LANG_C_plus_plus);
return lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus;
} }
/* Return TRUE if the language is Fortran. */ /* Return TRUE if the language is Fortran. */
...@@ -9927,6 +9929,23 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) ...@@ -9927,6 +9929,23 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
} }
/* Determine whether the evaluation of EXPR references any variables
or functions which aren't otherwise used (and therefore may not be
output). */
static tree
reference_to_unused (tree * tp, int * walk_subtrees,
void * data ATTRIBUTE_UNUSED)
{
if (! EXPR_P (*tp) && ! CONSTANT_CLASS_P (*tp))
*walk_subtrees = 0;
if (DECL_P (*tp) && ! TREE_PUBLIC (*tp) && ! TREE_USED (*tp)
&& ! TREE_ASM_WRITTEN (*tp))
return *tp;
else
return NULL_TREE;
}
/* Generate an RTL constant from a decl initializer INIT with decl type TYPE, /* Generate an RTL constant from a decl initializer INIT with decl type TYPE,
for use in a later add_const_value_attribute call. */ for use in a later add_const_value_attribute call. */
...@@ -9953,15 +9972,16 @@ rtl_for_decl_init (tree init, tree type) ...@@ -9953,15 +9972,16 @@ rtl_for_decl_init (tree init, tree type)
rtl = gen_rtx_CONST_STRING (VOIDmode, rtl = gen_rtx_CONST_STRING (VOIDmode,
ggc_strdup (TREE_STRING_POINTER (init))); ggc_strdup (TREE_STRING_POINTER (init)));
} }
/* Although DWARF could easily handle other kinds of aggregates, we
have no way to represent such values as RTL constants, so skip
those. */
else if (AGGREGATE_TYPE_P (type))
;
/* If the initializer is something that we know will expand into an /* If the initializer is something that we know will expand into an
immediate RTL constant, expand it now. Expanding anything else immediate RTL constant, expand it now. We must be careful not to
tends to produce unresolved symbols; see debug/5770 and c++/6381. */ reference variables which won't be output. */
/* Aggregate, vector, and complex types may contain constructors that may else if (initializer_constant_valid_p (init, type)
result in code being generated when expand_expr is called, so we can't && ! walk_tree (&init, reference_to_unused, NULL, NULL))
handle them here. Integer and float are useful and safe types to handle
here. */
else if ((INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type))
&& initializer_constant_valid_p (init, type) == null_pointer_node)
{ {
rtl = expand_expr (init, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); rtl = expand_expr (init, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
...@@ -10325,6 +10345,9 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, ...@@ -10325,6 +10345,9 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
add_AT_location_description (die, attr, descr); add_AT_location_description (die, attr, descr);
return; return;
} }
/* None of that worked, so it must not really have a location;
try adding a constant value attribute from the DECL_INITIAL. */
tree_add_const_value_attribute (die, decl);
} }
/* If we don't have a copy of this variable in memory for some reason (such /* If we don't have a copy of this variable in memory for some reason (such
...@@ -12204,6 +12227,10 @@ gen_compile_unit_die (const char *filename) ...@@ -12204,6 +12227,10 @@ gen_compile_unit_die (const char *filename)
language = DW_LANG_Pascal83; language = DW_LANG_Pascal83;
else if (strcmp (language_string, "GNU Java") == 0) else if (strcmp (language_string, "GNU Java") == 0)
language = DW_LANG_Java; language = DW_LANG_Java;
else if (strcmp (language_string, "GNU Objective-C") == 0)
language = DW_LANG_ObjC;
else if (strcmp (language_string, "GNU Objective-C++") == 0)
language = DW_LANG_ObjC_plus_plus;
else else
language = DW_LANG_C89; language = DW_LANG_C89;
...@@ -13314,8 +13341,7 @@ dwarf2out_decl (tree decl) ...@@ -13314,8 +13341,7 @@ dwarf2out_decl (tree decl)
{ {
/* OK, we need to generate one for `bool' so GDB knows what type /* OK, we need to generate one for `bool' so GDB knows what type
comparisons have. */ comparisons have. */
if ((get_AT_unsigned (comp_unit_die, DW_AT_language) if (is_cxx ()
== DW_LANG_C_plus_plus)
&& TREE_CODE (TREE_TYPE (decl)) == BOOLEAN_TYPE && TREE_CODE (TREE_TYPE (decl)) == BOOLEAN_TYPE
&& ! DECL_IGNORED_P (decl)) && ! DECL_IGNORED_P (decl))
modified_type_die (TREE_TYPE (decl), 0, 0, NULL); modified_type_die (TREE_TYPE (decl), 0, 0, NULL);
......
2006-03-24 Geoffrey Keating <geoffk@apple.com>
* g++.old-deja/g++.other/init19.C: New.
2006-03-24 David Edelsohn <edelsohn@gnu.org> 2006-03-24 David Edelsohn <edelsohn@gnu.org>
* g++.dg/eh/spbp.C: Skip on AIX. * g++.dg/eh/spbp.C: Skip on AIX.
// { dg-do run }
#include <stdlib.h>
#define assert(x) do { if (! (x)) abort(); } while (0)
int count = 0;
class A
{
public:
explicit A(int i);
~A();
int i;
A(const A&);
A& operator=(const A&);
};
A::A(int i_)
: i(i_)
{
}
A::~A()
{
assert(++count == i);
i = -1;
}
extern "C" {
void one()
{
static bool second_time;
if (second_time)
assert(++count == 9);
else
{
assert(++count == 1);
second_time = true;
}
static A a(10);
assert(a.i == 10);
}
void two()
{
assert(++count == 7);
static A a(8);
assert(a.i == 8);
}
void three()
{
assert(++count == 2);
static A a(6);
assert(a.i == 6);
}
void five()
{
assert(++count == 4);
static A a(5);
assert(a.i == 5);
}
void four()
{
assert(++count == 3);
atexit(five);
}
}
A zero(11);
int main()
{
one();
atexit(one);
atexit(two);
three();
atexit(four);
}
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