[PATCH] D41113: [LLVMgold] Don't set resolutions for undefined symbols to 'Prevailing'

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 08:10:22 PST 2017


evgeny777 added inline comments.


================
Comment at: tools/gold/gold-plugin.cpp:659
     case LDPR_PREVAILING_DEF_IRONLY:
-      R.Prevailing = true;
+      R.Prevailing = (Sym.def != LDPK_UNDEF);
       break;
----------------
tejohnson wrote:
> This seems like a bug in gold? The description of LDPR_PREVAILING_DEF_IRONLY from plugin-api.h says it should be used for definitions:
> 
>   /* This is the prevailing definition of the symbol, with no
>      references from regular objects.  It is only referenced from IR
>      code.  */
>   LDPR_PREVAILING_DEF_IRONLY,
> 
> 
> Wondering why it isn't LDPR_UNDEF. What does the test case look like?
Gold sets LDPR_UNDEF only for regular undefined symbols. IR symbols with LDPR_PREVAILING_DEF_IRONLY can be either LDPK_DEF or LDPK_UNDEF (and also LDPK_WEAKUNDEF). Gold plugin sets all IRONLY resolutions to prevailing, no matter if they are defined or not. This, by the way doesn't correspond to lld behavior, where we have this (ELF/LTO.cpp):

```
R.Prevailing = !ObjSym.isUndefined() && Sym->File == &F;
```

> What does the test case look like?

Like I said this is an addition to D40970 (reverted), which fixes broken gold plugin test (asm_undefined2.ll)


https://reviews.llvm.org/D41113





More information about the llvm-commits mailing list