forked from OSchip/llvm-project
[ELF][Hexagon] Create .got.plt entries with the appropriate alignment
llvm-svn: 178467
This commit is contained in:
parent
cbe06ca340
commit
1d9e531856
|
@ -54,6 +54,9 @@ void DynamicLibraryWriter<ELFT>::buildDynamicSymbolTable(const File &file) {
|
|||
atom->_virtualAddr, atom);
|
||||
}
|
||||
|
||||
for (const UndefinedAtom *a : file.undefined())
|
||||
this->_dynamicSymbolTable->addSymbol(a, ELF::SHN_UNDEF);
|
||||
|
||||
OutputELFWriter<ELFT>::buildDynamicSymbolTable(file);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,27 +17,29 @@ namespace lld {
|
|||
namespace elf {
|
||||
|
||||
class HexagonGOTAtom : public GOTAtom {
|
||||
static const uint8_t _defaultContent[8];
|
||||
static const uint8_t _defaultContent[4];
|
||||
|
||||
public:
|
||||
HexagonGOTAtom(const File &f) : GOTAtom(f, ".got") {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
return ArrayRef<uint8_t>(_defaultContent, 8);
|
||||
return ArrayRef<uint8_t>(_defaultContent, 4);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(2); }
|
||||
};
|
||||
|
||||
class HexagonGOTPLTAtom : public GOTAtom {
|
||||
static const uint8_t _defaultContent[8];
|
||||
static const uint8_t _defaultContent[4];
|
||||
|
||||
public:
|
||||
HexagonGOTPLTAtom(const File &f) : GOTAtom(f, ".got.plt") {}
|
||||
|
||||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
return ArrayRef<uint8_t>(_defaultContent, 8);
|
||||
return ArrayRef<uint8_t>(_defaultContent, 4);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(2); }
|
||||
};
|
||||
|
||||
class HexagonGOTPLT0Atom : public GOTAtom {
|
||||
|
@ -49,10 +51,12 @@ public:
|
|||
virtual ArrayRef<uint8_t> rawContent() const {
|
||||
return ArrayRef<uint8_t>(_defaultContent, 16);
|
||||
}
|
||||
|
||||
virtual Alignment alignment() const { return Alignment(3); }
|
||||
};
|
||||
|
||||
const uint8_t HexagonGOTAtom::_defaultContent[8] = { 0 };
|
||||
const uint8_t HexagonGOTPLTAtom::_defaultContent[8] = { 0 };
|
||||
const uint8_t HexagonGOTAtom::_defaultContent[4] = { 0 };
|
||||
const uint8_t HexagonGOTPLTAtom::_defaultContent[4] = { 0 };
|
||||
const uint8_t HexagonGOTPLT0Atom::_defaultContent[16] = { 0 };
|
||||
|
||||
class HexagonPLTAtom : public PLTAtom {
|
||||
|
|
|
@ -38,6 +38,7 @@ template <class Derived> class GOTPLTPass : public Pass {
|
|||
void handleReference(const DefinedAtom &atom, const Reference &ref) {
|
||||
switch (ref.kind()) {
|
||||
case R_HEX_PLT_B22_PCREL:
|
||||
case R_HEX_B22_PCREL:
|
||||
static_cast<Derived *>(this)->handlePLT32(ref);
|
||||
break;
|
||||
case R_HEX_GOT_LO16:
|
||||
|
|
|
@ -10,7 +10,7 @@ CHECKGOTPLT: alignment: 2^3
|
|||
CHECKGOTPLT: section-name: .got.plt
|
||||
- name: __got_c
|
||||
CHECKGOTPLT: type: got
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^2
|
||||
CHECKGOTPLT: section-name: .got
|
||||
CHECKGOTPLT: permissions: rw-
|
||||
|
@ -20,7 +20,7 @@ CHECKGOTPLT: offset: 0
|
|||
CHECKGOTPLT: target: c
|
||||
- name: __got_shankar
|
||||
CHECKGOTPLT: type: got
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^2
|
||||
CHECKGOTPLT: section-name: .got
|
||||
CHECKGOTPLT: permissions: rw-
|
||||
|
@ -30,8 +30,8 @@ CHECKGOTPLT: offset: 0
|
|||
CHECKGOTPLT: target: shankar
|
||||
- name: __got_fn
|
||||
CHECKGOTPLT: type: got
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^3
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^2
|
||||
CHECKGOTPLT: section-name: .got.plt
|
||||
CHECKGOTPLT: permissions: rw-
|
||||
CHECKGOTPLT: references:
|
||||
|
@ -43,8 +43,8 @@ CHECKGOTPLT: offset: 0
|
|||
target: .PLT0
|
||||
- name: __got_fn1
|
||||
CHECKGOTPLT: type: got
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^3
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^2
|
||||
CHECKGOTPLT: section-name: .got.plt
|
||||
CHECKGOTPLT: permissions: rw-
|
||||
CHECKGOTPLT: references:
|
||||
|
@ -56,8 +56,8 @@ CHECKGOTPLT: offset: 0
|
|||
target: .PLT0
|
||||
- name: __got_fn2
|
||||
CHECKGOTPLT: type: got
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^3
|
||||
CHECKGOTPLT: content: [ 00, 00, 00, 00 ]
|
||||
CHECKGOTPLT: alignment: 2^2
|
||||
CHECKGOTPLT: section-name: .got.plt
|
||||
CHECKGOTPLT: permissions: rw-
|
||||
CHECKGOTPLT: references:
|
||||
|
|
|
@ -4,6 +4,6 @@ RUN: llvm-objdump -s %t > %t1
|
|||
RUN: FileCheck -check-prefix=CHECKHASH %s < %t1
|
||||
|
||||
CHECKHASH: Contents of section .hash:
|
||||
CHECKHASH: 00b4 03000000 06000000 05000000 01000000 ................
|
||||
CHECKHASH: 00c4 04000000 00000000 00000000 00000000 ................
|
||||
CHECKHASH: 00d4 00000000 03000000 02000000 ............
|
||||
CHECKHASH: 00b4 03000000 07000000 06000000 01000000 ................
|
||||
CHECKHASH: 00c4 04000000 00000000 00000000 00000000 ................
|
||||
CHECKHASH: 00d4 00000000 03000000 02000000 05000000 ................
|
||||
|
|
|
@ -3,6 +3,6 @@ RUN: -output=%t -output=%t -noinhibit-exec -output-type=shared
|
|||
RUN: llvm-nm -n -s %t > %t1
|
||||
RUN: FileCheck -check-prefix=CHECKSYMS %s < %t1
|
||||
|
||||
CHECKSYMS: 00000288 A _DYNAMIC
|
||||
CHECKSYMS: 00001010 A _GLOBAL_OFFSET_TABLE_
|
||||
CHECKSYMS: 000002a8 A _DYNAMIC
|
||||
CHECKSYMS: 00001008 A _GLOBAL_OFFSET_TABLE_
|
||||
CHECKSYMS: 00002000 A _SDA_BASE_
|
||||
|
|
Loading…
Reference in New Issue