comparison gcc/config/darwin.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* Functions for generic Darwin as target machine for GNU C compiler. 1 /* Functions for generic Darwin as target machine for GNU C compiler.
2 Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002, 2003, 2004, 2 Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008 3 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 Contributed by Apple Computer Inc. 5 Contributed by Apple Computer Inc.
6 6
7 This file is part of GCC. 7 This file is part of GCC.
8 8
279 return orig; 279 return orig;
280 else 280 else
281 { 281 {
282 /* Play games to avoid marking the function as needing pic if we 282 /* Play games to avoid marking the function as needing pic if we
283 are being called as part of the cost-estimation process. */ 283 are being called as part of the cost-estimation process. */
284 if (current_ir_type () != IR_GIMPLE) 284 if (current_ir_type () != IR_GIMPLE || currently_expanding_to_rtl)
285 crtl->uses_pic_offset_table = 1; 285 crtl->uses_pic_offset_table = 1;
286 orig = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig), 286 orig = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig),
287 UNSPEC_MACHOPIC_OFFSET); 287 UNSPEC_MACHOPIC_OFFSET);
288 return gen_rtx_CONST (Pmode, orig); 288 return gen_rtx_CONST (Pmode, orig);
289 } 289 }
312 /* The suffix attached to non-lazy pointer symbols. */ 312 /* The suffix attached to non-lazy pointer symbols. */
313 #define NON_LAZY_POINTER_SUFFIX "$non_lazy_ptr" 313 #define NON_LAZY_POINTER_SUFFIX "$non_lazy_ptr"
314 /* The suffix attached to stub symbols. */ 314 /* The suffix attached to stub symbols. */
315 #define STUB_SUFFIX "$stub" 315 #define STUB_SUFFIX "$stub"
316 316
317 typedef struct machopic_indirection GTY (()) 317 typedef struct GTY (()) machopic_indirection
318 { 318 {
319 /* The SYMBOL_REF for the entity referenced. */ 319 /* The SYMBOL_REF for the entity referenced. */
320 rtx symbol; 320 rtx symbol;
321 /* The name of the stub or non-lazy pointer. */ 321 /* The name of the stub or non-lazy pointer. */
322 const char * ptr_name; 322 const char * ptr_name;
1371 { 1371 {
1372 if (!!strncmp (name, "_OBJC_", 6)) 1372 if (!!strncmp (name, "_OBJC_", 6))
1373 default_globalize_label (stream, name); 1373 default_globalize_label (stream, name);
1374 } 1374 }
1375 1375
1376 /* This routine returns non-zero if 'name' starts with the special objective-c
1377 anonymous file-scope static name. It accommodates c++'s mangling of such
1378 symbols (in this case the symbols will have form _ZL{d}*_OBJC_* d=digit). */
1379
1380 int
1381 darwin_label_is_anonymous_local_objc_name (const char *name)
1382 {
1383 const unsigned char *p = (const unsigned char *) name;
1384 if (*p != '_')
1385 return 0;
1386 if (p[1] == 'Z' && p[2] == 'L')
1387 {
1388 p += 3;
1389 while (*p >= '0' && *p <= '9')
1390 p++;
1391 }
1392 return (!strncmp ((const char *)p, "_OBJC_", 6));
1393 }
1394
1376 void 1395 void
1377 darwin_asm_named_section (const char *name, 1396 darwin_asm_named_section (const char *name,
1378 unsigned int flags ATTRIBUTE_UNUSED, 1397 unsigned int flags ATTRIBUTE_UNUSED,
1379 tree decl ATTRIBUTE_UNUSED) 1398 tree decl ATTRIBUTE_UNUSED)
1380 { 1399 {
1405 bool *no_add_attrs) 1424 bool *no_add_attrs)
1406 { 1425 {
1407 /* APPLE KEXT stuff -- only applies with pure static C++ code. */ 1426 /* APPLE KEXT stuff -- only applies with pure static C++ code. */
1408 if (! TARGET_KEXTABI) 1427 if (! TARGET_KEXTABI)
1409 { 1428 {
1410 warning (0, "%<%s%> 2.95 vtable-compatibility attribute applies " 1429 warning (0, "%qE 2.95 vtable-compatibility attribute applies "
1411 "only when compiling a kext", IDENTIFIER_POINTER (name)); 1430 "only when compiling a kext", name);
1412 1431
1413 *no_add_attrs = true; 1432 *no_add_attrs = true;
1414 } 1433 }
1415 else if (TREE_CODE (*node) != RECORD_TYPE) 1434 else if (TREE_CODE (*node) != RECORD_TYPE)
1416 { 1435 {
1417 warning (0, "%<%s%> 2.95 vtable-compatibility attribute applies " 1436 warning (0, "%qE 2.95 vtable-compatibility attribute applies "
1418 "only to C++ classes", IDENTIFIER_POINTER (name)); 1437 "only to C++ classes", name);
1419 1438
1420 *no_add_attrs = true; 1439 *no_add_attrs = true;
1421 } 1440 }
1422 1441
1423 return NULL_TREE; 1442 return NULL_TREE;
1432 int ARG_UNUSED (flags), 1451 int ARG_UNUSED (flags),
1433 bool * no_add_attrs) 1452 bool * no_add_attrs)
1434 { 1453 {
1435 if (TREE_CODE (*node) != FUNCTION_DECL && TREE_CODE (*node) != VAR_DECL) 1454 if (TREE_CODE (*node) != FUNCTION_DECL && TREE_CODE (*node) != VAR_DECL)
1436 { 1455 {
1437 warning (OPT_Wattributes, "%qs attribute ignored", 1456 warning (OPT_Wattributes, "%qE attribute ignored",
1438 IDENTIFIER_POINTER (name)); 1457 name);
1439 *no_add_attrs = true; 1458 *no_add_attrs = true;
1440 } 1459 }
1441 else 1460 else
1442 declare_weak (*node); 1461 declare_weak (*node);
1443 1462
1690 } 1709 }
1691 1710
1692 void 1711 void
1693 darwin_override_options (void) 1712 darwin_override_options (void)
1694 { 1713 {
1714 /* Don't emit DWARF3/4 unless specifically selected. This is a
1715 workaround for tool bugs. */
1716 if (dwarf_strict < 0)
1717 dwarf_strict = 1;
1718
1719 /* Disable -freorder-blocks-and-partition for darwin_emit_unwind_label. */
1720 if (flag_reorder_blocks_and_partition
1721 && (targetm.asm_out.unwind_label == darwin_emit_unwind_label))
1722 {
1723 inform (input_location,
1724 "-freorder-blocks-and-partition does not work with exceptions "
1725 "on this architecture");
1726 flag_reorder_blocks_and_partition = 0;
1727 flag_reorder_blocks = 1;
1728 }
1729
1695 if (flag_mkernel || flag_apple_kext) 1730 if (flag_mkernel || flag_apple_kext)
1696 { 1731 {
1697 /* -mkernel implies -fapple-kext for C++ */ 1732 /* -mkernel implies -fapple-kext for C++ */
1698 if (strcmp (lang_hooks.name, "GNU C++") == 0) 1733 if (strcmp (lang_hooks.name, "GNU C++") == 0)
1699 flag_apple_kext = 1; 1734 flag_apple_kext = 1;