llvm-project/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h
Adhemerval Zanella f3c1c065aa [ELF/AArch64] Fix local TLS relocations
This patch fixes the R_AARCH64_TLSLE_ADD_TPREL_HI12 and R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
handling by using the correct offset by using the target layout along with
aarch64 alignments requirements.

It fixes the TLS test-suite SingleSource failures for aarch64:

* SingleSource/UnitTests/Threads/2010-12-08-tls.execution_time
* SingleSource/UnitTests/Threads/tls.execution_time

llvm-svn: 238258
2015-05-26 21:49:39 +00:00

39 lines
1.1 KiB
C++

//===- lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h ------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef AARCH64_RELOCATION_HANDLER_H
#define AARCH64_RELOCATION_HANDLER_H
#include "lld/ReaderWriter/ELFLinkingContext.h"
namespace lld {
namespace elf {
class AArch64TargetLayout;
class AArch64TargetRelocationHandler final : public TargetRelocationHandler {
public:
AArch64TargetRelocationHandler(AArch64TargetLayout &layout)
: _layout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const AtomLayout &,
const Reference &) const override;
private:
// Cached size of the TLS segment.
mutable uint64_t _tlsSize = 0;
AArch64TargetLayout &_layout;
};
} // end namespace elf
} // end namespace lld
#endif // AArch64_RELOCATION_HANDLER_H