<p dir="ltr">That's one thing I mentioned yesterday, I found that gold does only mark the first one prevailing, so the handling in the plugin ensured that once one was prevailing, all were kept when creating the merged common.</p>
<br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 20, 2016, 4:48 PM Mehdi Amini <<a href="mailto:mehdi.amini@apple.com">mehdi.amini@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Right now for the common the implementation will merge only the commons that are marked as prevailing.<br>
Can you dump the resolution.txt file? I suspect the resolution is not as expected and Gold is marking only the first one as prevailing.<br>
<br>
<br>
> On Aug 20, 2016, at 4:45 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>> wrote:<br>
><br>
> tejohnson added a comment.<br>
><br>
> I fixed a couple of unused variables, diff shown below. But I am getting a test failure, see further below.<br>
><br>
> diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp<br>
> index e5d2f2a..ee2f3f3 100644<br>
><br>
> - a/tools/gold/gold-plugin.cpp<br>
><br>
> +++ b/tools/gold/gold-plugin.cpp<br>
> @@ -564,12 +564,10 @@ static void addModule(LTO &Lto, claimed_file &F, const void *View) {<br>
><br>
> toString(ObjOrErr.takeError()).c_str());<br>
><br>
> InputFile &Obj = **ObjOrErr;<br>
><br>
> - bool HasThinLTOSummary =<br>
> - hasGlobalValueSummary(Obj.getMemoryBufferRef(), diagnosticHandler);<br>
><br>
> unsigned SymNum = 0; std::vector<SymbolResolution> Resols(F.syms.size());<br>
> - for (auto &ObjSym : Obj.symbols()) {<br>
><br>
> + for (LLVM_ATTRIBUTE_UNUSED auto &ObjSym : Obj.symbols()) {<br>
><br>
> ld_plugin_symbol &Sym = F.syms[SymNum];<br>
> SymbolResolution &R = Resols[SymNum];<br>
> ++SymNum;<br>
><br>
> I am getting a failure in the gold common test:<br>
><br>
> llvm_13/test/tools/gold/X86/common.ll:14:6: error: expected string not found in input<br>
> ; A: @a = common global [4 x i8] zeroinitializer, align 8<br>
><br>
> ^<br>
><br>
> <stdin>:4:1: note: possible intended match here<br>
> @a = common global [2 x i8] zeroinitializer, align 8<br>
> ^<br>
><br>
> I'll need to dig unless you can figure out what might be going on. Will try to look tonight if I have time.<br>
><br>
><br>
> <a href="https://reviews.llvm.org/D23739" rel="noreferrer" target="_blank">https://reviews.llvm.org/D23739</a><br>
><br>
><br>
><br>
<br>
</blockquote></div>