[llvm] r329861 - Add missing vtable anchors

weiming zhao via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 10:43:01 PDT 2018


Agree about moving it to Support.
Also I'll revert the change made to lib/LTO/LLVMBuild.txt

> On Apr 12, 2018, at 10:32 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:
> 
> I removed the one on ObjectMemoryBuffer again. Making LTO depend on MCJIT isn't right, the right fix would be to move ObjectMemoryBuffer to Support.
> 
> On Thu, Apr 12, 2018 at 1:20 PM Weiming Zhao via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: weimingz
> Date: Wed Apr 11 16:09:20 2018
> New Revision: 329861
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=329861&view=rev <http://llvm.org/viewvc/llvm-project?rev=329861&view=rev>
> Log:
> Add missing vtable anchors
> 
> Summary: This patch adds anchor() for MemoryBuffer, raw_fd_ostream, RTDyldMemoryManager, SectionMemoryManager, etc.
> 
> Reviewers: jlebar, eli.friedman, dblaikie
> 
> Reviewed By: dblaikie
> 
> Subscribers: mehdi_amini, mgorny, dblaikie, weimingz, llvm-commits
> 
> Differential Revision: https://reviews.llvm.org/D45244 <https://reviews.llvm.org/D45244>
> 
> Modified:
>     llvm/trunk/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h
>     llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
>     llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h
>     llvm/trunk/include/llvm/Support/MemoryBuffer.h
>     llvm/trunk/include/llvm/Support/raw_ostream.h
>     llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
>     llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
>     llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
>     llvm/trunk/lib/ExecutionEngine/SectionMemoryManager.cpp
>     llvm/trunk/lib/LTO/LLVMBuild.txt
>     llvm/trunk/lib/Support/MemoryBuffer.cpp
>     llvm/trunk/lib/Support/raw_ostream.cpp
> 
> Modified: llvm/trunk/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/ObjectMemoryBuffer.h Wed Apr 11 16:09:20 2018
> @@ -56,6 +56,7 @@ public:
>  private:
>    SmallVector<char, 0> SV;
>    std::string BufferName;
> +  void anchor() override;
>  };
> 
>  } // namespace llvm
> 
> Modified: llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h Wed Apr 11 16:09:20 2018
> @@ -47,6 +47,9 @@ public:
>    /// newly loaded object.
>    virtual void notifyObjectLoaded(ExecutionEngine *EE,
>                                    const object::ObjectFile &) {}
> +
> +private:
> +  void anchor() override;
>  };
> 
>  // RuntimeDyld clients often want to handle the memory management of
> @@ -142,6 +145,9 @@ protected:
>    };
>    typedef std::vector<EHFrame> EHFrameInfos;
>    EHFrameInfos EHFrames;
> +
> +private:
> +  void anchor() override;
>  };
> 
>  // Create wrappers for C Binding types (see CBindingWrapping.h).
> 
> Modified: llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h Wed Apr 11 16:09:20 2018
> @@ -182,6 +182,8 @@ private:
>    std::error_code applyMemoryGroupPermissions(MemoryGroup &MemGroup,
>                                                unsigned Permissions);
> 
> +  void anchor() override;
> +
>    MemoryGroup CodeMem;
>    MemoryGroup RWDataMem;
>    MemoryGroup RODataMem;
> 
> Modified: llvm/trunk/include/llvm/Support/MemoryBuffer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/MemoryBuffer.h (original)
> +++ llvm/trunk/include/llvm/Support/MemoryBuffer.h Wed Apr 11 16:09:20 2018
> @@ -148,6 +148,9 @@ public:
>    virtual BufferKind getBufferKind() const = 0;
> 
>    MemoryBufferRef getMemBufferRef() const;
> +
> +private:
> +  virtual void anchor();
>  };
> 
>  /// This class is an extension of MemoryBuffer, which allows copy-on-write
> 
> Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
> +++ llvm/trunk/include/llvm/Support/raw_ostream.h Wed Apr 11 16:09:20 2018
> @@ -329,6 +329,8 @@ private:
>    /// Copy data into the buffer. Size must not be greater than the number of
>    /// unused bytes in the buffer.
>    void copy_to_buffer(const char *Ptr, size_t Size);
> +
> +  virtual void anchor();
>  };
> 
>  /// An abstract base class for streams implementations that also support a
> @@ -336,6 +338,7 @@ private:
>  /// but needs to patch in a header that needs to know the output size.
>  class raw_pwrite_stream : public raw_ostream {
>    virtual void pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) = 0;
> +  void anchor() override;
> 
>  public:
>    explicit raw_pwrite_stream(bool Unbuffered = false)
> @@ -383,6 +386,8 @@ class raw_fd_ostream : public raw_pwrite
>    /// Set the flag indicating that an output error has been encountered.
>    void error_detected(std::error_code EC) { this->EC = EC; }
> 
> +  void anchor() override;
> +
>  public:
>    /// Open the specified file for writing. If an error occurs, information
>    /// about the error is put into EC, and the stream should be immediately
> 
> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed Apr 11 16:09:20 2018
> @@ -28,6 +28,8 @@
> 
>  using namespace llvm;
> 
> +void llvm::ObjectMemoryBuffer::anchor() {}
> +
>  namespace {
> 
>  static struct RegisterJIT {
> @@ -665,3 +667,5 @@ LinkingSymbolResolver::findSymbol(const
>      return nullptr;
>    return ClientResolver->findSymbol(Name);
>  }
> +
> +void LinkingSymbolResolver::anchor() {}
> 
> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h (original)
> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h Wed Apr 11 16:09:20 2018
> @@ -42,6 +42,7 @@ public:
>  private:
>    MCJIT &ParentEngine;
>    std::shared_ptr<LegacyJITSymbolResolver> ClientResolver;
> +  void anchor() override;
>  };
> 
>  // About Module states: added->loaded->finalized.
> 
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp Wed Apr 11 16:09:20 2018
> @@ -298,4 +298,6 @@ void *RTDyldMemoryManager::getPointerToN
>    return (void*)Addr;
>  }
> 
> +void RTDyldMemoryManager::anchor() {}
> +void MCJITMemoryManager::anchor() {}
>  } // namespace llvm
> 
> Modified: llvm/trunk/lib/ExecutionEngine/SectionMemoryManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/SectionMemoryManager.cpp?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/SectionMemoryManager.cpp?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/SectionMemoryManager.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/SectionMemoryManager.cpp Wed Apr 11 16:09:20 2018
> @@ -232,6 +232,8 @@ SectionMemoryManager::~SectionMemoryMana
> 
>  SectionMemoryManager::MemoryMapper::~MemoryMapper() {}
> 
> +void SectionMemoryManager::anchor() {}
> +
>  namespace {
>  // Trivial implementation of SectionMemoryManager::MemoryMapper that just calls
>  // into sys::Memory.
> 
> Modified: llvm/trunk/lib/LTO/LLVMBuild.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LLVMBuild.txt?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LLVMBuild.txt?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/LTO/LLVMBuild.txt (original)
> +++ llvm/trunk/lib/LTO/LLVMBuild.txt Wed Apr 11 16:09:20 2018
> @@ -37,3 +37,4 @@ required_libraries =
>   Support
>   Target
>   TransformUtils
> + MCJIT
> 
> Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
> +++ llvm/trunk/lib/Support/MemoryBuffer.cpp Wed Apr 11 16:09:20 2018
> @@ -531,3 +531,5 @@ MemoryBufferRef MemoryBuffer::getMemBuff
>    StringRef Identifier = getBufferIdentifier();
>    return MemoryBufferRef(Data, Identifier);
>  }
> +
> +void MemoryBuffer::anchor() {}
> 
> Modified: llvm/trunk/lib/Support/raw_ostream.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=329861&r1=329860&r2=329861&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=329861&r1=329860&r2=329861&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/Support/raw_ostream.cpp (original)
> +++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Apr 11 16:09:20 2018
> @@ -474,6 +474,8 @@ raw_ostream &raw_ostream::indent(unsigne
>    return *this;
>  }
> 
> +void raw_ostream::anchor() {}
> +
>  //===----------------------------------------------------------------------===//
>  //  Formatted Output
>  //===----------------------------------------------------------------------===//
> @@ -727,6 +729,8 @@ bool raw_fd_ostream::has_colors() const
>    return sys::Process::FileDescriptorHasColors(FD);
>  }
> 
> +void raw_fd_ostream::anchor() {}
> +
>  //===----------------------------------------------------------------------===//
>  //  outs(), errs(), nulls()
>  //===----------------------------------------------------------------------===//
> @@ -804,3 +808,5 @@ uint64_t raw_null_ostream::current_pos()
> 
>  void raw_null_ostream::pwrite_impl(const char *Ptr, size_t Size,
>                                     uint64_t Offset) {}
> +
> +void raw_pwrite_stream::anchor() {}
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/7b3d5434/attachment.html>


More information about the llvm-commits mailing list