[llvm-commits] [lld] r153589 - in /lld/trunk: include/lld/Core/Pass.h include/lld/Core/Platform.h include/lld/Platform/Platform.h lib/Passes/GOTPass.cpp lib/Passes/StubsPass.cpp tools/lld-core/lld-core.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Wed Mar 28 11:49:18 PDT 2012
Author: mspencer
Date: Wed Mar 28 13:49:17 2012
New Revision: 153589
URL: http://llvm.org/viewvc/llvm-project?rev=153589&view=rev
Log:
Move Platform.h to Core as Core depends on Platform.h, and the Platform
library depends on Core. This breaks that cycle.
Added:
lld/trunk/include/lld/Core/Platform.h
- copied, changed from r153588, lld/trunk/include/lld/Platform/Platform.h
Removed:
lld/trunk/include/lld/Platform/Platform.h
Modified:
lld/trunk/include/lld/Core/Pass.h
lld/trunk/lib/Passes/GOTPass.cpp
lld/trunk/lib/Passes/StubsPass.cpp
lld/trunk/tools/lld-core/lld-core.cpp
Modified: lld/trunk/include/lld/Core/Pass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Pass.h?rev=153589&r1=153588&r2=153589&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Pass.h (original)
+++ lld/trunk/include/lld/Core/Pass.h Wed Mar 28 13:49:17 2012
@@ -13,7 +13,7 @@
#include <vector>
#include "lld/Core/Atom.h"
-#include "lld/Platform/Platform.h"
+#include "lld/Core/Platform.h"
namespace lld {
Copied: lld/trunk/include/lld/Core/Platform.h (from r153588, lld/trunk/include/lld/Platform/Platform.h)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Platform.h?p2=lld/trunk/include/lld/Core/Platform.h&p1=lld/trunk/include/lld/Platform/Platform.h&r1=153588&r2=153589&rev=153589&view=diff
==============================================================================
--- lld/trunk/include/lld/Platform/Platform.h (original)
+++ lld/trunk/include/lld/Core/Platform.h Wed Mar 28 13:49:17 2012
@@ -1,4 +1,4 @@
-//===- Platform/Platform.h - Platform Interface ---------------------------===//
+//===- Core/Platform.h - Platform Interface -------------------------------===//
//
// The LLVM Linker
//
@@ -7,13 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLD_PLATFORM_PLATFORM_H_
-#define LLD_PLATFORM_PLATFORM_H_
+#ifndef LLD_CORE_PLATFORM_H_
+#define LLD_CORE_PLATFORM_H_
#include <vector>
#include "lld/Core/Reference.h"
-
+
namespace lld {
class Atom;
class DefinedAtom;
@@ -74,7 +74,7 @@
/// When core linking finds a duplicate definition, the platform
/// can either print an error message and terminate or return with
/// which atom the linker should use.
- virtual const Atom& handleMultipleDefinitions(const Atom& def1,
+ virtual const Atom& handleMultipleDefinitions(const Atom& def1,
const Atom& def2) = 0;
/// @brief print out undefined symbol error messages in platform specific way
@@ -101,21 +101,21 @@
/// @brief last chance for platform to tweak atoms
virtual void postResolveTweaks(std::vector<const Atom *>& all) = 0;
-
- /// Converts a reference kind string to a in-memory numeric value.
+
+ /// Converts a reference kind string to a in-memory numeric value.
/// For use with parsing YAML encoded object files.
virtual Reference::Kind kindFromString(llvm::StringRef) = 0;
-
+
/// Converts an in-memory reference kind value to a string.
/// For use with writing YAML encoded object files.
virtual llvm::StringRef kindToString(Reference::Kind) = 0;
-
+
/// If true, the linker will use stubs and GOT entries for
/// references to shared library symbols. If false, the linker
/// will generate relocations on the text segment which the
/// runtime loader will use to patch the program at runtime.
virtual bool noTextRelocs() = 0;
-
+
/// Returns if the Reference kind is for a call site. The "stubs" Pass uses
/// this to find calls that need to be indirected through a stub.
virtual bool isCallSite(Reference::Kind) = 0;
@@ -123,24 +123,24 @@
/// Returns if the Reference kind is a pre-instantiated GOT access.
/// The "got" Pass uses this to figure out what GOT entries to instantiate.
virtual bool isGOTAccess(Reference::Kind, bool& canBypassGOT) = 0;
-
- /// The platform needs to alter the reference kind from a pre-instantiated
- /// GOT access to an actual access. If targetIsNowGOT is true, the "got"
+
+ /// The platform needs to alter the reference kind from a pre-instantiated
+ /// GOT access to an actual access. If targetIsNowGOT is true, the "got"
/// Pass has instantiated a GOT atom and altered the reference's target
- /// to point to that atom. If targetIsNowGOT is false, the "got" Pass
- /// determined a GOT entry is not needed because the reference site can
+ /// to point to that atom. If targetIsNowGOT is false, the "got" Pass
+ /// determined a GOT entry is not needed because the reference site can
/// directly access the target.
virtual void updateReferenceToGOT(const Reference*, bool targetIsNowGOT) = 0;
-
- /// Create a platform specific atom which contains a stub/PLT entry
+
+ /// Create a platform specific atom which contains a stub/PLT entry
/// targeting the specified shared library atom.
virtual const DefinedAtom* makeStub(const Atom&, File&) = 0;
- /// Create a platform specific GOT atom.
+ /// Create a platform specific GOT atom.
virtual const DefinedAtom* makeGOTEntry(const Atom&, File&) = 0;
};
} // namespace lld
-#endif // LLD_PLATFORM_PLATFORM_H_
+#endif // LLD_CORE_PLATFORM_H_
Removed: lld/trunk/include/lld/Platform/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Platform/Platform.h?rev=153588&view=auto
==============================================================================
--- lld/trunk/include/lld/Platform/Platform.h (original)
+++ lld/trunk/include/lld/Platform/Platform.h (removed)
@@ -1,146 +0,0 @@
-//===- Platform/Platform.h - Platform Interface ---------------------------===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_PLATFORM_PLATFORM_H_
-#define LLD_PLATFORM_PLATFORM_H_
-
-#include <vector>
-
-#include "lld/Core/Reference.h"
-
-namespace lld {
-class Atom;
-class DefinedAtom;
-
-
-/// The Platform class encapsulated plaform specific linking knowledge.
-///
-/// Much of what it does is driving by platform specific linker options.
-class Platform {
-public:
- virtual void initialize() = 0;
-
- /// @brief tell platform object another file has been added
- virtual void fileAdded(const File &file) = 0;
-
- /// @brief tell platform object another atom has been added
- virtual void atomAdded(const Atom &file) = 0;
-
- /// @brief give platform a chance to change each atom's scope
- virtual void adjustScope(const DefinedAtom &atom) = 0;
-
- /// @brief if specified atom needs alternate names, return AliasAtom(s)
- virtual bool getAliasAtoms(const Atom &atom,
- std::vector<const DefinedAtom *>&) = 0;
-
- /// @brief give platform a chance to resolve platform-specific undefs
- virtual bool getPlatformAtoms(llvm::StringRef undefined,
- std::vector<const DefinedAtom *>&) = 0;
-
- /// @brief resolver should remove unreferenced atoms
- virtual bool deadCodeStripping() = 0;
-
- /// @brief atom must be kept so should be root of dead-strip graph
- virtual bool isDeadStripRoot(const Atom &atom) = 0;
-
- /// @brief if target must have some atoms, denote here
- virtual bool getImplicitDeadStripRoots(std::vector<const DefinedAtom *>&) = 0;
-
- /// @brief return entry point for output file (e.g. "main") or NULL
- virtual llvm::StringRef entryPointName() = 0;
-
- /// @brief for iterating must-be-defined symbols ("main" or -u command line
- /// option)
- typedef llvm::StringRef const *UndefinesIterator;
- virtual UndefinesIterator initialUndefinesBegin() const = 0;
- virtual UndefinesIterator initialUndefinesEnd() const = 0;
-
- /// @brief if platform wants resolvers to search libraries for overrides
- virtual bool searchArchivesToOverrideTentativeDefinitions() = 0;
- virtual bool searchSharedLibrariesToOverrideTentativeDefinitions() = 0;
-
- /// @brief if platform allows symbol to remain undefined (e.g. -r)
- virtual bool allowUndefinedSymbol(llvm::StringRef name) = 0;
-
- /// @brief for debugging dead code stripping, -why_live
- virtual bool printWhyLive(llvm::StringRef name) = 0;
-
- /// When core linking finds a duplicate definition, the platform
- /// can either print an error message and terminate or return with
- /// which atom the linker should use.
- virtual const Atom& handleMultipleDefinitions(const Atom& def1,
- const Atom& def2) = 0;
-
- /// @brief print out undefined symbol error messages in platform specific way
- virtual void errorWithUndefines(const std::vector<const Atom *>& undefs,
- const std::vector<const Atom *>& all) = 0;
-
- /// When core linking finds undefined atoms from different object
- /// files that have different canBeNull values, this method is called.
- /// The useUndef2 parameter is set to which canBeNull setting the
- /// linker should use, and can be changed by this method. Or this
- /// method can emit a warning/error about the mismatch.
- virtual void undefineCanBeNullMismatch(const UndefinedAtom& undef1,
- const UndefinedAtom& undef2,
- bool& useUndef2) = 0;
-
- /// When core linking finds shared library atoms from different object
- /// files that have different attribute values, this method is called.
- /// The useShlib2 parameter is set to which atom attributes the
- /// linker should use, and can be changed by this method. Or this
- /// method can emit a warning/error about the mismatch.
- virtual void sharedLibrarylMismatch(const SharedLibraryAtom& shLib1,
- const SharedLibraryAtom& shLib2,
- bool& useShlib2) = 0;
-
- /// @brief last chance for platform to tweak atoms
- virtual void postResolveTweaks(std::vector<const Atom *>& all) = 0;
-
- /// Converts a reference kind string to a in-memory numeric value.
- /// For use with parsing YAML encoded object files.
- virtual Reference::Kind kindFromString(llvm::StringRef) = 0;
-
- /// Converts an in-memory reference kind value to a string.
- /// For use with writing YAML encoded object files.
- virtual llvm::StringRef kindToString(Reference::Kind) = 0;
-
- /// If true, the linker will use stubs and GOT entries for
- /// references to shared library symbols. If false, the linker
- /// will generate relocations on the text segment which the
- /// runtime loader will use to patch the program at runtime.
- virtual bool noTextRelocs() = 0;
-
- /// Returns if the Reference kind is for a call site. The "stubs" Pass uses
- /// this to find calls that need to be indirected through a stub.
- virtual bool isCallSite(Reference::Kind) = 0;
-
- /// Returns if the Reference kind is a pre-instantiated GOT access.
- /// The "got" Pass uses this to figure out what GOT entries to instantiate.
- virtual bool isGOTAccess(Reference::Kind, bool& canBypassGOT) = 0;
-
- /// The platform needs to alter the reference kind from a pre-instantiated
- /// GOT access to an actual access. If targetIsNowGOT is true, the "got"
- /// Pass has instantiated a GOT atom and altered the reference's target
- /// to point to that atom. If targetIsNowGOT is false, the "got" Pass
- /// determined a GOT entry is not needed because the reference site can
- /// directly access the target.
- virtual void updateReferenceToGOT(const Reference*, bool targetIsNowGOT) = 0;
-
- /// Create a platform specific atom which contains a stub/PLT entry
- /// targeting the specified shared library atom.
- virtual const DefinedAtom* makeStub(const Atom&, File&) = 0;
-
- /// Create a platform specific GOT atom.
- virtual const DefinedAtom* makeGOTEntry(const Atom&, File&) = 0;
-
-};
-
-} // namespace lld
-
-#endif // LLD_PLATFORM_PLATFORM_H_
Modified: lld/trunk/lib/Passes/GOTPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/GOTPass.cpp?rev=153589&r1=153588&r2=153589&view=diff
==============================================================================
--- lld/trunk/lib/Passes/GOTPass.cpp (original)
+++ lld/trunk/lib/Passes/GOTPass.cpp Wed Mar 28 13:49:17 2012
@@ -31,14 +31,13 @@
// should only return true for "canBypassGOT" if this optimization is supported.
//
-#include "llvm/ADT/DenseMap.h"
-
#include "lld/Core/DefinedAtom.h"
-#include "lld/Core/Pass.h"
#include "lld/Core/File.h"
+#include "lld/Core/Pass.h"
+#include "lld/Core/Platform.h"
#include "lld/Core/Reference.h"
-#include "lld/Platform/Platform.h"
+#include "llvm/ADT/DenseMap.h"
namespace lld {
Modified: lld/trunk/lib/Passes/StubsPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/StubsPass.cpp?rev=153589&r1=153588&r2=153589&view=diff
==============================================================================
--- lld/trunk/lib/Passes/StubsPass.cpp (original)
+++ lld/trunk/lib/Passes/StubsPass.cpp Wed Mar 28 13:49:17 2012
@@ -14,15 +14,13 @@
// StubAtom.
//
-
-#include "llvm/ADT/DenseMap.h"
-
#include "lld/Core/DefinedAtom.h"
-#include "lld/Core/Pass.h"
#include "lld/Core/File.h"
+#include "lld/Core/Pass.h"
+#include "lld/Core/Platform.h"
#include "lld/Core/Reference.h"
-#include "lld/Platform/Platform.h"
+#include "llvm/ADT/DenseMap.h"
namespace lld {
Modified: lld/trunk/tools/lld-core/lld-core.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld-core/lld-core.cpp?rev=153589&r1=153588&r2=153589&view=diff
==============================================================================
--- lld/trunk/tools/lld-core/lld-core.cpp (original)
+++ lld/trunk/tools/lld-core/lld-core.cpp Wed Mar 28 13:49:17 2012
@@ -17,7 +17,7 @@
#include "lld/Core/YamlWriter.h"
#include "lld/Core/NativeReader.h"
#include "lld/Core/NativeWriter.h"
-#include "lld/Platform/Platform.h"
+#include "lld/Core/Platform.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
More information about the llvm-commits
mailing list