<div dir="ltr"><div>Please add a test that demonstrates what was wrong before this patch.</div><div><br></div><div>> Index: include/lld/Core/LinkingContext.h</div><div>> ===================================================================</div>
<div>> --- include/lld/Core/LinkingContext.h (revision 189662)</div><div>> +++ include/lld/Core/LinkingContext.h (working copy)</div><div>> @@ -322,6 +314,9 @@</div><div>> /// Reference::Kind.</div><div>> virtual ErrorOr<std::string> stringFromRelocKind(Reference::Kind k) const = 0;</div>
<div>></div><div>> + /// Abstract method to return whether the output is shared for the purpose</div><div>> + /// of missing undefind symbols.</div><div>> + virtual bool outputIsShared() const = 0;</div><div>
> /// @}</div><div><br></div><div>Shared is too vague. outputIsSharedLibrary is a better name.</div><div><br></div><div>> protected:</div><div>> Index: include/lld/ReaderWriter/PECOFFLinkingContext.h</div><div>
> ===================================================================</div><div>> --- include/lld/ReaderWriter/PECOFFLinkingContext.h (revision 189662)</div><div>> +++ include/lld/ReaderWriter/PECOFFLinkingContext.h (working copy)</div>
<div>> @@ -116,7 +116,10 @@</div><div>> return x;</div><div>> }</div><div>></div><div>> + bool outputIsShared() const { return false; }</div><div><br></div><div>Add virtual.</div><div><br></div><div>
> Index: include/lld/ReaderWriter/ELFLinkingContext.h</div><div>> ===================================================================</div><div>> --- include/lld/ReaderWriter/ELFLinkingContext.h (revision 189662)</div>
<div>> +++ include/lld/ReaderWriter/ELFLinkingContext.h (working copy)</div><div>> @@ -55,6 +55,8 @@</div><div>> bool mergeCommonStrings() const { return _mergeCommonStrings; }</div><div>> virtual uint64_t getBaseAddress() const { return _baseAddress; }</div>
<div>></div><div>> + bool outputIsShared() const { return getOutputType() == llvm::ELF::ET_DYN; }</div><div><br></div><div>virtual</div><div><br></div><div>> Index: include/lld/ReaderWriter/MachOLinkingContext.h</div>
<div>> ===================================================================</div><div>> --- include/lld/ReaderWriter/MachOLinkingContext.h (revision 189662)</div><div>> +++ include/lld/ReaderWriter/MachOLinkingContext.h (working copy)</div>
<div>> @@ -49,6 +49,8 @@</div><div>></div><div>> uint32_t outputFileType() const { return _outputFileType; }</div><div>></div><div>> + bool outputIsShared() const { return false; }</div><div><br></div>
<div>
virtual</div><div><br></div><div>> Index: include/lld/ReaderWriter/CoreLinkingContext.h</div><div>> ===================================================================</div><div>> --- include/lld/ReaderWriter/CoreLinkingContext.h (revision 189662)</div>
<div>> +++ include/lld/ReaderWriter/CoreLinkingContext.h (working copy)</div><div>> @@ -28,6 +28,8 @@</div><div>></div><div>> void addPassNamed(StringRef name) { _passNames.push_back(name); }</div><div>
></div><div>> + bool outputIsShared() const { return false; }</div><div><br></div><div>ditto</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 2, 2013 at 2:41 PM, Joerg Sonnenberger <span dir="ltr"><<a href="mailto:joerg@britannica.bec.de" target="_blank">joerg@britannica.bec.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
this introduces a new context argument outputIsShared(), which allows<br>
the Resolver to check whether undefined symbols in a shared libary are<br>
valid. This is only implemented for ELF at the moment.<br>
<br>
The original code would fail e.g. when using --whole-archive or<br>
variants.<br>
<span class="HOEnZb"><font color="#888888"><br>
Joerg<br>
</font></span><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>