* config/rs6000/rs6000.c (rs6000_option_override_internal): Do not
[official-gcc.git] / gcc / symtab.c
blobc21edcbb79dc8cae717a73e4cdad333fd04882cd
1 /* Symbol table.
2 Copyright (C) 2012 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "tree.h"
26 #include "tree-inline.h"
27 #include "langhooks.h"
28 #include "hashtab.h"
29 #include "ggc.h"
30 #include "cgraph.h"
31 #include "diagnostic.h"
32 #include "timevar.h"
33 #include "lto-streamer.h"
34 #include "rtl.h"
36 const char * const ld_plugin_symbol_resolution_names[]=
38 "",
39 "undef",
40 "prevailing_def",
41 "prevailing_def_ironly",
42 "preempted_reg",
43 "preempted_ir",
44 "resolved_ir",
45 "resolved_exec",
46 "resolved_dyn",
47 "prevailing_def_ironly_exp"
50 /* Hash table used to convert declarations into nodes. */
51 static GTY((param_is (union symtab_node_def))) htab_t symtab_hash;
52 /* Hash table used to convert assembler names into nodes. */
53 static GTY((param_is (union symtab_node_def))) htab_t assembler_name_hash;
55 /* Linked list of symbol table nodes. */
56 symtab_node symtab_nodes;
58 /* The order index of the next symtab node to be created. This is
59 used so that we can sort the cgraph nodes in order by when we saw
60 them, to support -fno-toplevel-reorder. */
61 int symtab_order;
63 /* Returns a hash code for P. */
65 static hashval_t
66 hash_node (const void *p)
68 const_symtab_node n = (const_symtab_node ) p;
69 return (hashval_t) DECL_UID (n->symbol.decl);
73 /* Returns nonzero if P1 and P2 are equal. */
75 static int
76 eq_node (const void *p1, const void *p2)
78 const_symtab_node n1 = (const_symtab_node) p1;
79 const_symtab_node n2 = (const_symtab_node) p2;
80 return DECL_UID (n1->symbol.decl) == DECL_UID (n2->symbol.decl);
83 /* Returns a hash code for P. */
85 static hashval_t
86 hash_node_by_assembler_name (const void *p)
88 const_symtab_node n = (const_symtab_node) p;
89 return (hashval_t) decl_assembler_name_hash (DECL_ASSEMBLER_NAME (n->symbol.decl));
92 /* Returns nonzero if P1 and P2 are equal. */
94 static int
95 eq_assembler_name (const void *p1, const void *p2)
97 const_symtab_node n1 = (const_symtab_node) p1;
98 const_tree name = (const_tree)p2;
99 return (decl_assembler_name_equal (n1->symbol.decl, name));
102 /* Insert NODE to assembler name hash. */
104 static void
105 insert_to_assembler_name_hash (symtab_node node)
107 if (symtab_variable_p (node) && DECL_HARD_REGISTER (node->symbol.decl))
108 return;
109 gcc_checking_assert (!node->symbol.previous_sharing_asm_name
110 && !node->symbol.next_sharing_asm_name);
111 if (assembler_name_hash)
113 void **aslot;
114 tree name = DECL_ASSEMBLER_NAME (node->symbol.decl);
116 aslot = htab_find_slot_with_hash (assembler_name_hash, name,
117 decl_assembler_name_hash (name),
118 INSERT);
119 gcc_assert (*aslot != node);
120 node->symbol.next_sharing_asm_name = (symtab_node)*aslot;
121 if (*aslot != NULL)
122 ((symtab_node)*aslot)->symbol.previous_sharing_asm_name = node;
123 *aslot = node;
128 /* Remove NODE from assembler name hash. */
130 static void
131 unlink_from_assembler_name_hash (symtab_node node)
133 if (assembler_name_hash)
135 if (node->symbol.next_sharing_asm_name)
136 node->symbol.next_sharing_asm_name->symbol.previous_sharing_asm_name
137 = node->symbol.previous_sharing_asm_name;
138 if (node->symbol.previous_sharing_asm_name)
140 node->symbol.previous_sharing_asm_name->symbol.next_sharing_asm_name
141 = node->symbol.next_sharing_asm_name;
143 else
145 tree name = DECL_ASSEMBLER_NAME (node->symbol.decl);
146 void **slot;
147 slot = htab_find_slot_with_hash (assembler_name_hash, name,
148 decl_assembler_name_hash (name),
149 NO_INSERT);
150 gcc_assert (*slot == node);
151 if (!node->symbol.next_sharing_asm_name)
152 htab_clear_slot (assembler_name_hash, slot);
153 else
154 *slot = node->symbol.next_sharing_asm_name;
156 node->symbol.next_sharing_asm_name = NULL;
157 node->symbol.previous_sharing_asm_name = NULL;
161 /* Arrange node to be first in its entry of assembler_name_hash. */
163 void
164 symtab_prevail_in_asm_name_hash (symtab_node node)
166 unlink_from_assembler_name_hash (node);
167 insert_to_assembler_name_hash (node);
171 /* Add node into symbol table. This function is not used directly, but via
172 cgraph/varpool node creation routines. */
174 void
175 symtab_register_node (symtab_node node)
177 struct symtab_node_base key;
178 symtab_node *slot;
180 node->symbol.next = symtab_nodes;
181 node->symbol.previous = NULL;
182 if (symtab_nodes)
183 symtab_nodes->symbol.previous = node;
184 symtab_nodes = node;
186 if (!symtab_hash)
187 symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL);
188 key.decl = node->symbol.decl;
189 slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT);
190 if (*slot == NULL)
191 *slot = node;
193 ipa_empty_ref_list (&node->symbol.ref_list);
195 node->symbol.order = symtab_order++;
197 /* Be sure to do this last; C++ FE might create new nodes via
198 DECL_ASSEMBLER_NAME langhook! */
199 insert_to_assembler_name_hash (node);
202 /* Make NODE to be the one symtab hash is pointing to. Used when reshaping tree
203 of inline clones. */
205 void
206 symtab_insert_node_to_hashtable (symtab_node node)
208 struct symtab_node_base key;
209 symtab_node *slot;
211 if (!symtab_hash)
212 symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL);
213 key.decl = node->symbol.decl;
214 slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT);
215 *slot = node;
218 /* Remove node from symbol table. This function is not used directly, but via
219 cgraph/varpool node removal routines. */
221 void
222 symtab_unregister_node (symtab_node node)
224 void **slot;
225 ipa_remove_all_references (&node->symbol.ref_list);
226 ipa_remove_all_referring (&node->symbol.ref_list);
228 if (node->symbol.same_comdat_group)
230 symtab_node prev;
231 for (prev = node->symbol.same_comdat_group;
232 prev->symbol.same_comdat_group != node;
233 prev = prev->symbol.same_comdat_group)
235 if (node->symbol.same_comdat_group == prev)
236 prev->symbol.same_comdat_group = NULL;
237 else
238 prev->symbol.same_comdat_group = node->symbol.same_comdat_group;
239 node->symbol.same_comdat_group = NULL;
242 if (node->symbol.previous)
243 node->symbol.previous->symbol.next = node->symbol.next;
244 else
245 symtab_nodes = node->symbol.next;
246 if (node->symbol.next)
247 node->symbol.next->symbol.previous = node->symbol.previous;
248 node->symbol.next = NULL;
249 node->symbol.previous = NULL;
251 slot = htab_find_slot (symtab_hash, node, NO_INSERT);
252 if (*slot == node)
254 symtab_node replacement_node = NULL;
255 if (symtab_function_p (node))
256 replacement_node = (symtab_node)cgraph_find_replacement_node (cgraph (node));
257 if (!replacement_node)
258 htab_clear_slot (symtab_hash, slot);
259 else
260 *slot = replacement_node;
262 unlink_from_assembler_name_hash (node);
265 /* Return symbol table node associated with DECL, if any,
266 and NULL otherwise. */
268 symtab_node
269 symtab_get_node (const_tree decl)
271 symtab_node *slot;
272 struct symtab_node_base key;
274 gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
275 || (TREE_CODE (decl) == VAR_DECL
276 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
277 || in_lto_p)));
279 if (!symtab_hash)
280 return NULL;
282 key.decl = CONST_CAST2 (tree, const_tree, decl);
284 slot = (symtab_node *) htab_find_slot (symtab_hash, &key,
285 NO_INSERT);
287 if (slot)
288 return *slot;
289 return NULL;
292 /* Remove symtab NODE from the symbol table. */
294 void
295 symtab_remove_node (symtab_node node)
297 if (symtab_function_p (node))
298 cgraph_remove_node (cgraph (node));
299 else if (symtab_variable_p (node))
300 varpool_remove_node (varpool (node));
303 /* Initalize asm name hash unless. */
305 void
306 symtab_initialize_asm_name_hash (void)
308 symtab_node node;
309 if (!assembler_name_hash)
311 assembler_name_hash =
312 htab_create_ggc (10, hash_node_by_assembler_name, eq_assembler_name,
313 NULL);
314 FOR_EACH_SYMBOL (node)
315 insert_to_assembler_name_hash (node);
319 /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
320 Return NULL if there's no such node. */
322 symtab_node
323 symtab_node_for_asm (const_tree asmname)
325 symtab_node node;
326 void **slot;
328 symtab_initialize_asm_name_hash ();
329 slot = htab_find_slot_with_hash (assembler_name_hash, asmname,
330 decl_assembler_name_hash (asmname),
331 NO_INSERT);
333 if (slot)
335 node = (symtab_node) *slot;
336 return node;
338 return NULL;
341 /* Set the DECL_ASSEMBLER_NAME and update symtab hashtables. */
343 void
344 change_decl_assembler_name (tree decl, tree name)
346 symtab_node node = NULL;
348 /* We can have user ASM names on things, like global register variables, that
349 are not in the symbol table. */
350 if ((TREE_CODE (decl) == VAR_DECL
351 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
352 || TREE_CODE (decl) == FUNCTION_DECL)
353 node = symtab_get_node (decl);
354 if (!DECL_ASSEMBLER_NAME_SET_P (decl))
356 SET_DECL_ASSEMBLER_NAME (decl, name);
357 if (node)
358 insert_to_assembler_name_hash (node);
360 else
362 if (name == DECL_ASSEMBLER_NAME (decl))
363 return;
365 if (node)
366 unlink_from_assembler_name_hash (node);
367 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
368 && DECL_RTL_SET_P (decl))
369 warning (0, "%D renamed after being referenced in assembly", decl);
371 SET_DECL_ASSEMBLER_NAME (decl, name);
372 if (node)
373 insert_to_assembler_name_hash (node);
377 /* Add NEW_ to the same comdat group that OLD is in. */
379 void
380 symtab_add_to_same_comdat_group (symtab_node new_node,
381 symtab_node old_node)
383 gcc_assert (DECL_ONE_ONLY (old_node->symbol.decl));
384 gcc_assert (!new_node->symbol.same_comdat_group);
385 gcc_assert (new_node != old_node);
387 DECL_COMDAT_GROUP (new_node->symbol.decl) = DECL_COMDAT_GROUP (old_node->symbol.decl);
388 new_node->symbol.same_comdat_group = old_node;
389 if (!old_node->symbol.same_comdat_group)
390 old_node->symbol.same_comdat_group = new_node;
391 else
393 symtab_node n;
394 for (n = old_node->symbol.same_comdat_group;
395 n->symbol.same_comdat_group != old_node;
396 n = n->symbol.same_comdat_group)
398 n->symbol.same_comdat_group = new_node;
402 /* Dissolve the same_comdat_group list in which NODE resides. */
404 void
405 symtab_dissolve_same_comdat_group_list (symtab_node node)
407 symtab_node n = node, next;
409 if (!node->symbol.same_comdat_group)
410 return;
413 next = n->symbol.same_comdat_group;
414 n->symbol.same_comdat_group = NULL;
415 n = next;
417 while (n != node);
420 /* Return printable assembler name of NODE.
421 This function is used only for debugging. When assembler name
422 is unknown go with identifier name. */
424 const char *
425 symtab_node_asm_name (symtab_node node)
427 if (!DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
428 return lang_hooks.decl_printable_name (node->symbol.decl, 2);
429 return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl));
432 /* Return printable identifier name. */
434 const char *
435 symtab_node_name (symtab_node node)
437 return lang_hooks.decl_printable_name (node->symbol.decl, 2);
440 static const char * const symtab_type_names[] = {"symbol", "function", "variable"};
442 /* Dump base fields of symtab nodes. Not to be used directly. */
444 void
445 dump_symtab_base (FILE *f, symtab_node node)
447 static const char * const visibility_types[] = {
448 "default", "protected", "hidden", "internal"
451 fprintf (f, "%s/%i (%s)",
452 symtab_node_asm_name (node),
453 node->symbol.order,
454 symtab_node_name (node));
455 dump_addr (f, " @", (void *)node);
456 fprintf (f, "\n Type: %s\n", symtab_type_names[node->symbol.type]);
457 fprintf (f, " Visibility:");
459 if (node->symbol.in_other_partition)
460 fprintf (f, " in_other_partition");
461 if (node->symbol.used_from_other_partition)
462 fprintf (f, " used_from_other_partition");
463 if (node->symbol.force_output)
464 fprintf (f, " force_output");
465 if (node->symbol.resolution != LDPR_UNKNOWN)
466 fprintf (f, " %s",
467 ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
468 if (TREE_ASM_WRITTEN (node->symbol.decl))
469 fprintf (f, " asm_written");
470 if (DECL_EXTERNAL (node->symbol.decl))
471 fprintf (f, " external");
472 if (TREE_PUBLIC (node->symbol.decl))
473 fprintf (f, " public");
474 if (DECL_COMMON (node->symbol.decl))
475 fprintf (f, " common");
476 if (DECL_WEAK (node->symbol.decl))
477 fprintf (f, " weak");
478 if (DECL_DLLIMPORT_P (node->symbol.decl))
479 fprintf (f, " dll_import");
480 if (DECL_COMDAT (node->symbol.decl))
481 fprintf (f, " comdat");
482 if (DECL_COMDAT_GROUP (node->symbol.decl))
483 fprintf (f, " comdat_group:%s",
484 IDENTIFIER_POINTER (DECL_COMDAT_GROUP (node->symbol.decl)));
485 if (DECL_ONE_ONLY (node->symbol.decl))
486 fprintf (f, " one_only");
487 if (DECL_SECTION_NAME (node->symbol.decl))
488 fprintf (f, " section_name:%s",
489 TREE_STRING_POINTER (DECL_SECTION_NAME (node->symbol.decl)));
490 if (DECL_VISIBILITY_SPECIFIED (node->symbol.decl))
491 fprintf (f, " visibility_specified");
492 if (DECL_VISIBILITY (node->symbol.decl))
493 fprintf (f, " visibility:%s",
494 visibility_types [DECL_VISIBILITY (node->symbol.decl)]);
495 if (DECL_VIRTUAL_P (node->symbol.decl))
496 fprintf (f, " virtual");
497 if (DECL_ARTIFICIAL (node->symbol.decl))
498 fprintf (f, " artificial");
499 if (TREE_CODE (node->symbol.decl) == FUNCTION_DECL)
501 if (DECL_STATIC_CONSTRUCTOR (node->symbol.decl))
502 fprintf (f, " constructor");
503 if (DECL_STATIC_DESTRUCTOR (node->symbol.decl))
504 fprintf (f, " destructor");
506 fprintf (f, "\n");
508 if (node->symbol.same_comdat_group)
509 fprintf (f, " Same comdat group as: %s/%i\n",
510 symtab_node_asm_name (node->symbol.same_comdat_group),
511 node->symbol.same_comdat_group->symbol.order);
512 if (node->symbol.next_sharing_asm_name)
513 fprintf (f, " next sharing asm name: %i\n",
514 node->symbol.next_sharing_asm_name->symbol.order);
515 if (node->symbol.previous_sharing_asm_name)
516 fprintf (f, " previous sharing asm name: %i\n",
517 node->symbol.previous_sharing_asm_name->symbol.order);
519 if (node->symbol.address_taken)
520 fprintf (f, " Address is taken.\n");
521 if (node->symbol.aux)
523 fprintf (f, " Aux:");
524 dump_addr (f, " @", (void *)node->symbol.aux);
527 fprintf (f, " References: ");
528 ipa_dump_references (f, &node->symbol.ref_list);
529 fprintf (f, " Referring: ");
530 ipa_dump_referring (f, &node->symbol.ref_list);
531 if (node->symbol.lto_file_data)
532 fprintf (f, " Read from file: %s\n",
533 node->symbol.lto_file_data->file_name);
536 /* Dump symtab node. */
538 void
539 dump_symtab_node (FILE *f, symtab_node node)
541 if (symtab_function_p (node))
542 dump_cgraph_node (f, cgraph (node));
543 else if (symtab_variable_p (node))
544 dump_varpool_node (f, varpool (node));
547 /* Dump symbol table. */
549 void
550 dump_symtab (FILE *f)
552 symtab_node node;
553 fprintf (f, "Symbol table:\n\n");
554 FOR_EACH_SYMBOL (node)
555 dump_symtab_node (f, node);
558 /* Dump symtab node NODE to stderr. */
560 DEBUG_FUNCTION void
561 debug_symtab_node (symtab_node node)
563 dump_symtab_node (stderr, node);
566 /* Dump symbol table to stderr. */
568 DEBUG_FUNCTION void
569 debug_symtab (void)
571 dump_symtab (stderr);
574 /* Verify common part of symtab nodes. */
576 DEBUG_FUNCTION bool
577 verify_symtab_base (symtab_node node)
579 bool error_found = false;
580 symtab_node hashed_node;
582 if (symtab_function_p (node))
584 if (TREE_CODE (node->symbol.decl) != FUNCTION_DECL)
586 error ("function symbol is not function");
587 error_found = true;
590 else if (symtab_variable_p (node))
592 if (TREE_CODE (node->symbol.decl) != VAR_DECL)
594 error ("variable symbol is not variable");
595 error_found = true;
598 else
600 error ("node has unknown type");
601 error_found = true;
604 hashed_node = symtab_get_node (node->symbol.decl);
605 if (!hashed_node)
607 error ("node not found in symtab decl hashtable");
608 error_found = true;
610 if (assembler_name_hash)
612 hashed_node = symtab_node_for_asm (DECL_ASSEMBLER_NAME (node->symbol.decl));
613 if (hashed_node && hashed_node->symbol.previous_sharing_asm_name)
615 error ("assembler name hash list corrupted");
616 error_found = true;
618 while (hashed_node)
620 if (hashed_node == node)
621 break;
622 hashed_node = hashed_node->symbol.next_sharing_asm_name;
624 if (!hashed_node
625 && !(symtab_variable_p (node) || DECL_HARD_REGISTER (node->symbol.decl)))
627 error ("node not found in symtab assembler name hash");
628 error_found = true;
631 if (node->symbol.previous_sharing_asm_name
632 && node->symbol.previous_sharing_asm_name->symbol.next_sharing_asm_name != node)
634 error ("double linked list of assembler names corrupted");
636 if (node->symbol.same_comdat_group)
638 symtab_node n = node->symbol.same_comdat_group;
640 if (!DECL_ONE_ONLY (n->symbol.decl))
642 error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
643 error_found = true;
645 if (n->symbol.type != node->symbol.type)
647 error ("mixing different types of symbol in same comdat groups is not supported");
648 error_found = true;
650 if (n == node)
652 error ("node is alone in a comdat group");
653 error_found = true;
657 if (!n->symbol.same_comdat_group)
659 error ("same_comdat_group is not a circular list");
660 error_found = true;
661 break;
663 n = n->symbol.same_comdat_group;
665 while (n != node);
667 return error_found;
670 /* Verify consistency of NODE. */
672 DEBUG_FUNCTION void
673 verify_symtab_node (symtab_node node)
675 if (seen_error ())
676 return;
678 timevar_push (TV_CGRAPH_VERIFY);
679 if (symtab_function_p (node))
680 verify_cgraph_node (cgraph (node));
681 else
682 if (verify_symtab_base (node))
684 dump_symtab_node (stderr, node);
685 internal_error ("verify_symtab_node failed");
687 timevar_pop (TV_CGRAPH_VERIFY);
690 /* Verify symbol table for internal consistency. */
692 DEBUG_FUNCTION void
693 verify_symtab (void)
695 symtab_node node;
696 FOR_EACH_SYMBOL (node)
697 verify_symtab_node (node);
700 /* Return true when RESOLUTION indicate that linker will use
701 the symbol from non-LTO object files. */
703 bool
704 resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution)
706 return (resolution == LDPR_PREVAILING_DEF
707 || resolution == LDPR_PREEMPTED_REG
708 || resolution == LDPR_RESOLVED_EXEC
709 || resolution == LDPR_RESOLVED_DYN);
712 /* Return true when NODE is known to be used from other (non-LTO) object file.
713 Known only when doing LTO via linker plugin. */
715 bool
716 symtab_used_from_object_file_p (symtab_node node)
718 if (!TREE_PUBLIC (node->symbol.decl) || DECL_EXTERNAL (node->symbol.decl))
719 return false;
720 if (resolution_used_from_other_file_p (node->symbol.resolution))
721 return true;
722 return false;
725 /* Make DECL local. FIXME: We shouldn't need to mess with rtl this early,
726 but other code such as notice_global_symbol generates rtl. */
727 void
728 symtab_make_decl_local (tree decl)
730 rtx rtl, symbol;
732 if (TREE_CODE (decl) == VAR_DECL)
733 DECL_COMMON (decl) = 0;
734 else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
736 if (DECL_ONE_ONLY (decl) || DECL_COMDAT (decl))
738 /* It is possible that we are linking against library defining same COMDAT
739 function. To avoid conflict we need to rename our local name of the
740 function just in the case WHOPR partitioning decide to make it hidden
741 to avoid cross partition references. */
742 if (flag_wpa)
744 const char *old_name;
745 symtab_node node = symtab_get_node (decl);
746 old_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
747 change_decl_assembler_name (decl,
748 clone_function_name (decl, "local"));
749 if (node->symbol.lto_file_data)
750 lto_record_renamed_decl (node->symbol.lto_file_data,
751 old_name,
752 IDENTIFIER_POINTER
753 (DECL_ASSEMBLER_NAME (decl)));
755 DECL_SECTION_NAME (decl) = 0;
756 DECL_COMDAT (decl) = 0;
758 DECL_COMDAT_GROUP (decl) = 0;
759 DECL_WEAK (decl) = 0;
760 DECL_EXTERNAL (decl) = 0;
761 DECL_VISIBILITY_SPECIFIED (decl) = 0;
762 DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
763 TREE_PUBLIC (decl) = 0;
764 DECL_VISIBILITY_SPECIFIED (decl) = 0;
765 DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
766 if (!DECL_RTL_SET_P (decl))
767 return;
769 /* Update rtl flags. */
770 make_decl_rtl (decl);
772 rtl = DECL_RTL (decl);
773 if (!MEM_P (rtl))
774 return;
776 symbol = XEXP (rtl, 0);
777 if (GET_CODE (symbol) != SYMBOL_REF)
778 return;
780 SYMBOL_REF_WEAK (symbol) = DECL_WEAK (decl);
782 #include "gt-symtab.h"