Files
clang-p2996/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h
Will Newton 4c81bb7e3f ELF: Add a standard method for unknown relocation errors
At present each TargetRelocationHandler generates a pretty similar error
string and calls llvm_unreachable() when encountering an unknown
relocation. This is not ideal for two reasons:

1. llvm_unreachable disappears in release builds but we still want to
   know if we encountered a relocation we couldn't handle in release
   builds.

2. Duplication is bad - there is no need to have a per-architecture error
   message.

This change adds a test for AArch64 to test whether or not the error
message actually works. The other architectures have not been tested
but they compile and check-lld passes.

llvm-svn: 223782
2014-12-09 16:29:39 +00:00

39 lines
1.2 KiB
C++

//===- lld/ReaderWriter/ELF/Mips/MipsRelocationHandler.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_MIPS_MIPS_RELOCATION_HANDLER_H
#define LLD_READER_WRITER_ELF_MIPS_MIPS_RELOCATION_HANDLER_H
#include "MipsLinkingContext.h"
namespace lld {
namespace elf {
class MipsTargetHandler;
class MipsTargetRelocationHandler final
: public TargetRelocationHandler<Mips32ElELFType> {
public:
MipsTargetRelocationHandler(MipsTargetLayout<Mips32ElELFType> &layout,
ELFLinkingContext &targetInfo)
: TargetRelocationHandler<Mips32ElELFType>(targetInfo),
_mipsTargetLayout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const Reference &) const override;
private:
MipsTargetLayout<Mips32ElELFType> &_mipsTargetLayout;
};
} // elf
} // lld
#endif