Files
clang-p2996/lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
Denis Protivensky 2b5539651b [lld] Correct forming of ARM/Thumb atoms
Symbols addressing Thumb code have zero bit set in st_value to distinguish them from ARM instructions.
This caused wrong atoms' forming because of offset of one byte brought in by that corrected st_value.

Fixed reading of st_value & st_value-related things in ARMELFFile while forming atoms.
Symbol table generation is also fixed for Thumb atoms.

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

llvm-svn: 227174
2015-01-27 07:39:04 +00:00

71 lines
2.1 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"
#include "ARMTargetHandler.h"
#include "ARMSymbolTable.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();
}
/// \brief Create symbol table.
LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) createSymbolTable() override;
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;
}
template <class ELFT>
LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)
ARMExecutableWriter<ELFT>::createSymbolTable() {
return LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>)(
new (this->_alloc) ARMSymbolTable<ELFT>(this->_context));
}
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_ELF_ARM_ARM_EXECUTABLE_WRITER_H