[lld] [PATCH] Shared library status is a function of the output, not the input
Rui Ueyama
ruiu at google.com
Mon Sep 2 17:31:09 PDT 2013
Please add a test that demonstrates what was wrong before this patch.
> Index: include/lld/Core/LinkingContext.h
> ===================================================================
> --- include/lld/Core/LinkingContext.h (revision 189662)
> +++ include/lld/Core/LinkingContext.h (working copy)
> @@ -322,6 +314,9 @@
> /// Reference::Kind.
> virtual ErrorOr<std::string> stringFromRelocKind(Reference::Kind k)
const = 0;
>
> + /// Abstract method to return whether the output is shared for the
purpose
> + /// of missing undefind symbols.
> + virtual bool outputIsShared() const = 0;
> /// @}
Shared is too vague. outputIsSharedLibrary is a better name.
> protected:
> Index: include/lld/ReaderWriter/PECOFFLinkingContext.h
> ===================================================================
> --- include/lld/ReaderWriter/PECOFFLinkingContext.h (revision 189662)
> +++ include/lld/ReaderWriter/PECOFFLinkingContext.h (working copy)
> @@ -116,7 +116,10 @@
> return x;
> }
>
> + bool outputIsShared() const { return false; }
Add virtual.
> Index: include/lld/ReaderWriter/ELFLinkingContext.h
> ===================================================================
> --- include/lld/ReaderWriter/ELFLinkingContext.h (revision 189662)
> +++ include/lld/ReaderWriter/ELFLinkingContext.h (working copy)
> @@ -55,6 +55,8 @@
> bool mergeCommonStrings() const { return _mergeCommonStrings; }
> virtual uint64_t getBaseAddress() const { return _baseAddress; }
>
> + bool outputIsShared() const { return getOutputType() ==
llvm::ELF::ET_DYN; }
virtual
> Index: include/lld/ReaderWriter/MachOLinkingContext.h
> ===================================================================
> --- include/lld/ReaderWriter/MachOLinkingContext.h (revision 189662)
> +++ include/lld/ReaderWriter/MachOLinkingContext.h (working copy)
> @@ -49,6 +49,8 @@
>
> uint32_t outputFileType() const { return _outputFileType; }
>
> + bool outputIsShared() const { return false; }
virtual
> Index: include/lld/ReaderWriter/CoreLinkingContext.h
> ===================================================================
> --- include/lld/ReaderWriter/CoreLinkingContext.h (revision 189662)
> +++ include/lld/ReaderWriter/CoreLinkingContext.h (working copy)
> @@ -28,6 +28,8 @@
>
> void addPassNamed(StringRef name) { _passNames.push_back(name); }
>
> + bool outputIsShared() const { return false; }
ditto
On Mon, Sep 2, 2013 at 2:41 PM, Joerg Sonnenberger
<joerg at britannica.bec.de>wrote:
> Hi all,
> this introduces a new context argument outputIsShared(), which allows
> the Resolver to check whether undefined symbols in a shared libary are
> valid. This is only implemented for ELF at the moment.
>
> The original code would fail e.g. when using --whole-archive or
> variants.
>
> Joerg
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130902/51caedb2/attachment.html>
More information about the llvm-commits
mailing list