1 /* Subroutines for insn-output.c for Windows NT.
2 Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
25 #include "hard-reg-set.h"
30 /* Return string which is the former assembler name modified with a
31 suffix consisting of an atsign (@) followed by the number of bytes of
35 gen_stdcall_suffix (decl
)
39 /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead
40 of DECL_ASSEMBLER_NAME. */
41 const char *const asmname
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
44 if (TYPE_ARG_TYPES (TREE_TYPE (decl
)))
45 if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl
))))
48 tree formal_type
= TYPE_ARG_TYPES (TREE_TYPE (decl
));
50 while (TREE_VALUE (formal_type
) != void_type_node
)
53 = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type
)));
54 /* Must round up to include padding. This is done the same
55 way as in store_one_arg. */
56 parm_size
= ((parm_size
+ PARM_BOUNDARY
- 1)
57 / PARM_BOUNDARY
* PARM_BOUNDARY
);
59 formal_type
= TREE_CHAIN (formal_type
);
63 newsym
= xmalloc (strlen (asmname
) + 10);
64 sprintf (newsym
, "%s@%d", asmname
, total
/BITS_PER_UNIT
);
65 return IDENTIFIER_POINTER (get_identifier (newsym
));
69 i386_interix_encode_section_info (decl
, first
)
75 rtx rtl
= (TREE_CODE_CLASS (TREE_CODE (decl
)) != 'd'
76 ? TREE_CST_RTL (decl
) : DECL_RTL (decl
));
77 SYMBOL_REF_FLAG (XEXP (rtl
, 0))
78 = (TREE_CODE_CLASS (TREE_CODE (decl
)) != 'd'
79 || ! TREE_PUBLIC (decl
));
81 if (first
&& TREE_CODE (decl
) == FUNCTION_DECL
)
82 if (lookup_attribute ("stdcall",
83 TYPE_ATTRIBUTES (TREE_TYPE (decl
))))
84 XEXP (DECL_RTL (decl
), 0) =
85 gen_rtx (SYMBOL_REF
, Pmode
, gen_stdcall_suffix (decl
));
89 /* Turn this back on when the linker is updated to handle grouped
90 .data$ sections correctly. See corresponding note in i386/interix.h.
93 /* Cover function for UNIQUE_SECTION. */
96 i386_pe_unique_section (decl
, reloc
)
102 char *string
,*prefix
;
104 name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
105 name
= (* targetm
.strip_name_encoding
) (name
);
107 /* The object is put in, for example, section .text$foo.
108 The linker will then ultimately place them in .text
109 (everything from the $ on is stripped). Don't put
110 read-only data in .rdata section to avoid a PE linker
111 bug when .rdata$* grouped sections are used in code
112 without a .rdata section. */
113 if (TREE_CODE (decl
) == FUNCTION_DECL
)
115 else if (DECL_READONLY_SECTION (decl
, reloc
))
119 len
= strlen (name
) + strlen (prefix
);
120 string
= alloca (len
+ 1);
121 sprintf (string
, "%s%s", prefix
, name
);
123 DECL_SECTION_NAME (decl
) = build_string (len
, string
);