2013-05-31 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / lto-symtab.c
blob6c433f427315dfdd677a46f4781cbef6b908c431
1 /* LTO symbol table.
2 Copyright (C) 2009-2013 Free Software Foundation, Inc.
3 Contributed by CodeSourcery, Inc.
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 "diagnostic-core.h"
25 #include "tree.h"
26 #include "gimple.h"
27 #include "ggc.h"
28 #include "hashtab.h"
29 #include "plugin-api.h"
30 #include "lto-streamer.h"
32 /* Vector to keep track of external variables we've seen so far. */
33 vec<tree, va_gc> *lto_global_var_decls;
35 /* Replace the cgraph node NODE with PREVAILING_NODE in the cgraph, merging
36 all edges and removing the old node. */
38 static void
39 lto_cgraph_replace_node (struct cgraph_node *node,
40 struct cgraph_node *prevailing_node)
42 struct cgraph_edge *e, *next;
43 bool compatible_p;
45 if (cgraph_dump_file)
47 fprintf (cgraph_dump_file, "Replacing cgraph node %s/%i by %s/%i"
48 " for symbol %s\n",
49 cgraph_node_name (node), node->symbol.order,
50 cgraph_node_name (prevailing_node),
51 prevailing_node->symbol.order,
52 IDENTIFIER_POINTER ((*targetm.asm_out.mangle_assembler_name)
53 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)))));
56 /* Merge node flags. */
57 if (node->symbol.force_output)
58 cgraph_mark_force_output_node (prevailing_node);
59 if (node->symbol.address_taken)
61 gcc_assert (!prevailing_node->global.inlined_to);
62 cgraph_mark_address_taken_node (prevailing_node);
65 /* Redirect all incoming edges. */
66 compatible_p
67 = types_compatible_p (TREE_TYPE (TREE_TYPE (prevailing_node->symbol.decl)),
68 TREE_TYPE (TREE_TYPE (node->symbol.decl)));
69 for (e = node->callers; e; e = next)
71 next = e->next_caller;
72 cgraph_redirect_edge_callee (e, prevailing_node);
73 /* If there is a mismatch between the supposed callee return type and
74 the real one do not attempt to inline this function.
75 ??? We really need a way to match function signatures for ABI
76 compatibility and perform related promotions at inlining time. */
77 if (!compatible_p)
78 e->call_stmt_cannot_inline_p = 1;
80 /* Redirect incomming references. */
81 ipa_clone_referring ((symtab_node)prevailing_node, &node->symbol.ref_list);
83 /* Finally remove the replaced node. */
84 cgraph_remove_node (node);
87 /* Replace the cgraph node NODE with PREVAILING_NODE in the cgraph, merging
88 all edges and removing the old node. */
90 static void
91 lto_varpool_replace_node (struct varpool_node *vnode,
92 struct varpool_node *prevailing_node)
94 gcc_assert (!vnode->symbol.definition || prevailing_node->symbol.definition);
95 gcc_assert (!vnode->symbol.analyzed || prevailing_node->symbol.analyzed);
97 ipa_clone_referring ((symtab_node)prevailing_node, &vnode->symbol.ref_list);
99 /* Be sure we can garbage collect the initializer. */
100 if (DECL_INITIAL (vnode->symbol.decl))
101 DECL_INITIAL (vnode->symbol.decl) = error_mark_node;
102 /* Finally remove the replaced node. */
103 varpool_remove_node (vnode);
106 /* Merge two variable or function symbol table entries PREVAILING and ENTRY.
107 Return false if the symbols are not fully compatible and a diagnostic
108 should be emitted. */
110 static bool
111 lto_symtab_merge (symtab_node prevailing, symtab_node entry)
113 tree prevailing_decl = prevailing->symbol.decl;
114 tree decl = entry->symbol.decl;
115 tree prevailing_type, type;
117 if (prevailing_decl == decl)
118 return true;
120 /* Merge decl state in both directions, we may still end up using
121 the new decl. */
122 TREE_ADDRESSABLE (prevailing_decl) |= TREE_ADDRESSABLE (decl);
123 TREE_ADDRESSABLE (decl) |= TREE_ADDRESSABLE (prevailing_decl);
125 /* The linker may ask us to combine two incompatible symbols.
126 Detect this case and notify the caller of required diagnostics. */
128 if (TREE_CODE (decl) == FUNCTION_DECL)
130 if (!types_compatible_p (TREE_TYPE (prevailing_decl),
131 TREE_TYPE (decl)))
132 /* If we don't have a merged type yet...sigh. The linker
133 wouldn't complain if the types were mismatched, so we
134 probably shouldn't either. Just use the type from
135 whichever decl appears to be associated with the
136 definition. If for some odd reason neither decl is, the
137 older one wins. */
138 (void) 0;
140 return true;
143 /* Now we exclusively deal with VAR_DECLs. */
145 /* Sharing a global symbol is a strong hint that two types are
146 compatible. We could use this information to complete
147 incomplete pointed-to types more aggressively here, ignoring
148 mismatches in both field and tag names. It's difficult though
149 to guarantee that this does not have side-effects on merging
150 more compatible types from other translation units though. */
152 /* We can tolerate differences in type qualification, the
153 qualification of the prevailing definition will prevail.
154 ??? In principle we might want to only warn for structurally
155 incompatible types here, but unless we have protective measures
156 for TBAA in place that would hide useful information. */
157 prevailing_type = TYPE_MAIN_VARIANT (TREE_TYPE (prevailing_decl));
158 type = TYPE_MAIN_VARIANT (TREE_TYPE (decl));
160 if (!types_compatible_p (prevailing_type, type))
162 if (COMPLETE_TYPE_P (type))
163 return false;
165 /* If type is incomplete then avoid warnings in the cases
166 that TBAA handles just fine. */
168 if (TREE_CODE (prevailing_type) != TREE_CODE (type))
169 return false;
171 if (TREE_CODE (prevailing_type) == ARRAY_TYPE)
173 tree tem1 = TREE_TYPE (prevailing_type);
174 tree tem2 = TREE_TYPE (type);
175 while (TREE_CODE (tem1) == ARRAY_TYPE
176 && TREE_CODE (tem2) == ARRAY_TYPE)
178 tem1 = TREE_TYPE (tem1);
179 tem2 = TREE_TYPE (tem2);
182 if (TREE_CODE (tem1) != TREE_CODE (tem2))
183 return false;
185 if (!types_compatible_p (tem1, tem2))
186 return false;
189 /* Fallthru. Compatible enough. */
192 /* ??? We might want to emit a warning here if type qualification
193 differences were spotted. Do not do this unconditionally though. */
195 /* There is no point in comparing too many details of the decls here.
196 The type compatibility checks or the completing of types has properly
197 dealt with most issues. */
199 /* The following should all not invoke fatal errors as in non-LTO
200 mode the linker wouldn't complain either. Just emit warnings. */
202 /* Report a warning if user-specified alignments do not match. */
203 if ((DECL_USER_ALIGN (prevailing_decl) && DECL_USER_ALIGN (decl))
204 && DECL_ALIGN (prevailing_decl) < DECL_ALIGN (decl))
205 return false;
207 return true;
210 /* Return true if the symtab entry E can be replaced by another symtab
211 entry. */
213 static bool
214 lto_symtab_resolve_replaceable_p (symtab_node e)
216 if (DECL_EXTERNAL (e->symbol.decl)
217 || DECL_COMDAT (e->symbol.decl)
218 || DECL_ONE_ONLY (e->symbol.decl)
219 || DECL_WEAK (e->symbol.decl))
220 return true;
222 if (TREE_CODE (e->symbol.decl) == VAR_DECL)
223 return (DECL_COMMON (e->symbol.decl)
224 || (!flag_no_common && !DECL_INITIAL (e->symbol.decl)));
226 return false;
229 /* Return true, if the symbol E should be resolved by lto-symtab.
230 Those are all external symbols and all real symbols that are not static (we
231 handle renaming of static later in partitioning). */
233 static bool
234 lto_symtab_symbol_p (symtab_node e)
236 if (!TREE_PUBLIC (e->symbol.decl) && !DECL_EXTERNAL (e->symbol.decl))
237 return false;
238 /* weakrefs are really static variables that are made external by a hack. */
239 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (e->symbol.decl)))
240 return false;
241 return symtab_real_symbol_p (e);
244 /* Return true if the symtab entry E can be the prevailing one. */
246 static bool
247 lto_symtab_resolve_can_prevail_p (symtab_node e)
249 if (!lto_symtab_symbol_p (e))
250 return false;
252 /* The C++ frontend ends up neither setting TREE_STATIC nor
253 DECL_EXTERNAL on virtual methods but only TREE_PUBLIC.
254 So do not reject !TREE_STATIC here but only DECL_EXTERNAL. */
255 if (DECL_EXTERNAL (e->symbol.decl))
256 return false;
258 return e->symbol.definition;
261 /* Resolve the symbol with the candidates in the chain *SLOT and store
262 their resolutions. */
264 static symtab_node
265 lto_symtab_resolve_symbols (symtab_node first)
267 symtab_node e;
268 symtab_node prevailing = NULL;
270 /* Always set e->node so that edges are updated to reflect decl merging. */
271 for (e = first; e; e = e->symbol.next_sharing_asm_name)
272 if (lto_symtab_symbol_p (e)
273 && (e->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY
274 || e->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY_EXP
275 || e->symbol.resolution == LDPR_PREVAILING_DEF))
277 prevailing = e;
278 break;
281 /* If the chain is already resolved there is nothing else to do. */
282 if (prevailing)
284 /* Assert it's the only one. */
285 for (e = prevailing->symbol.next_sharing_asm_name; e; e = e->symbol.next_sharing_asm_name)
286 if (lto_symtab_symbol_p (e)
287 && (e->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY
288 || e->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY_EXP
289 || e->symbol.resolution == LDPR_PREVAILING_DEF))
290 fatal_error ("multiple prevailing defs for %qE",
291 DECL_NAME (prevailing->symbol.decl));
292 return prevailing;
295 /* Find the single non-replaceable prevailing symbol and
296 diagnose ODR violations. */
297 for (e = first; e; e = e->symbol.next_sharing_asm_name)
299 if (!lto_symtab_resolve_can_prevail_p (e))
300 continue;
302 /* If we have a non-replaceable definition it prevails. */
303 if (!lto_symtab_resolve_replaceable_p (e))
305 if (prevailing)
307 error_at (DECL_SOURCE_LOCATION (e->symbol.decl),
308 "%qD has already been defined", e->symbol.decl);
309 inform (DECL_SOURCE_LOCATION (prevailing->symbol.decl),
310 "previously defined here");
312 prevailing = e;
315 if (prevailing)
316 return prevailing;
318 /* Do a second round choosing one from the replaceable prevailing decls. */
319 for (e = first; e; e = e->symbol.next_sharing_asm_name)
321 if (!lto_symtab_resolve_can_prevail_p (e))
322 continue;
324 /* Choose the first function that can prevail as prevailing. */
325 if (TREE_CODE (e->symbol.decl) == FUNCTION_DECL)
327 prevailing = e;
328 break;
331 /* From variables that can prevail choose the largest one. */
332 if (!prevailing
333 || tree_int_cst_lt (DECL_SIZE (prevailing->symbol.decl),
334 DECL_SIZE (e->symbol.decl))
335 /* When variables are equivalent try to chose one that has useful
336 DECL_INITIAL. This makes sense for keyed vtables that are
337 DECL_EXTERNAL but initialized. In units that do not need them
338 we replace the initializer by error_mark_node to conserve
339 memory.
341 We know that the vtable is keyed outside the LTO unit - otherwise
342 the keyed instance would prevail. We still can preserve useful
343 info in the initializer. */
344 || (DECL_SIZE (prevailing->symbol.decl) == DECL_SIZE (e->symbol.decl)
345 && (DECL_INITIAL (e->symbol.decl)
346 && DECL_INITIAL (e->symbol.decl) != error_mark_node)
347 && (!DECL_INITIAL (prevailing->symbol.decl)
348 || DECL_INITIAL (prevailing->symbol.decl) == error_mark_node)))
349 prevailing = e;
352 return prevailing;
355 /* Merge all decls in the symbol table chain to the prevailing decl and
356 issue diagnostics about type mismatches. If DIAGNOSED_P is true
357 do not issue further diagnostics.*/
359 static void
360 lto_symtab_merge_decls_2 (symtab_node first, bool diagnosed_p)
362 symtab_node prevailing, e;
363 vec<tree> mismatches = vNULL;
364 unsigned i;
365 tree decl;
367 /* Nothing to do for a single entry. */
368 prevailing = first;
369 if (!prevailing->symbol.next_sharing_asm_name)
370 return;
372 /* Try to merge each entry with the prevailing one. */
373 for (e = prevailing->symbol.next_sharing_asm_name;
374 e; e = e->symbol.next_sharing_asm_name)
375 if (TREE_PUBLIC (e->symbol.decl))
377 if (!lto_symtab_merge (prevailing, e)
378 && !diagnosed_p)
379 mismatches.safe_push (e->symbol.decl);
381 if (mismatches.is_empty ())
382 return;
384 /* Diagnose all mismatched re-declarations. */
385 FOR_EACH_VEC_ELT (mismatches, i, decl)
387 if (!types_compatible_p (TREE_TYPE (prevailing->symbol.decl),
388 TREE_TYPE (decl)))
389 diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
390 "type of %qD does not match original "
391 "declaration", decl);
393 else if ((DECL_USER_ALIGN (prevailing->symbol.decl)
394 && DECL_USER_ALIGN (decl))
395 && DECL_ALIGN (prevailing->symbol.decl) < DECL_ALIGN (decl))
397 diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
398 "alignment of %qD is bigger than "
399 "original declaration", decl);
402 if (diagnosed_p)
403 inform (DECL_SOURCE_LOCATION (prevailing->symbol.decl),
404 "previously declared here");
406 mismatches.release ();
409 /* Helper to process the decl chain for the symbol table entry *SLOT. */
411 static void
412 lto_symtab_merge_decls_1 (symtab_node first)
414 symtab_node e, prevailing;
415 bool diagnosed_p = false;
417 if (cgraph_dump_file)
419 fprintf (cgraph_dump_file, "Merging nodes for %s. Candidates:\n",
420 symtab_node_asm_name (first));
421 for (e = first; e; e = e->symbol.next_sharing_asm_name)
422 if (TREE_PUBLIC (e->symbol.decl))
423 dump_symtab_node (cgraph_dump_file, e);
426 /* Compute the symbol resolutions. This is a no-op when using the
427 linker plugin and resolution was decided by the linker. */
428 prevailing = lto_symtab_resolve_symbols (first);
430 /* If there's not a prevailing symbol yet it's an external reference.
431 Happens a lot during ltrans. Choose the first symbol with a
432 cgraph or a varpool node. */
433 if (!prevailing)
435 prevailing = first;
436 /* For variables chose with a priority variant with vnode
437 attached (i.e. from unit where external declaration of
438 variable is actually used).
439 When there are multiple variants, chose one with size.
440 This is needed for C++ typeinfos, for example in
441 lto/20081204-1 there are typeifos in both units, just
442 one of them do have size. */
443 if (TREE_CODE (prevailing->symbol.decl) == VAR_DECL)
445 for (e = prevailing->symbol.next_sharing_asm_name;
446 e; e = e->symbol.next_sharing_asm_name)
447 if (!COMPLETE_TYPE_P (TREE_TYPE (prevailing->symbol.decl))
448 && COMPLETE_TYPE_P (TREE_TYPE (e->symbol.decl))
449 && lto_symtab_symbol_p (e))
450 prevailing = e;
452 /* For variables prefer the non-builtin if one is available. */
453 else if (TREE_CODE (prevailing->symbol.decl) == FUNCTION_DECL)
455 for (e = first; e; e = e->symbol.next_sharing_asm_name)
456 if (TREE_CODE (e->symbol.decl) == FUNCTION_DECL
457 && !DECL_BUILT_IN (e->symbol.decl)
458 && lto_symtab_symbol_p (e))
460 prevailing = e;
461 break;
466 symtab_prevail_in_asm_name_hash (prevailing);
468 /* Diagnose mismatched objects. */
469 for (e = prevailing->symbol.next_sharing_asm_name;
470 e; e = e->symbol.next_sharing_asm_name)
472 if (TREE_CODE (prevailing->symbol.decl)
473 == TREE_CODE (e->symbol.decl))
474 continue;
475 if (!lto_symtab_symbol_p (e))
476 continue;
478 switch (TREE_CODE (prevailing->symbol.decl))
480 case VAR_DECL:
481 gcc_assert (TREE_CODE (e->symbol.decl) == FUNCTION_DECL);
482 error_at (DECL_SOURCE_LOCATION (e->symbol.decl),
483 "variable %qD redeclared as function",
484 prevailing->symbol.decl);
485 break;
487 case FUNCTION_DECL:
488 gcc_assert (TREE_CODE (e->symbol.decl) == VAR_DECL);
489 error_at (DECL_SOURCE_LOCATION (e->symbol.decl),
490 "function %qD redeclared as variable",
491 prevailing->symbol.decl);
492 break;
494 default:
495 gcc_unreachable ();
498 diagnosed_p = true;
500 if (diagnosed_p)
501 inform (DECL_SOURCE_LOCATION (prevailing->symbol.decl),
502 "previously declared here");
504 /* Merge the chain to the single prevailing decl and diagnose
505 mismatches. */
506 lto_symtab_merge_decls_2 (prevailing, diagnosed_p);
508 if (cgraph_dump_file)
510 fprintf (cgraph_dump_file, "After resolution:\n");
511 for (e = prevailing; e; e = e->symbol.next_sharing_asm_name)
512 dump_symtab_node (cgraph_dump_file, e);
516 /* Resolve and merge all symbol table chains to a prevailing decl. */
518 void
519 lto_symtab_merge_decls (void)
521 symtab_node node;
523 /* Populate assembler name hash. */
524 symtab_initialize_asm_name_hash ();
526 FOR_EACH_SYMBOL (node)
527 if (lto_symtab_symbol_p (node)
528 && node->symbol.next_sharing_asm_name)
530 symtab_node n;
532 /* To avoid duplicated work, see if this is first real symbol in the
533 chain. */
534 for (n = node->symbol.previous_sharing_asm_name;
535 n && !lto_symtab_symbol_p (n); n = n->symbol.previous_sharing_asm_name)
537 if (!n)
538 lto_symtab_merge_decls_1 (node);
542 /* Helper to process the decl chain for the symbol table entry *SLOT. */
544 static void
545 lto_symtab_merge_cgraph_nodes_1 (symtab_node prevailing)
547 symtab_node e, next;
549 /* Replace the cgraph node of each entry with the prevailing one. */
550 for (e = prevailing->symbol.next_sharing_asm_name; e;
551 e = next)
553 next = e->symbol.next_sharing_asm_name;
555 if (!lto_symtab_symbol_p (e))
556 continue;
557 cgraph_node *ce = dyn_cast <cgraph_node> (e);
558 if (ce && !DECL_BUILT_IN (e->symbol.decl))
559 lto_cgraph_replace_node (ce, cgraph (prevailing));
560 if (varpool_node *ve = dyn_cast <varpool_node> (e))
561 lto_varpool_replace_node (ve, varpool (prevailing));
564 return;
567 /* Merge cgraph nodes according to the symbol merging done by
568 lto_symtab_merge_decls. */
570 void
571 lto_symtab_merge_cgraph_nodes (void)
573 struct cgraph_node *cnode;
574 struct varpool_node *vnode;
575 symtab_node node;
577 /* Populate assembler name hash. */
578 symtab_initialize_asm_name_hash ();
580 if (!flag_ltrans)
581 FOR_EACH_SYMBOL (node)
582 if (lto_symtab_symbol_p (node)
583 && node->symbol.next_sharing_asm_name
584 && !node->symbol.previous_sharing_asm_name)
585 lto_symtab_merge_cgraph_nodes_1 (node);
587 FOR_EACH_FUNCTION (cnode)
589 /* Resolve weakrefs to symbol defined in other unit. */
590 if (!cnode->symbol.analyzed && cnode->thunk.alias && !DECL_P (cnode->thunk.alias))
592 symtab_node node = symtab_node_for_asm (cnode->thunk.alias);
593 if (node && is_a <cgraph_node> (node))
595 struct cgraph_node *n;
597 for (n = cgraph (node); n && n->symbol.alias;
598 n = n->symbol.analyzed ? cgraph_alias_target (n) : NULL)
599 if (n == cnode)
601 error ("function %q+D part of alias cycle", cnode->symbol.decl);
602 cnode->symbol.alias = false;
603 break;
605 if (cnode->symbol.alias)
607 cgraph_create_function_alias (cnode->symbol.decl, node->symbol.decl);
608 ipa_record_reference ((symtab_node)cnode, (symtab_node)node,
609 IPA_REF_ALIAS, NULL);
610 cnode->symbol.analyzed = true;
613 else if (node)
614 error ("%q+D alias in between function and variable is not supported", cnode->symbol.decl);
616 if ((cnode->thunk.thunk_p || cnode->symbol.alias)
617 && cnode->thunk.alias && DECL_P (cnode->thunk.alias))
618 cnode->thunk.alias = lto_symtab_prevailing_decl (cnode->thunk.alias);
619 cnode->symbol.aux = NULL;
621 FOR_EACH_VARIABLE (vnode)
623 /* Resolve weakrefs to symbol defined in other unit. */
624 if (!vnode->symbol.analyzed && vnode->alias_of && !DECL_P (vnode->alias_of))
626 symtab_node node = symtab_node_for_asm (vnode->alias_of);
627 if (node && is_a <cgraph_node> (node))
629 struct varpool_node *n;
631 for (n = varpool (node); n && n->symbol.alias;
632 n = n->symbol.analyzed ? varpool_alias_target (n) : NULL)
633 if (n == vnode)
635 error ("function %q+D part of alias cycle", vnode->symbol.decl);
636 vnode->symbol.alias = false;
637 break;
639 if (vnode->symbol.alias)
641 varpool_create_variable_alias (vnode->symbol.decl, node->symbol.decl);
642 ipa_record_reference ((symtab_node)vnode, (symtab_node)node,
643 IPA_REF_ALIAS, NULL);
644 vnode->symbol.analyzed = true;
647 else if (node)
648 error ("%q+D alias in between function and variable is not supported", vnode->symbol.decl);
650 if (vnode->symbol.alias && DECL_P (vnode->alias_of))
651 vnode->alias_of = lto_symtab_prevailing_decl (vnode->alias_of);
652 vnode->symbol.aux = NULL;
656 /* Given the decl DECL, return the prevailing decl with the same name. */
658 tree
659 lto_symtab_prevailing_decl (tree decl)
661 symtab_node ret;
663 /* Builtins and local symbols are their own prevailing decl. */
664 if ((!TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl)) || is_builtin_fn (decl))
665 return decl;
667 /* DECL_ABSTRACTs are their own prevailng decl. */
668 if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl))
669 return decl;
671 /* Likewise builtins are their own prevailing decl. This preserves
672 non-builtin vs. builtin uses from compile-time. */
673 if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
674 return decl;
676 /* As an anoying special cases weakrefs are really static variables with
677 EXTERNAL flag. */
678 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)))
679 return decl;
681 /* Ensure DECL_ASSEMBLER_NAME will not set assembler name. */
682 gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
684 /* Walk through the list of candidates and return the one we merged to. */
685 ret = symtab_node_for_asm (DECL_ASSEMBLER_NAME (decl));
686 if (!ret)
687 return decl;
689 return ret->symbol.decl;