]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/ReaderWriter/ELF/Reader.cpp
Vendor import of lld trunk r233088:
[FreeBSD/FreeBSD.git] / lib / ReaderWriter / ELF / Reader.cpp
1 //===- lib/ReaderWriter/ELF/Reader.cpp ------------------------------------===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief Defines the ELF Reader and all helper sub classes to consume an ELF
12 /// file and produces atoms out of it.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #include "ELFReader.h"
17 #include <map>
18 #include <vector>
19
20 using llvm::support::endianness;
21 using namespace llvm::object;
22
23 namespace lld {
24
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) {
30
31   // Tell registry about the ELF object file parser.
32   add(std::move(ctx.targetHandler()->getObjReader()));
33
34   // Tell registry about the relocation name to number mapping for this arch.
35   ctx.targetHandler()->registerRelocationNames(*this);
36 }
37
38 void Registry::addSupportELFDynamicSharedObjects(ELFLinkingContext &ctx) {
39   // Tell registry about the ELF dynamic shared library file parser.
40   add(ctx.targetHandler()->getDSOReader());
41 }
42
43 } // end namespace lld