pe.c (90075) | pe.c (117395) |
---|---|
1/* Routines for GCC for ARM/pe. | 1/* Routines for GCC for ARM/pe. |
2 Copyright (C) 1995, 1996, 2000, 2001 Free Software Foundation, Inc. | 2 Copyright (C) 1995, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. |
3 Contributed by Doug Evans (dje@cygnus.com). 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. --- 16 unchanged lines hidden (view full) --- 27#include "tree.h" 28#include "expr.h" 29#include "toplev.h" 30#include "tm_p.h" 31 32extern int current_function_anonymous_args; 33 34 | 3 Contributed by Doug Evans (dje@cygnus.com). 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. --- 16 unchanged lines hidden (view full) --- 27#include "tree.h" 28#include "expr.h" 29#include "toplev.h" 30#include "tm_p.h" 31 32extern int current_function_anonymous_args; 33 34 |
35/* Return non-zero if DECL is a dllexport'd object. */ | 35/* Return nonzero if DECL is a dllexport'd object. */ |
36 37tree current_class_type; /* FIXME */ 38 39int 40arm_dllexport_p (decl) 41 tree decl; 42{ 43 tree exp; 44 45 if (TREE_CODE (decl) != VAR_DECL 46 && TREE_CODE (decl) != FUNCTION_DECL) 47 return 0; 48 exp = lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)); 49 if (exp) 50 return 1; 51 52 return 0; 53} 54 | 36 37tree current_class_type; /* FIXME */ 38 39int 40arm_dllexport_p (decl) 41 tree decl; 42{ 43 tree exp; 44 45 if (TREE_CODE (decl) != VAR_DECL 46 && TREE_CODE (decl) != FUNCTION_DECL) 47 return 0; 48 exp = lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)); 49 if (exp) 50 return 1; 51 52 return 0; 53} 54 |
55/* Return non-zero if DECL is a dllimport'd object. */ | 55/* Return nonzero if DECL is a dllimport'd object. */ |
56 57int 58arm_dllimport_p (decl) 59 tree decl; 60{ 61 tree imp; 62 63 if (TREE_CODE (decl) == FUNCTION_DECL --- 5 unchanged lines hidden (view full) --- 69 return 0; 70 imp = lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl)); 71 if (imp) 72 return 1; 73 74 return 0; 75} 76 | 56 57int 58arm_dllimport_p (decl) 59 tree decl; 60{ 61 tree imp; 62 63 if (TREE_CODE (decl) == FUNCTION_DECL --- 5 unchanged lines hidden (view full) --- 69 return 0; 70 imp = lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl)); 71 if (imp) 72 return 1; 73 74 return 0; 75} 76 |
77/* Return non-zero if SYMBOL is marked as being dllexport'd. */ | 77/* Return nonzero if SYMBOL is marked as being dllexport'd. */ |
78 79int 80arm_dllexport_name_p (symbol) 81 const char * symbol; 82{ 83 return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'e' && symbol[2] == '.'; 84} 85 | 78 79int 80arm_dllexport_name_p (symbol) 81 const char * symbol; 82{ 83 return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'e' && symbol[2] == '.'; 84} 85 |
86/* Return non-zero if SYMBOL is marked as being dllimport'd. */ | 86/* Return nonzero if SYMBOL is marked as being dllimport'd. */ |
87 88int 89arm_dllimport_name_p (symbol) 90 const char * symbol; 91{ 92 return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'i' && symbol[2] == '.'; 93} 94 --- 104 unchanged lines hidden (view full) --- 199 idp = get_identifier (newname); 200 201 newrtl = gen_rtx (MEM, Pmode, 202 gen_rtx (SYMBOL_REF, Pmode, 203 IDENTIFIER_POINTER (idp))); 204 XEXP (DECL_RTL (decl), 0) = newrtl; 205} 206 | 87 88int 89arm_dllimport_name_p (symbol) 90 const char * symbol; 91{ 92 return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'i' && symbol[2] == '.'; 93} 94 --- 104 unchanged lines hidden (view full) --- 199 idp = get_identifier (newname); 200 201 newrtl = gen_rtx (MEM, Pmode, 202 gen_rtx (SYMBOL_REF, Pmode, 203 IDENTIFIER_POINTER (idp))); 204 XEXP (DECL_RTL (decl), 0) = newrtl; 205} 206 |
207/* Cover function to implement ENCODE_SECTION_INFO. */ 208 | |
209void | 207void |
210arm_pe_encode_section_info (decl) | 208arm_pe_encode_section_info (decl, first) |
211 tree decl; | 209 tree decl; |
210 int first ATTRIBUTE_UNUSED; |
|
212{ | 211{ |
213 /* This bit is copied from arm.h. */ | 212 /* This bit is copied from arm_encode_section_info. */ |
214 if (optimize > 0 && TREE_CONSTANT (decl) 215 && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) 216 { 217 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' 218 ? TREE_CST_RTL (decl) : DECL_RTL (decl)); 219 SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; 220 } 221 --- 20 unchanged lines hidden (view full) --- 242 243 XEXP (DECL_RTL (decl), 0) = newrtl; 244 245 /* We previously set TREE_PUBLIC and DECL_EXTERNAL. 246 ??? We leave these alone for now. */ 247 } 248} 249 | 213 if (optimize > 0 && TREE_CONSTANT (decl) 214 && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) 215 { 216 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' 217 ? TREE_CST_RTL (decl) : DECL_RTL (decl)); 218 SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; 219 } 220 --- 20 unchanged lines hidden (view full) --- 241 242 XEXP (DECL_RTL (decl), 0) = newrtl; 243 244 /* We previously set TREE_PUBLIC and DECL_EXTERNAL. 245 ??? We leave these alone for now. */ 246 } 247} 248 |
250/* Cover function for UNIQUE_SECTION. */ 251 | |
252void 253arm_pe_unique_section (decl, reloc) 254 tree decl; 255 int reloc; 256{ 257 int len; 258 const char * name; 259 char * string; 260 const char * prefix; 261 262 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); | 249void 250arm_pe_unique_section (decl, reloc) 251 tree decl; 252 int reloc; 253{ 254 int len; 255 const char * name; 256 char * string; 257 const char * prefix; 258 259 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); |
263 /* Strip off any encoding in fnname. */ 264 STRIP_NAME_ENCODING (name, name); | 260 name = arm_strip_name_encoding (name); |
265 266 /* The object is put in, for example, section .text$foo. 267 The linker will then ultimately place them in .text 268 (everything from the $ on is stripped). */ 269 if (TREE_CODE (decl) == FUNCTION_DECL) 270 prefix = ".text$"; | 261 262 /* The object is put in, for example, section .text$foo. 263 The linker will then ultimately place them in .text 264 (everything from the $ on is stripped). */ 265 if (TREE_CODE (decl) == FUNCTION_DECL) 266 prefix = ".text$"; |
271 else if (DECL_READONLY_SECTION (decl, reloc)) | 267 else if (decl_readonly_section (decl, reloc)) |
272 prefix = ".rdata$"; 273 else 274 prefix = ".data$"; 275 len = strlen (name) + strlen (prefix); 276 string = alloca (len + 1); 277 sprintf (string, "%s%s", prefix, name); 278 279 DECL_SECTION_NAME (decl) = build_string (len, string); 280} | 268 prefix = ".rdata$"; 269 else 270 prefix = ".data$"; 271 len = strlen (name) + strlen (prefix); 272 string = alloca (len + 1); 273 sprintf (string, "%s%s", prefix, name); 274 275 DECL_SECTION_NAME (decl) = build_string (len, string); 276} |