OSDN Git Service

* ipa-struct-reorg.c (update_cgraph_with_malloc_call): Fix profile
[pf3gnuchains/gcc-fork.git] / gcc / lto-symtab.c
1 /* LTO symbol table.
2    Copyright 2009 Free Software Foundation, Inc.
3    Contributed by CodeSourcery, Inc.
4
5 This file is part of GCC.
6
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.
11
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.
16
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/>.  */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "toplev.h"
25 #include "tree.h"
26 #include "gimple.h"
27 #include "ggc.h"        /* lambda.h needs this */
28 #include "lambda.h"     /* gcd */
29 #include "hashtab.h"
30 #include "plugin-api.h"
31 #include "lto-streamer.h"
32
33 /* Vector to keep track of external variables we've seen so far.  */
34 VEC(tree,gc) *lto_global_var_decls;
35
36 /* Symbol table entry.  */
37
38 struct GTY(()) lto_symtab_entry_def
39 {
40   /* The symbol table entry key, an IDENTIFIER.  */
41   tree id;
42   /* The symbol table entry, a DECL.  */
43   tree decl;
44   /* The cgraph node if decl is a function decl.  Filled in during the
45      merging process.  */
46   struct cgraph_node *node;
47   /* LTO file-data and symbol resolution for this decl.  */
48   struct lto_file_decl_data * GTY((skip (""))) file_data;
49   enum ld_plugin_symbol_resolution resolution;
50   /* Pointer to the next entry with the same key.  Before decl merging
51      this links all symbols from the different TUs.  After decl merging
52      this links merged but incompatible decls, thus all prevailing ones
53      remaining.  */
54   struct lto_symtab_entry_def *next;
55 };
56 typedef struct lto_symtab_entry_def *lto_symtab_entry_t;
57
58 /* A poor man's symbol table. This hashes identifier to prevailing DECL
59    if there is one. */
60
61 static GTY ((if_marked ("lto_symtab_entry_marked_p"),
62              param_is (struct lto_symtab_entry_def)))
63   htab_t lto_symtab_identifiers;
64
65 /* Return the hash value of an lto_symtab_entry_t object pointed to by P.  */
66
67 static hashval_t
68 lto_symtab_entry_hash (const void *p)
69 {
70   const struct lto_symtab_entry_def *base =
71     (const struct lto_symtab_entry_def *) p;
72   return htab_hash_string (IDENTIFIER_POINTER (base->id));
73 }
74
75 /* Return non-zero if P1 and P2 points to lto_symtab_entry_def structs
76    corresponding to the same symbol.  */
77
78 static int
79 lto_symtab_entry_eq (const void *p1, const void *p2)
80 {
81   const struct lto_symtab_entry_def *base1 =
82      (const struct lto_symtab_entry_def *) p1;
83   const struct lto_symtab_entry_def *base2 =
84      (const struct lto_symtab_entry_def *) p2;
85   return (base1->id == base2->id);
86 }
87
88 /* Returns non-zero if P points to an lto_symtab_entry_def struct that needs
89    to be marked for GC.  */ 
90
91 static int
92 lto_symtab_entry_marked_p (const void *p)
93 {
94   const struct lto_symtab_entry_def *base =
95      (const struct lto_symtab_entry_def *) p;
96
97   /* Keep this only if the decl or the chain is marked.  */
98   return (ggc_marked_p (base->decl)
99           || (base->next && ggc_marked_p (base->next)));
100 }
101
102 /* Lazily initialize resolution hash tables.  */
103
104 static void
105 lto_symtab_maybe_init_hash_table (void)
106 {
107   if (lto_symtab_identifiers)
108     return;
109
110   lto_symtab_identifiers =
111     htab_create_ggc (1021, lto_symtab_entry_hash,
112                      lto_symtab_entry_eq, NULL);
113 }
114
115 /* Registers DECL with the LTO symbol table as having resolution RESOLUTION
116    and read from FILE_DATA. */
117
118 void
119 lto_symtab_register_decl (tree decl,
120                           ld_plugin_symbol_resolution_t resolution,
121                           struct lto_file_decl_data *file_data)
122 {
123   lto_symtab_entry_t new_entry;
124   void **slot;
125
126   /* Check that declarations reaching this function do not have
127      properties inconsistent with having external linkage.  If any of
128      these asertions fail, then the object file reader has failed to
129      detect these cases and issue appropriate error messages.  */
130   gcc_assert (decl
131               && TREE_PUBLIC (decl)
132               && (TREE_CODE (decl) == VAR_DECL
133                   || TREE_CODE (decl) == FUNCTION_DECL)
134               && DECL_ASSEMBLER_NAME_SET_P (decl));
135   if (TREE_CODE (decl) == VAR_DECL
136       && DECL_INITIAL (decl))
137     gcc_assert (!DECL_EXTERNAL (decl)
138                 || (TREE_STATIC (decl) && TREE_READONLY (decl)));
139   if (TREE_CODE (decl) == FUNCTION_DECL)
140     gcc_assert (!DECL_ABSTRACT (decl));
141
142   new_entry = GGC_CNEW (struct lto_symtab_entry_def);
143   new_entry->id = DECL_ASSEMBLER_NAME (decl);
144   new_entry->decl = decl;
145   new_entry->resolution = resolution;
146   new_entry->file_data = file_data;
147
148   lto_symtab_maybe_init_hash_table ();
149   slot = htab_find_slot (lto_symtab_identifiers, new_entry, INSERT);
150   new_entry->next = (lto_symtab_entry_t) *slot;
151   *slot = new_entry;
152 }
153
154 /* Get the lto_symtab_entry_def struct associated with ID
155    if there is one.  */
156
157 static lto_symtab_entry_t
158 lto_symtab_get (tree id)
159 {
160   struct lto_symtab_entry_def temp;
161   void **slot;
162
163   lto_symtab_maybe_init_hash_table ();
164   temp.id = id;
165   slot = htab_find_slot (lto_symtab_identifiers, &temp, NO_INSERT);
166   return slot ? (lto_symtab_entry_t) *slot : NULL;
167 }
168
169 /* Get the linker resolution for DECL.  */
170
171 enum ld_plugin_symbol_resolution
172 lto_symtab_get_resolution (tree decl)
173 {
174   lto_symtab_entry_t e;
175
176   gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
177
178   e = lto_symtab_get (DECL_ASSEMBLER_NAME (decl));
179   while (e && e->decl != decl)
180     e = e->next;
181   if (!e)
182     return LDPR_UNKNOWN;
183
184   return e->resolution;
185 }
186
187
188 /* Replace the cgraph node NODE with PREVAILING_NODE in the cgraph, merging
189    all edges and removing the old node.  */
190
191 static void
192 lto_cgraph_replace_node (struct cgraph_node *node,
193                          struct cgraph_node *prevailing_node)
194 {
195   struct cgraph_edge *e, *next;
196
197   /* Merge node flags.  */
198   if (node->needed)
199     cgraph_mark_needed_node (prevailing_node);
200   if (node->reachable)
201     cgraph_mark_reachable_node (prevailing_node);
202   if (node->address_taken)
203     {
204       gcc_assert (!prevailing_node->global.inlined_to);
205       cgraph_mark_address_taken_node (prevailing_node);
206     }
207
208   /* Redirect all incoming edges.  */
209   for (e = node->callers; e; e = next)
210     {
211       next = e->next_caller;
212       cgraph_redirect_edge_callee (e, prevailing_node);
213     }
214
215   /* There are not supposed to be any outgoing edges from a node we
216      replace.  Still this can happen for multiple instances of weak
217      functions.  */
218   for (e = node->callees; e; e = next)
219     {
220       next = e->next_callee;
221       cgraph_remove_edge (e);
222     }
223
224   /* Finally remove the replaced node.  */
225   cgraph_remove_node (node);
226 }
227
228 /* Merge two variable or function symbol table entries PREVAILING and ENTRY.
229    Return false if the symbols are not fully compatible and a diagnostic
230    should be emitted.  */
231
232 static bool
233 lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry)
234 {
235   tree prevailing_decl = prevailing->decl;
236   tree decl = entry->decl;
237   tree prevailing_type, type;
238
239   /* Merge decl state in both directions, we may still end up using
240      the new decl.  */
241   TREE_ADDRESSABLE (prevailing_decl) |= TREE_ADDRESSABLE (decl);
242   TREE_ADDRESSABLE (decl) |= TREE_ADDRESSABLE (prevailing_decl);
243
244   /* The linker may ask us to combine two incompatible symbols.
245      Detect this case and notify the caller of required diagnostics.  */
246
247   if (TREE_CODE (decl) == FUNCTION_DECL)
248     {
249       if (TREE_TYPE (prevailing_decl) != TREE_TYPE (decl))
250         /* If we don't have a merged type yet...sigh.  The linker
251            wouldn't complain if the types were mismatched, so we
252            probably shouldn't either.  Just use the type from
253            whichever decl appears to be associated with the
254            definition.  If for some odd reason neither decl is, the
255            older one wins.  */
256         (void) 0;
257
258       return true;
259     }
260
261   /* Now we exclusively deal with VAR_DECLs.  */
262
263   /* Sharing a global symbol is a strong hint that two types are
264      compatible.  We could use this information to complete
265      incomplete pointed-to types more aggressively here, ignoring
266      mismatches in both field and tag names.  It's difficult though
267      to guarantee that this does not have side-effects on merging
268      more compatible types from other translation units though.  */
269
270   /* We can tolerate differences in type qualification, the
271      qualification of the prevailing definition will prevail.
272      ???  In principle we might want to only warn for structurally
273      incompatible types here, but unless we have protective measures
274      for TBAA in place that would hide useful information.  */
275   prevailing_type = TYPE_MAIN_VARIANT (TREE_TYPE (prevailing_decl));
276   type = TYPE_MAIN_VARIANT (TREE_TYPE (decl));
277
278   /* We have to register and fetch canonical types here as the global
279      fixup process didn't yet run.  */
280   prevailing_type = gimple_register_type (prevailing_type);
281   type = gimple_register_type (type);
282   if (prevailing_type != type)
283     {
284       if (COMPLETE_TYPE_P (type))
285         return false;
286
287       /* If type is incomplete then avoid warnings in the cases
288          that TBAA handles just fine.  */
289
290       if (TREE_CODE (prevailing_type) != TREE_CODE (type))
291         return false;
292
293       if (TREE_CODE (prevailing_type) == ARRAY_TYPE)
294         {
295           tree tem1 = TREE_TYPE (prevailing_type);
296           tree tem2 = TREE_TYPE (type);
297           while (TREE_CODE (tem1) == ARRAY_TYPE
298                  && TREE_CODE (tem2) == ARRAY_TYPE)
299             {
300               tem1 = TREE_TYPE (tem1);
301               tem2 = TREE_TYPE (tem2);
302             }
303
304           if (TREE_CODE (tem1) != TREE_CODE (tem2))
305             return false;
306
307           if (gimple_register_type (tem1) != gimple_register_type (tem2))
308             return false;
309         }
310
311       /* Fallthru.  Compatible enough.  */
312     }
313
314   /* ???  We might want to emit a warning here if type qualification
315      differences were spotted.  Do not do this unconditionally though.  */
316
317   /* There is no point in comparing too many details of the decls here.
318      The type compatibility checks or the completing of types has properly
319      dealt with most issues.  */
320
321   /* The following should all not invoke fatal errors as in non-LTO
322      mode the linker wouldn't complain either.  Just emit warnings.  */
323
324   /* Report a warning if user-specified alignments do not match.  */
325   if ((DECL_USER_ALIGN (prevailing_decl) && DECL_USER_ALIGN (decl))
326       && DECL_ALIGN (prevailing_decl) < DECL_ALIGN (decl))
327     return false;
328
329   return true;
330 }
331
332 /* Return true if the symtab entry E can be replaced by another symtab
333    entry.  */
334
335 static bool
336 lto_symtab_resolve_replaceable_p (lto_symtab_entry_t e)
337 {
338   if (DECL_EXTERNAL (e->decl)
339       || DECL_COMDAT (e->decl)
340       || DECL_WEAK (e->decl))
341     return true;
342
343   if (TREE_CODE (e->decl) == VAR_DECL)
344     return (DECL_COMMON (e->decl)
345             || (!flag_no_common && !DECL_INITIAL (e->decl)));
346
347   return false;
348 }
349
350 /* Return true if the symtab entry E can be the prevailing one.  */
351
352 static bool
353 lto_symtab_resolve_can_prevail_p (lto_symtab_entry_t e)
354 {
355   if (!TREE_STATIC (e->decl))
356     return false;
357
358   /* For functions we need a non-discarded body.  */
359   if (TREE_CODE (e->decl) == FUNCTION_DECL)
360     return (e->node && e->node->analyzed);
361
362   /* A variable should have a size.  */
363   else if (TREE_CODE (e->decl) == VAR_DECL)
364     return (DECL_SIZE (e->decl) != NULL_TREE
365             /* The C++ frontend retains TREE_STATIC on the declaration
366                of foo_ in struct Foo { static Foo *foo_; }; but it is
367                not a definition.  g++.dg/lto/20090315_0.C.  */
368             && !DECL_EXTERNAL (e->decl));
369
370   gcc_unreachable ();
371 }
372
373 /* Resolve the symbol with the candidates in the chain *SLOT and store
374    their resolutions.  */
375
376 static void
377 lto_symtab_resolve_symbols (void **slot)
378 {
379   lto_symtab_entry_t e;
380   lto_symtab_entry_t prevailing = NULL;
381
382   /* Always set e->node so that edges are updated to reflect decl merging. */
383   for (e = (lto_symtab_entry_t) *slot; e; e = e->next)
384     {
385       if (TREE_CODE (e->decl) == FUNCTION_DECL)
386         e->node = cgraph_get_node (e->decl);
387     }
388
389   e = (lto_symtab_entry_t) *slot;
390
391   /* If the chain is already resolved there is nothing else to do.  */
392   if (e->resolution != LDPR_UNKNOWN)
393     return;
394
395   /* Find the single non-replaceable prevailing symbol and
396      diagnose ODR violations.  */
397   for (e = (lto_symtab_entry_t) *slot; e; e = e->next)
398     {
399       if (!lto_symtab_resolve_can_prevail_p (e))
400         {
401           e->resolution = LDPR_RESOLVED_IR;
402           continue;
403         }
404
405       /* Set a default resolution - the final prevailing one will get
406          adjusted later.  */
407       e->resolution = LDPR_PREEMPTED_IR;
408       if (!lto_symtab_resolve_replaceable_p (e))
409         {
410           if (prevailing)
411             {
412               error_at (DECL_SOURCE_LOCATION (e->decl),
413                         "%qD has already been defined", e->decl);
414               inform (DECL_SOURCE_LOCATION (prevailing->decl),
415                       "previously defined here");
416             }
417           prevailing = e;
418         }
419     }
420   if (prevailing)
421     goto found;
422
423   /* Do a second round choosing one from the replaceable prevailing decls.  */
424   for (e = (lto_symtab_entry_t) *slot; e; e = e->next)
425     {
426       if (e->resolution != LDPR_PREEMPTED_IR)
427         continue;
428
429       /* Choose the first function that can prevail as prevailing.  */
430       if (TREE_CODE (e->decl) == FUNCTION_DECL)
431         {
432           prevailing = e;
433           break;
434         }
435
436       /* From variables that can prevail choose the largest one.  */
437       if (!prevailing
438           || tree_int_cst_lt (DECL_SIZE (prevailing->decl),
439                               DECL_SIZE (e->decl)))
440         prevailing = e;
441     }
442
443   if (!prevailing)
444     return;
445
446 found:
447   if (TREE_CODE (prevailing->decl) == VAR_DECL
448       && TREE_READONLY (prevailing->decl))
449     prevailing->resolution = LDPR_PREVAILING_DEF_IRONLY;
450   else
451     prevailing->resolution = LDPR_PREVAILING_DEF;
452 }
453
454 /* Merge all decls in the symbol table chain to the prevailing decl and
455    issue diagnostics about type mismatches.  */
456
457 static void
458 lto_symtab_merge_decls_2 (void **slot)
459 {
460   lto_symtab_entry_t prevailing, e;
461   VEC(tree, heap) *mismatches = NULL;
462   unsigned i;
463   tree decl;
464   bool diagnosed_p = false;
465
466   /* Nothing to do for a single entry.  */
467   prevailing = (lto_symtab_entry_t) *slot;
468   if (!prevailing->next)
469     return;
470
471   /* Try to merge each entry with the prevailing one.  */
472   for (e = prevailing->next; e; e = e->next)
473     {
474       if (!lto_symtab_merge (prevailing, e))
475         VEC_safe_push (tree, heap, mismatches, e->decl);
476     }
477   if (VEC_empty (tree, mismatches))
478     return;
479
480   /* Diagnose all mismatched re-declarations.  */
481   for (i = 0; VEC_iterate (tree, mismatches, i, decl); ++i)
482     {
483       if (TREE_TYPE (prevailing->decl) != TREE_TYPE (decl))
484         diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
485                                    "type of %qD does not match original "
486                                    "declaration", decl);
487
488       else if ((DECL_USER_ALIGN (prevailing->decl) && DECL_USER_ALIGN (decl))
489                && DECL_ALIGN (prevailing->decl) < DECL_ALIGN (decl))
490         {
491           diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
492                                      "alignment of %qD is bigger than "
493                                      "original declaration", decl);
494         }
495     }
496   if (diagnosed_p)
497     inform (DECL_SOURCE_LOCATION (prevailing->decl),
498             "previously declared here");
499
500   VEC_free (tree, heap, mismatches);
501 }
502
503 /* Helper to process the decl chain for the symbol table entry *SLOT.  */
504
505 static int
506 lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED)
507 {
508   lto_symtab_entry_t e, prevailing;
509   bool diagnosed_p = false;
510
511   /* Compute the symbol resolutions.  This is a no-op when using the
512      linker plugin.  */
513   lto_symtab_resolve_symbols (slot);
514
515   /* Find the prevailing decl.  */
516   for (prevailing = (lto_symtab_entry_t) *slot;
517        prevailing
518        && prevailing->resolution != LDPR_PREVAILING_DEF_IRONLY
519        && prevailing->resolution != LDPR_PREVAILING_DEF;
520        prevailing = prevailing->next)
521     ;
522
523   /* Assert it's the only one.  */
524   if (prevailing)
525     for (e = prevailing->next; e; e = e->next)
526       gcc_assert (e->resolution != LDPR_PREVAILING_DEF_IRONLY
527                   && e->resolution != LDPR_PREVAILING_DEF);
528
529   /* If there's not a prevailing symbol yet it's an external reference.
530      Happens a lot during ltrans.  Choose the first symbol with a
531      cgraph or a varpool node.  */
532   if (!prevailing)
533     {
534       prevailing = (lto_symtab_entry_t) *slot;
535       /* For functions choose one with a cgraph node.  */
536       if (TREE_CODE (prevailing->decl) == FUNCTION_DECL)
537         while (!prevailing->node
538                && prevailing->next)
539           prevailing = prevailing->next;
540       /* We do not stream varpool nodes, so the first decl has to
541          be good enough for now.
542          ???  For QOI choose a variable with readonly initializer
543          if there is one.  This matches C++
544          struct Foo { static const int i = 1; }; without a real
545          definition.  */
546       if (TREE_CODE (prevailing->decl) == VAR_DECL)
547         while (!(TREE_READONLY (prevailing->decl)
548                  && DECL_INITIAL (prevailing->decl))
549                && prevailing->next)
550           prevailing = prevailing->next;
551     }
552
553   /* Move it first in the list.  */
554   if ((lto_symtab_entry_t) *slot != prevailing)
555     {
556       for (e = (lto_symtab_entry_t) *slot; e->next != prevailing; e = e->next)
557         ;
558       e->next = prevailing->next;
559       prevailing->next = (lto_symtab_entry_t) *slot;
560       *slot = (void *) prevailing;
561     }
562
563   /* Record the prevailing variable.  */
564   if (TREE_CODE (prevailing->decl) == VAR_DECL)
565     VEC_safe_push (tree, gc, lto_global_var_decls, prevailing->decl);
566
567   /* Diagnose mismatched objects.  */
568   for (e = prevailing->next; e; e = e->next)
569     {
570       if (TREE_CODE (prevailing->decl) == TREE_CODE (e->decl))
571         continue;
572
573       switch (TREE_CODE (prevailing->decl))
574         {
575         case VAR_DECL:
576           gcc_assert (TREE_CODE (e->decl) == FUNCTION_DECL);
577           error_at (DECL_SOURCE_LOCATION (e->decl),
578                     "variable %qD redeclared as function", prevailing->decl);
579           break;
580
581         case FUNCTION_DECL:
582           gcc_assert (TREE_CODE (e->decl) == VAR_DECL);
583           error_at (DECL_SOURCE_LOCATION (e->decl),
584                     "function %qD redeclared as variable", prevailing->decl);
585           break;
586
587         default:
588           gcc_unreachable ();
589         }
590
591       diagnosed_p = true;
592     }
593   if (diagnosed_p)
594       inform (DECL_SOURCE_LOCATION (prevailing->decl),
595               "previously declared here");
596
597   /* Register and adjust types of the entries.  */
598   for (e = (lto_symtab_entry_t) *slot; e; e = e->next)
599     TREE_TYPE (e->decl) = gimple_register_type (TREE_TYPE (e->decl));
600
601   /* Merge the chain to the single prevailing decl and diagnose
602      mismatches.  */
603   lto_symtab_merge_decls_2 (slot);
604
605   /* Drop all but the prevailing decl from the symtab.  */
606   if (TREE_CODE (prevailing->decl) != FUNCTION_DECL)
607     prevailing->next = NULL;
608
609   return 1;
610 }
611
612 /* Resolve and merge all symbol table chains to a prevailing decl.  */
613
614 void
615 lto_symtab_merge_decls (void)
616 {
617   lto_symtab_maybe_init_hash_table ();
618   htab_traverse (lto_symtab_identifiers, lto_symtab_merge_decls_1, NULL);
619 }
620
621 /* Helper to process the decl chain for the symbol table entry *SLOT.  */
622
623 static int
624 lto_symtab_merge_cgraph_nodes_1 (void **slot, void *data ATTRIBUTE_UNUSED)
625 {
626   lto_symtab_entry_t e, prevailing = (lto_symtab_entry_t) *slot;
627
628   if (!prevailing->next)
629     return 1;
630
631   gcc_assert (TREE_CODE (prevailing->decl) == FUNCTION_DECL);
632
633   /* Replace the cgraph node of each entry with the prevailing one.  */
634   for (e = prevailing->next; e; e = e->next)
635     {
636       if (e->node != NULL)
637         lto_cgraph_replace_node (e->node, prevailing->node);
638     }
639
640   /* Drop all but the prevailing decl from the symtab.  */
641   prevailing->next = NULL;
642
643   return 1;
644 }
645
646 /* Merge cgraph nodes according to the symbol merging done by
647    lto_symtab_merge_decls.  */
648
649 void
650 lto_symtab_merge_cgraph_nodes (void)
651 {
652   lto_symtab_maybe_init_hash_table ();
653   htab_traverse (lto_symtab_identifiers, lto_symtab_merge_cgraph_nodes_1, NULL);
654 }
655
656 /* Given the decl DECL, return the prevailing decl with the same name. */
657
658 tree
659 lto_symtab_prevailing_decl (tree decl)
660 {
661   lto_symtab_entry_t ret;
662
663   /* Builtins and local symbols are their own prevailing decl.  */
664   if (!TREE_PUBLIC (decl) || is_builtin_fn (decl))
665     return decl;
666
667   /* DECL_ABSTRACTs are their own prevailng decl.  */
668   if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl))
669     return decl;
670
671   /* Ensure DECL_ASSEMBLER_NAME will not set assembler name.  */
672   gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
673
674   /* Walk through the list of candidates and return the one we merged to.  */
675   ret = lto_symtab_get (DECL_ASSEMBLER_NAME (decl));
676   if (!ret)
677     return NULL_TREE;
678
679   return ret->decl;
680 }
681
682 #include "gt-lto-symtab.h"