comparison gcc/config/i386/winnt.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
1 /* Subroutines for insn-output.c for Windows NT. 1 /* Subroutines for insn-output.c for Windows NT.
2 Contributed by Douglas Rupp (drupp@cs.washington.edu) 2 Contributed by Douglas Rupp (drupp@cs.washington.edu)
3 Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free 9 the terms of the GNU General Public License as published by the Free
33 #include "toplev.h" 33 #include "toplev.h"
34 #include "hashtab.h" 34 #include "hashtab.h"
35 #include "langhooks.h" 35 #include "langhooks.h"
36 #include "ggc.h" 36 #include "ggc.h"
37 #include "target.h" 37 #include "target.h"
38 #include "lto-streamer.h"
38 39
39 /* i386/PE specific attribute support. 40 /* i386/PE specific attribute support.
40 41
41 i386/PE has two new attributes: 42 i386/PE has two new attributes:
42 dllexport - for exporting a function/variable that will live in a dll 43 dllexport - for exporting a function/variable that will live in a dll
318 non-local reference comes from a dllimport'd symbol. */ 319 non-local reference comes from a dllimport'd symbol. */
319 if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL) 320 if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
320 && DECL_DLLIMPORT_P (exp)) 321 && DECL_DLLIMPORT_P (exp))
321 return false; 322 return false;
322 323
324 /* Or a weak one, now that they are supported. */
325 if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
326 && DECL_WEAK (exp))
327 /* But x64 gets confused and attempts to use unsupported GOTPCREL
328 relocations if we tell it the truth, so we still return true in
329 that case until the deeper problem can be fixed. */
330 return (TARGET_64BIT && DEFAULT_ABI == MS_ABI);
331
323 return true; 332 return true;
324 } 333 }
325 334
326 /* Also strip the fastcall prefix and stdcall suffix. */ 335 /* Also strip the fastcall prefix and stdcall suffix. */
327 336
463 *f++ = 'w'; 472 *f++ = 'w';
464 if (flags & SECTION_PE_SHARED) 473 if (flags & SECTION_PE_SHARED)
465 *f++ = 's'; 474 *f++ = 's';
466 } 475 }
467 476
477 /* LTO sections need 1-byte alignment to avoid confusing the
478 zlib decompression algorithm with trailing zero pad bytes. */
479 if (strncmp (name, LTO_SECTION_NAME_PREFIX,
480 strlen (LTO_SECTION_NAME_PREFIX)) == 0)
481 *f++ = '0';
482
468 *f = '\0'; 483 *f = '\0';
469 484
470 fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars); 485 fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);
471 486
472 if (flags & SECTION_LINKONCE) 487 if (flags & SECTION_LINKONCE)
483 fprintf (asm_out_file, "\t.linkonce %s\n", 498 fprintf (asm_out_file, "\t.linkonce %s\n",
484 (discard ? "discard" : "same_size")); 499 (discard ? "discard" : "same_size"));
485 } 500 }
486 } 501 }
487 502
503 /* Beware, DECL may be NULL if compile_file() is emitting the LTO marker. */
504
488 void 505 void
489 i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl, 506 i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
490 const char *name, HOST_WIDE_INT size, 507 const char *name, HOST_WIDE_INT size,
491 HOST_WIDE_INT align ATTRIBUTE_UNUSED) 508 HOST_WIDE_INT align ATTRIBUTE_UNUSED)
492 { 509 {
579 596
580 /* Assemble an export symbol entry. We need to keep a list of 597 /* Assemble an export symbol entry. We need to keep a list of
581 these, so that we can output the export list at the end of the 598 these, so that we can output the export list at the end of the
582 assembly. We used to output these export symbols in each function, 599 assembly. We used to output these export symbols in each function,
583 but that causes problems with GNU ld when the sections are 600 but that causes problems with GNU ld when the sections are
584 linkonce. */ 601 linkonce. Beware, DECL may be NULL if compile_file() is emitting
602 the LTO marker. */
585 603
586 void 604 void
587 i386_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data) 605 i386_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
588 { 606 {
589 rtx symbol; 607 rtx symbol;
590 struct export_list *p; 608 struct export_list *p;
609
610 if (!decl)
611 return;
591 612
592 symbol = XEXP (DECL_RTL (decl), 0); 613 symbol = XEXP (DECL_RTL (decl), 0);
593 gcc_assert (GET_CODE (symbol) == SYMBOL_REF); 614 gcc_assert (GET_CODE (symbol) == SYMBOL_REF);
594 if (!SYMBOL_REF_DLLEXPORT_P (symbol)) 615 if (!SYMBOL_REF_DLLEXPORT_P (symbol))
595 return; 616 return;
668 void 689 void
669 i386_pe_file_end (void) 690 i386_pe_file_end (void)
670 { 691 {
671 struct extern_list *p; 692 struct extern_list *p;
672 693
673 ix86_file_end ();
674
675 for (p = extern_head; p != NULL; p = p->next) 694 for (p = extern_head; p != NULL; p = p->next)
676 { 695 {
677 tree decl; 696 tree decl;
678 697
679 decl = p->decl; 698 decl = p->decl;