1 //===- lib/ReaderWriter/ELF/Reader.cpp ------------------------------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Defines the ELF Reader and all helper sub classes to consume an ELF
12 /// file and produces atoms out of it.
14 //===----------------------------------------------------------------------===//
16 #include "ELFReader.h"
20 using llvm::support::endianness;
21 using namespace llvm::object;
25 // This dynamic registration of a handler causes support for all ELF
26 // architectures to be pulled into the linker. If we want to support making a
27 // linker that only supports one ELF architecture, we'd need to change this
28 // to have a different registration method for each architecture.
29 void Registry::addSupportELFObjects(ELFLinkingContext &ctx) {
31 // Tell registry about the ELF object file parser.
32 add(std::move(ctx.targetHandler()->getObjReader()));
34 // Tell registry about the relocation name to number mapping for this arch.
35 ctx.targetHandler()->registerRelocationNames(*this);
38 void Registry::addSupportELFDynamicSharedObjects(ELFLinkingContext &ctx) {
39 // Tell registry about the ELF dynamic shared library file parser.
40 add(ctx.targetHandler()->getDSOReader());
43 } // end namespace lld