Remove PPC ELF target
authorGreg Fitzgerald <garious@gmail.com>
Wed, 28 Jan 2015 16:37:43 +0000 (16:37 +0000)
committerGreg Fitzgerald <garious@gmail.com>
Wed, 28 Jan 2015 16:37:43 +0000 (16:37 +0000)
Differential Revision: http://reviews.llvm.org/D7225

llvm-svn: 227320

16 files changed:
lld/include/lld/ReaderWriter/ELFTargets.h
lld/lib/Driver/CMakeLists.txt
lld/lib/Driver/GnuLdDriver.cpp
lld/lib/ReaderWriter/ELF/CMakeLists.txt
lld/lib/ReaderWriter/ELF/Makefile
lld/lib/ReaderWriter/ELF/Mips/Makefile
lld/lib/ReaderWriter/ELF/PPC/CMakeLists.txt [deleted file]
lld/lib/ReaderWriter/ELF/PPC/Makefile [deleted file]
lld/lib/ReaderWriter/ELF/PPC/PPCELFFile.h [deleted file]
lld/lib/ReaderWriter/ELF/PPC/PPCELFReader.h [deleted file]
lld/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp [deleted file]
lld/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h [deleted file]
lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp [deleted file]
lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h [deleted file]
lld/test/elf/ppc.test [deleted file]
lld/tools/lld/Makefile

index c986e27..b6a6298 100644 (file)
@@ -26,7 +26,6 @@ LLVM_TARGET(AArch64)
 LLVM_TARGET(ARM)
 LLVM_TARGET(Hexagon)
 LLVM_TARGET(Mips)
-LLVM_TARGET(PPC)
 LLVM_TARGET(X86)
 LLVM_TARGET(X86_64)
 
index 6cd113b..7f4e82a 100644 (file)
@@ -28,7 +28,6 @@ add_llvm_library(lldDriver
     lldARMELFTarget
     lldHexagonELFTarget
     lldMipsELFTarget
-    lldPPCELFTarget
     lldX86ELFTarget
     lldX86_64ELFTarget
     lldCore
index 8d655a5..6b68f9c 100644 (file)
@@ -329,7 +329,6 @@ createELFLinkingContext(llvm::Triple triple) {
   LLVM_TARGET(ARM)
   LLVM_TARGET(Hexagon)
   LLVM_TARGET(Mips)
-  LLVM_TARGET(PPC)
   LLVM_TARGET(X86)
   LLVM_TARGET(X86_64)
   return nullptr;
index ce3c99a..6ef1f50 100644 (file)
@@ -14,7 +14,6 @@ include_directories(.)
 
 add_subdirectory(X86)
 add_subdirectory(X86_64)
-add_subdirectory(PPC)
 add_subdirectory(Mips)
 add_subdirectory(Hexagon)
 add_subdirectory(AArch64)
index 037be4e..c7f2958 100644 (file)
@@ -14,6 +14,6 @@ USEDLIBS = lldPasses.a
 CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
 
 # these link against this lib
-PARALLEL_DIRS := Hexagon PPC X86 X86_64 Mips AArch64 ARM
+PARALLEL_DIRS := Hexagon X86 X86_64 Mips AArch64 ARM
 
 include $(LLD_LEVEL)/Makefile
index 20263a1..0b2f4ff 100644 (file)
@@ -1,4 +1,4 @@
-##===- lld/lib/ReaderWriter/ELF/PPC/Makefile ----------*- Makefile -*-===##
+##===- lld/lib/ReaderWriter/ELF/Mips/Makefile ----------*- Makefile -*-===##
 #
 #                     The LLVM Compiler Infrastructure
 #
diff --git a/lld/lib/ReaderWriter/ELF/PPC/CMakeLists.txt b/lld/lib/ReaderWriter/ELF/PPC/CMakeLists.txt
deleted file mode 100644 (file)
index 71d52ee..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-add_llvm_library(lldPPCELFTarget
-  PPCLinkingContext.cpp
-  PPCTargetHandler.cpp
-  LINK_LIBS
-    lldCore
-    lldELF
-    LLVMObject
-    LLVMSupport
-  )
diff --git a/lld/lib/ReaderWriter/ELF/PPC/Makefile b/lld/lib/ReaderWriter/ELF/PPC/Makefile
deleted file mode 100644 (file)
index ad4a789..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-##===- lld/lib/ReaderWriter/ELF/PPC/Makefile ----------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LLD_LEVEL := ../../../..
-LIBRARYNAME := lldPPCELFTarget
-USEDLIBS = lldCore.a
-CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLD_LEVEL)/lib/ReaderWriter/ELF
-
-include $(LLD_LEVEL)/Makefile
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCELFFile.h b/lld/lib/ReaderWriter/ELF/PPC/PPCELFFile.h
deleted file mode 100644 (file)
index bbcd49e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- lib/ReaderWriter/ELF/PPCELFFile.h -------------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_READER_WRITER_ELF_PPC_ELF_FILE_H
-#define LLD_READER_WRITER_ELF_PPC_ELF_FILE_H
-
-#include "ELFReader.h"
-
-namespace lld {
-namespace elf {
-
-class PPCLinkingContext;
-
-template <class ELFT> class PPCELFFile : public ELFFile<ELFT> {
-public:
-  PPCELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings)
-      : ELFFile<ELFT>(std::move(mb), atomizeStrings) {}
-
-  static ErrorOr<std::unique_ptr<PPCELFFile>>
-  create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
-    return std::unique_ptr<PPCELFFile<ELFT>>(
-        new PPCELFFile<ELFT>(std::move(mb), atomizeStrings));
-  }
-};
-
-template <class ELFT> class PPCDynamicFile : public DynamicFile<ELFT> {
-public:
-  PPCDynamicFile(const PPCLinkingContext &context, StringRef name)
-      : DynamicFile<ELFT>(context, name) {}
-};
-
-} // elf
-} // lld
-
-#endif // LLD_READER_WRITER_ELF_PPC_ELF_FILE_H
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCELFReader.h b/lld/lib/ReaderWriter/ELF/PPC/PPCELFReader.h
deleted file mode 100644 (file)
index 9cc797e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//===- lib/ReaderWriter/ELF/PPC/PPCELFReader.h ----------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_READER_WRITER_PPC_PPC_ELF_READER_H
-#define LLD_READER_WRITER_PPC_PPC_ELF_READER_H
-
-#include "ELFReader.h"
-#include "PPCELFFile.h"
-
-namespace lld {
-namespace elf {
-
-typedef llvm::object::ELFType<llvm::support::big, 2, false> PPCELFType;
-
-struct PPCDynamicFileCreateELFTraits {
-  typedef llvm::ErrorOr<std::unique_ptr<lld::SharedLibraryFile>> result_type;
-
-  template <class ELFT>
-  static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
-                            bool useUndefines) {
-    return lld::elf::PPCDynamicFile<ELFT>::create(std::move(mb), useUndefines);
-  }
-};
-
-struct PPCELFFileCreateELFTraits {
-  typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
-  template <class ELFT>
-  static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
-                            bool atomizeStrings) {
-    return lld::elf::PPCELFFile<ELFT>::create(std::move(mb), atomizeStrings);
-  }
-};
-
-class PPCELFObjectReader
-    : public ELFObjectReader<PPCELFType, PPCELFFileCreateELFTraits> {
-public:
-  PPCELFObjectReader(bool atomizeStrings)
-      : ELFObjectReader<PPCELFType, PPCELFFileCreateELFTraits>(
-            atomizeStrings, llvm::ELF::EM_PPC) {}
-};
-
-class PPCELFDSOReader
-    : public ELFDSOReader<PPCELFType, PPCDynamicFileCreateELFTraits> {
-public:
-  PPCELFDSOReader(bool useUndefines)
-      : ELFDSOReader<PPCELFType, PPCDynamicFileCreateELFTraits>(
-            useUndefines, llvm::ELF::EM_PPC) {}
-};
-
-} // namespace elf
-} // namespace lld
-
-#endif // LLD_READER_WRITER_PPC_PPC_ELF_READER_H
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp
deleted file mode 100644 (file)
index 8b72e2e..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-//===- lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp ---------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PPCLinkingContext.h"
-#include "PPCTargetHandler.h"
-#include "lld/Core/LLVM.h"
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/ErrorOr.h"
-
-using namespace lld;
-
-std::unique_ptr<ELFLinkingContext>
-elf::PPCLinkingContext::create(llvm::Triple triple) {
-  if (triple.getArch() == llvm::Triple::ppc)
-    return std::unique_ptr<ELFLinkingContext>(
-             new elf::PPCLinkingContext(triple));
-  return nullptr;
-}
-
-elf::PPCLinkingContext::PPCLinkingContext(llvm::Triple triple)
-    : ELFLinkingContext(triple, std::unique_ptr<TargetHandlerBase>(
-                        new PPCTargetHandler(*this))) {}
-
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h b/lld/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h
deleted file mode 100644 (file)
index a80e482..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-//===- lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h -----------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_READER_WRITER_ELF_PPC_PPC_LINKING_CONTEXT_H
-#define LLD_READER_WRITER_ELF_PPC_PPC_LINKING_CONTEXT_H
-
-#include "lld/ReaderWriter/ELFLinkingContext.h"
-#include "llvm/Object/ELF.h"
-#include "llvm/Support/ELF.h"
-
-namespace lld {
-namespace elf {
-
-class PPCLinkingContext final : public ELFLinkingContext {
-public:
-  static std::unique_ptr<ELFLinkingContext> create(llvm::Triple);
-  PPCLinkingContext(llvm::Triple triple);
-
-  /// \brief PPC has no relative relocations defined
-  bool isRelativeReloc(const Reference &) const override { return false; }
-};
-
-} // elf
-} // lld
-
-#endif // LLD_READER_WRITER_ELF_PPC_PPC_LINKING_CONTEXT_H
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
deleted file mode 100644 (file)
index 69463e3..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-//===- lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp ----------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "PPCTargetHandler.h"
-#include "PPCLinkingContext.h"
-
-using namespace lld;
-using namespace elf;
-
-using namespace llvm::ELF;
-
-/// \brief The following relocation routines are derived from the
-///  SYSTEM V APPLICATION BINARY INTERFACE: PowerPC Processor Supplement
-/// Symbols used:
-///  A: Added used to compute the value, r_addend
-///  P: Place address of the field being relocated, r_offset
-///  S: Value of the symbol whose index resides in the relocation entry.
-
-/// \brief low24 (S + A - P) >> 2 : Verify
-static int relocB24PCREL(uint8_t *location, uint64_t P, uint64_t S,
-                         uint64_t A) {
-  int32_t result = (uint32_t)(((S + A) - P));
-  if ((result < 0x1000000) && (result > -0x1000000)) {
-    result &= ~-(0x1000000);
-    *reinterpret_cast<llvm::support::ubig32_t *>(location) = result |
-               (uint32_t)*reinterpret_cast<llvm::support::ubig32_t *>(location);
-    return 0;
-  }
-  return 1;
-}
-
-std::error_code PPCTargetRelocationHandler::applyRelocation(
-    ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
-    const Reference &ref) const {
-  uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
-  uint8_t *location = atomContent + ref.offsetInAtom();
-  uint64_t targetVAddress = writer.addressOfAtom(ref.target());
-  uint64_t relocVAddress = atom._virtualAddr + ref.offsetInAtom();
-
-  if (ref.kindNamespace() != Reference::KindNamespace::ELF)
-    return std::error_code();
-  assert(ref.kindArch() == Reference::KindArch::PowerPC);
-  switch (ref.kindValue()) {
-  case R_PPC_REL24:
-    relocB24PCREL(location, relocVAddress, targetVAddress, ref.addend());
-    break;
-
-  default:
-    return make_unhandled_reloc_error();
-  }
-
-  return std::error_code();
-}
-
-PPCTargetHandler::PPCTargetHandler(PPCLinkingContext &context)
-    : _ppcLinkingContext(context),
-      _ppcTargetLayout(new PPCTargetLayout<PPCELFType>(context)),
-      _ppcRelocationHandler(new PPCTargetRelocationHandler()) {}
-
-void PPCTargetHandler::registerRelocationNames(Registry &registry) {
-  registry.addKindTable(Reference::KindNamespace::ELF,
-                        Reference::KindArch::PowerPC, kindStrings);
-}
-
-std::unique_ptr<Writer> PPCTargetHandler::getWriter() {
-  switch (_ppcLinkingContext.getOutputELFType()) {
-  case llvm::ELF::ET_EXEC:
-    return std::unique_ptr<Writer>(new elf::ExecutableWriter<PPCELFType>(
-        _ppcLinkingContext, *_ppcTargetLayout.get()));
-  case llvm::ELF::ET_DYN:
-    return std::unique_ptr<Writer>(new elf::DynamicLibraryWriter<PPCELFType>(
-        _ppcLinkingContext, *_ppcTargetLayout.get()));
-  case llvm::ELF::ET_REL:
-    llvm_unreachable("TODO: support -r mode");
-  default:
-    llvm_unreachable("unsupported output type");
-  }
-}
-
-#define ELF_RELOC(name, value) LLD_KIND_STRING_ENTRY(name),
-
-const Registry::KindStrings PPCTargetHandler::kindStrings[] = {
-#include "llvm/Support/ELFRelocs/PowerPC.def"
-  LLD_KIND_STRING_END
-};
-
-#undef ELF_RELOC
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h b/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
deleted file mode 100644 (file)
index cd037b7..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-//===- lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h ------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_READER_WRITER_ELF_PPC_PPC_TARGET_HANDLER_H
-#define LLD_READER_WRITER_ELF_PPC_PPC_TARGET_HANDLER_H
-
-#include "DefaultTargetHandler.h"
-#include "PPCELFReader.h"
-#include "TargetLayout.h"
-
-namespace lld {
-namespace elf {
-class PPCLinkingContext;
-
-template <class ELFT> class PPCTargetLayout : public TargetLayout<ELFT> {
-public:
-  PPCTargetLayout(PPCLinkingContext &context) : TargetLayout<ELFT>(context) {}
-};
-
-class PPCTargetRelocationHandler final : public TargetRelocationHandler {
-public:
-  std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
-                                  const lld::AtomLayout &,
-                                  const Reference &) const override;
-};
-
-class PPCTargetHandler final
-    : public DefaultTargetHandler<PPCELFType> {
-public:
-  PPCTargetHandler(PPCLinkingContext &context);
-
-  PPCTargetLayout<PPCELFType> &getTargetLayout() override {
-    return *(_ppcTargetLayout.get());
-  }
-
-  void registerRelocationNames(Registry &registry) override;
-
-  const PPCTargetRelocationHandler &getRelocationHandler() const override {
-    return *(_ppcRelocationHandler.get());
-  }
-
-  std::unique_ptr<Reader> getObjReader(bool atomizeStrings) override {
-    return std::unique_ptr<Reader>(new PPCELFObjectReader(atomizeStrings));
-  }
-
-  std::unique_ptr<Reader> getDSOReader(bool useShlibUndefines) override {
-    return std::unique_ptr<Reader>(new PPCELFDSOReader(useShlibUndefines));
-  }
-
-  std::unique_ptr<Writer> getWriter() override;
-
-private:
-  static const Registry::KindStrings kindStrings[];
-  PPCLinkingContext &_ppcLinkingContext;
-  std::unique_ptr<PPCTargetLayout<PPCELFType>> _ppcTargetLayout;
-  std::unique_ptr<PPCTargetRelocationHandler> _ppcRelocationHandler;
-};
-} // end namespace elf
-} // end namespace lld
-
-#endif
diff --git a/lld/test/elf/ppc.test b/lld/test/elf/ppc.test
deleted file mode 100644 (file)
index dd501f6..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-RUN: lld -flavor gnu -target powerpc  %p/Inputs/branch-test.ppc %p/Inputs/target-test.ppc -o %t1 --noinhibit-exec
-RUN: llvm-readobj -h %t1 |  FileCheck -check-prefix=ppc-readobj %s
-
-
-ppc-readobj: ElfHeader {
-ppc-readobj:   Ident {
-ppc-readobj:     Class: 32-bit (0x1)
-ppc-readobj:     DataEncoding: BigEndian (0x2)
-ppc-readobj:     FileVersion: 1
-ppc-readobj:     OS/ABI: SystemV (0x0)
-ppc-readobj:     ABIVersion: 0
-ppc-readobj:   }
-ppc-readobj:   Type: Executable (0x2)
-ppc-readobj:   Machine: EM_PPC (0x14)
index 47b408b..3b3d16a 100644 (file)
@@ -22,7 +22,7 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD)
 USEDLIBS = lldDriver.a lldConfig.a \
            lldELF.a lldMachO.a lldPasses.a lldPECOFF.a lldYAML.a \
            lldReaderWriter.a lldCore.a lldNative.a \
-           lldHexagonELFTarget.a lldPPCELFTarget.a lldMipsELFTarget.a \
+           lldHexagonELFTarget.a lldMipsELFTarget.a \
            lldX86ELFTarget.a lldX86_64ELFTarget.a lldAArch64ELFTarget.a \
            lldARMELFTarget.a \
            LLVMOption.a