Files
clang-p2996/lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
Greg Fitzgerald 8a1887f1f1 [ELF] Minimal implementation for ARM static linking
The code is able to statically link the simplest case of:

  int main() { return 0; }

* Only works with ARM code - no Thumb code, no interwork (-marm -mno-thumb-interwork)
* musl libc built with no interwork and no Thumb code

Differential Revision: http://reviews.llvm.org/D6716

From: Denis Protivensky <dprotivensky@accesssoftek.com>
llvm-svn: 226643
2015-01-21 07:35:48 +00:00

59 lines
1.7 KiB
C++

//===--------- lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.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_ARM_ARM_EXECUTABLE_WRITER_H
#define LLD_READER_WRITER_ELF_ARM_ARM_EXECUTABLE_WRITER_H
#include "ExecutableWriter.h"
#include "ARMLinkingContext.h"
namespace lld {
namespace elf {
template <class ELFT>
class ARMExecutableWriter : public ExecutableWriter<ELFT> {
public:
ARMExecutableWriter(ARMLinkingContext &context,
ARMTargetLayout<ELFT> &layout);
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override {
// Finalize the atom values that are part of the parent.
ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
}
void addDefaultAtoms() override {
ExecutableWriter<ELFT>::addDefaultAtoms();
}
private:
ARMLinkingContext &_context;
ARMTargetLayout<ELFT> &_armLayout;
};
template <class ELFT>
ARMExecutableWriter<ELFT>::ARMExecutableWriter(ARMLinkingContext &context,
ARMTargetLayout<ELFT> &layout)
: ExecutableWriter<ELFT>(context, layout), _context(context),
_armLayout(layout) {}
template <class ELFT>
bool ARMExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
return true;
}
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_ELF_ARM_ARM_EXECUTABLE_WRITER_H