<div dir="ltr">So this is only +178 line patch excluding tests, but it added a new architecture to the linker with dynamic linking support. Nice!</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 7, 2016 at 2:31 AM, Peter Smith via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: psmith<br>
Date: Tue Jun 7 04:31:52 2016<br>
New Revision: 271993<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=271993&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=271993&view=rev</a><br>
Log:<br>
Initial support for ARM in lld.<br>
<br>
Add support for an ARM Target and the initial set of relocations<br>
and PLT entries that are necessary for an ARM only hello world to<br>
link. This has been tested against an ARM only sysroot from the<br>
4.2.0 CodeSourcery Lite release.<br>
<br>
Tests have been added to test/ELF for the support that has been<br>
implemented.<br>
<br>
Main limitations:<br>
- No Thumb support<br>
- Relocations incomplete<br>
- No C++ exceptions support<br>
- No TLS support<br>
- No range extension or interworking veneer (thunk) support<br>
- No Build Attribute support<br>
- No Big-endian support<br>
<br>
The deprecated relocations R_ARM_PLT32 and R_ARM_PC24 have been<br>
implemented as these are used by the 4.2.0 CodeSourcery Lite release.<br>
<br>
<br>
Added:<br>
lld/trunk/test/ELF/Inputs/arm-plt-reloc.s (with props)<br>
lld/trunk/test/ELF/Inputs/far-arm-abs.s (with props)<br>
lld/trunk/test/ELF/Inputs/relocation-copy-arm.s (with props)<br>
lld/trunk/test/ELF/arm-abs32-dyn.s (with props)<br>
lld/trunk/test/ELF/arm-attributes-remove.s (with props)<br>
lld/trunk/test/ELF/arm-branch-error.s (with props)<br>
lld/trunk/test/ELF/arm-branch.s (with props)<br>
lld/trunk/test/ELF/arm-copy.s (with props)<br>
lld/trunk/test/ELF/arm-data-prel.s (with props)<br>
lld/trunk/test/ELF/arm-data-relocs.s (with props)<br>
lld/trunk/test/ELF/arm-fpic-got.s (with props)<br>
lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s (with props)<br>
lld/trunk/test/ELF/arm-gnu-ifunc.s (with props)<br>
lld/trunk/test/ELF/arm-got-relative.s (with props)<br>
lld/trunk/test/ELF/arm-gotoff.s (with props)<br>
lld/trunk/test/ELF/arm-mov-relocs.s (with props)<br>
lld/trunk/test/ELF/arm-plt-reloc.s (with props)<br>
Modified:<br>
lld/trunk/ELF/Driver.cpp<br>
lld/trunk/ELF/InputFiles.cpp<br>
lld/trunk/ELF/Target.cpp<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=271993&r1=271992&r2=271993&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=271993&r1=271992&r2=271993&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Tue Jun 7 04:31:52 2016<br>
@@ -71,6 +71,8 @@ static std::pair<ELFKind, uint16_t> pars<br>
return {ELF64LEKind, EM_X86_64};<br>
if (S == "aarch64linux")<br>
return {ELF64LEKind, EM_AARCH64};<br>
+ if (S == "armelf_linux_eabi")<br>
+ return {ELF32LEKind, EM_ARM};<br>
if (S == "i386pe" || S == "i386pep" || S == "thumb2pe")<br>
error("Windows targets are not supported on the ELF frontend: " + S);<br>
else<br>
<br>
Modified: lld/trunk/ELF/InputFiles.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=271993&r1=271992&r2=271993&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=271993&r1=271992&r2=271993&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/InputFiles.cpp (original)<br>
+++ lld/trunk/ELF/InputFiles.cpp Tue Jun 7 04:31:52 2016<br>
@@ -244,6 +244,11 @@ void elf::ObjectFile<ELFT>::initializeSe<br>
}<br>
fatal("relocations pointing to SHF_MERGE are not supported");<br>
}<br>
+ case SHT_ARM_ATTRIBUTES:<br>
+ // FIXME: ARM meta-data section. At present attributes are ignored,<br>
+ // they can be used to reason about object compatibility.<br>
+ Sections[I] = &InputSection<ELFT>::Discarded;<br>
+ break;<br>
default:<br>
Sections[I] = createInputSection(Sec);<br>
}<br>
<br>
Modified: lld/trunk/ELF/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=271993&r1=271992&r2=271993&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=271993&r1=271992&r2=271993&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Target.cpp (original)<br>
+++ lld/trunk/ELF/Target.cpp Tue Jun 7 04:31:52 2016<br>
@@ -170,6 +170,19 @@ public:<br>
RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const override;<br>
};<br>
<br>
+class ARMTargetInfo final : public TargetInfo {<br>
+public:<br>
+ ARMTargetInfo();<br>
+ RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const override;<br>
+ uint32_t getDynRel(uint32_t Type) const override;<br>
+ uint64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const override;<br>
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;<br>
+ void writePltZero(uint8_t *Buf) const override;<br>
+ void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr,<br>
+ int32_t Index, unsigned RelOff) const override;<br>
+ void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;<br>
+};<br>
+<br>
template <class ELFT> class MipsTargetInfo final : public TargetInfo {<br>
public:<br>
MipsTargetInfo();<br>
@@ -196,6 +209,8 @@ TargetInfo *createTarget() {<br>
return new AArch64TargetInfo();<br>
case EM_AMDGPU:<br>
return new AMDGPUTargetInfo();<br>
+ case EM_ARM:<br>
+ return new ARMTargetInfo();<br>
case EM_MIPS:<br>
switch (Config->EKind) {<br>
case ELF32LEKind:<br>
@@ -1427,6 +1442,162 @@ RelExpr AMDGPUTargetInfo::getRelExpr(uin<br>
llvm_unreachable("not implemented");<br>
}<br>
<br>
+ARMTargetInfo::ARMTargetInfo() {<br>
+ CopyRel = R_ARM_COPY;<br>
+ RelativeRel = R_ARM_RELATIVE;<br>
+ IRelativeRel = R_ARM_IRELATIVE;<br>
+ GotRel = R_ARM_GLOB_DAT;<br>
+ PltRel = R_ARM_JUMP_SLOT;<br>
+ TlsGotRel = R_ARM_TLS_TPOFF32;<br>
+ TlsModuleIndexRel = R_ARM_TLS_DTPMOD32;<br>
+ TlsOffsetRel = R_ARM_TLS_DTPOFF32;<br>
+ PltEntrySize = 16;<br>
+ PltZeroSize = 20;<br>
+}<br>
+<br>
+RelExpr ARMTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {<br>
+ switch (Type) {<br>
+ default:<br>
+ return R_ABS;<br>
+ case R_ARM_CALL:<br>
+ case R_ARM_JUMP24:<br>
+ case R_ARM_PC24:<br>
+ case R_ARM_PLT32:<br>
+ return R_PLT_PC;<br>
+ case R_ARM_GOTOFF32:<br>
+ // (S + A) - GOT_ORG<br>
+ return R_GOTREL;<br>
+ case R_ARM_GOT_BREL:<br>
+ // GOT(S) + A - GOT_ORG<br>
+ return R_GOT_OFF;<br>
+ case R_ARM_GOT_PREL:<br>
+ // GOT(S) + - GOT_ORG<br>
+ return R_GOT_PC;<br>
+ case R_ARM_BASE_PREL:<br>
+ // B(S) + A - P<br>
+ // FIXME: currently B(S) assumed to be .got, this may not hold for all<br>
+ // platforms.<br>
+ return R_GOTONLY_PC;<br>
+ case R_ARM_PREL31:<br>
+ case R_ARM_REL32:<br>
+ return R_PC;<br>
+ }<br>
+}<br>
+<br>
+uint32_t ARMTargetInfo::getDynRel(uint32_t Type) const {<br>
+ if (Type == R_ARM_ABS32)<br>
+ return Type;<br>
+ StringRef S = getELFRelocationTypeName(EM_ARM, Type);<br>
+ error("relocation " + S + " cannot be used when making a shared object; "<br>
+ "recompile with -fPIC.");<br>
+ // Keep it going with a dummy value so that we can find more reloc errors.<br>
+ return R_ARM_ABS32;<br>
+}<br>
+<br>
+void ARMTargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {<br>
+ write32le(Buf, Out<ELF32LE>::Plt->getVA());<br>
+}<br>
+<br>
+void ARMTargetInfo::writePltZero(uint8_t *Buf) const {<br>
+ const uint8_t PltData[] = {<br>
+ 0x04, 0xe0, 0x2d, 0xe5, // str lr, [sp,#-4]!<br>
+ 0x04, 0xe0, 0x9f, 0xe5, // ldr lr, L2<br>
+ 0x0e, 0xe0, 0x8f, 0xe0, // L1: add lr, pc, lr<br>
+ 0x08, 0xf0, 0xbe, 0xe5, // ldr pc, [lr, #8]<br>
+ 0x00, 0x00, 0x00, 0x00, // L2: .word &(.got.plt) - L1 - 8<br>
+ };<br>
+ memcpy(Buf, PltData, sizeof(PltData));<br>
+ uint64_t GotPlt = Out<ELF32LE>::GotPlt->getVA();<br>
+ uint64_t L1 = Out<ELF32LE>::Plt->getVA() + 8;<br>
+ write32le(Buf + 16, GotPlt - L1 - 8);<br>
+}<br>
+<br>
+void ARMTargetInfo::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,<br>
+ uint64_t PltEntryAddr, int32_t Index,<br>
+ unsigned RelOff) const {<br>
+ // FIXME: Using simple code sequence with simple relocations.<br>
+ // There is a more optimal sequence but it requires support for the group<br>
+ // relocations. See ELF for the ARM Architecture Appendix A.3<br>
+ const uint8_t PltData[] = {<br>
+ 0x04, 0xc0, 0x9f, 0xe5, // ldr ip, L2<br>
+ 0x0f, 0xc0, 0x8c, 0xe0, // L1: add ip, ip, pc<br>
+ 0x00, 0xf0, 0x9c, 0xe5, // ldr pc, [ip]<br>
+ 0x00, 0x00, 0x00, 0x00, // L2: .word Offset(&(.plt.got) - L1 - 8<br>
+ };<br>
+ memcpy(Buf, PltData, sizeof(PltData));<br>
+ uint64_t L1 = PltEntryAddr + 4;<br>
+ write32le(Buf + 12, GotEntryAddr - L1 - 8);<br>
+}<br>
+<br>
+void ARMTargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,<br>
+ uint64_t Val) const {<br>
+ switch (Type) {<br>
+ case R_ARM_NONE:<br>
+ break;<br>
+ case R_ARM_ABS32:<br>
+ case R_ARM_BASE_PREL:<br>
+ case R_ARM_GOTOFF32:<br>
+ case R_ARM_GOT_BREL:<br>
+ case R_ARM_GOT_PREL:<br>
+ case R_ARM_REL32:<br>
+ write32le(Loc, Val);<br>
+ break;<br>
+ case R_ARM_PREL31:<br>
+ checkInt<31>(Val, Type);<br>
+ write32le(Loc, (read32le(Loc) & 0x80000000) | (Val & ~0x80000000));<br>
+ break;<br>
+ case R_ARM_CALL:<br>
+ case R_ARM_JUMP24:<br>
+ case R_ARM_PC24:<br>
+ case R_ARM_PLT32:<br>
+ checkInt<26>(Val, Type);<br>
+ write32le(Loc, (read32le(Loc) & ~0x00ffffff) | ((Val >> 2) & 0x00ffffff));<br>
+ break;<br>
+ case R_ARM_MOVW_ABS_NC:<br>
+ write32le(Loc, (read32le(Loc) & ~0x000f0fff) | ((Val & 0xf000) << 4) |<br>
+ (Val & 0x0fff));<br>
+ break;<br>
+ case R_ARM_MOVT_ABS:<br>
+ checkUInt<32>(Val, Type);<br>
+ write32le(Loc, (read32le(Loc) & ~0x000f0fff) |<br>
+ (((Val >> 16) & 0xf000) << 4) | ((Val >> 16) & 0xfff));<br>
+ break;<br>
+ default:<br>
+ fatal("unrecognized reloc " + Twine(Type));<br>
+ }<br>
+}<br>
+<br>
+uint64_t ARMTargetInfo::getImplicitAddend(const uint8_t *Buf,<br>
+ uint32_t Type) const {<br>
+ switch (Type) {<br>
+ default:<br>
+ return 0;<br>
+ case R_ARM_ABS32:<br>
+ case R_ARM_BASE_PREL:<br>
+ case R_ARM_GOTOFF32:<br>
+ case R_ARM_GOT_BREL:<br>
+ case R_ARM_GOT_PREL:<br>
+ case R_ARM_REL32:<br>
+ return SignExtend64<32>(read32le(Buf));<br>
+ break;<br>
+ case R_ARM_PREL31:<br>
+ return SignExtend64<31>(read32le(Buf));<br>
+ break;<br>
+ case R_ARM_CALL:<br>
+ case R_ARM_JUMP24:<br>
+ case R_ARM_PC24:<br>
+ case R_ARM_PLT32:<br>
+ return SignExtend64<26>((read32le(Buf) & 0x00ffffff) << 2);<br>
+ case R_ARM_MOVW_ABS_NC:<br>
+ case R_ARM_MOVT_ABS: {<br>
+ // ELF for the ARM Architecture 4.6.1.1 the implicit addend for MOVW and<br>
+ // MOVT is in the range -32768 <= A < 32768<br>
+ uint64_t Val = read32le(Buf) & 0x000f0fff;<br>
+ return SignExtend64<16>(((Val & 0x000f0000) >> 4) | (Val & 0x00fff));<br>
+ }<br>
+ }<br>
+}<br>
+<br>
template <class ELFT> MipsTargetInfo<ELFT>::MipsTargetInfo() {<br>
GotPltHeaderEntriesNum = 2;<br>
PageSize = 65536;<br>
<br>
Added: lld/trunk/test/ELF/Inputs/arm-plt-reloc.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/arm-plt-reloc.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/arm-plt-reloc.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/Inputs/arm-plt-reloc.s (added)<br>
+++ lld/trunk/test/ELF/Inputs/arm-plt-reloc.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,14 @@<br>
+.text<br>
+ .align 2<br>
+ .globl func1<br>
+ .type func1,%function<br>
+func1:<br>
+ bx lr<br>
+ .globl func2<br>
+ .type func2,%function<br>
+func2:<br>
+ bx lr<br>
+ .globl func3<br>
+ .type func3,%function<br>
+func3:<br>
+ bx lr<br>
<br>
Propchange: lld/trunk/test/ELF/Inputs/arm-plt-reloc.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/Inputs/arm-plt-reloc.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/Inputs/far-arm-abs.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/far-arm-abs.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/far-arm-abs.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/Inputs/far-arm-abs.s (added)<br>
+++ lld/trunk/test/ELF/Inputs/far-arm-abs.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,13 @@<br>
+.global far<br>
+.type far,%function<br>
+far = 0x201001c<br>
+<br>
+.global too_far1<br>
+.type too_far1,%function<br>
+too_far1 = 0x2020008<br>
+.global too_far2<br>
+.type too_far2,%function<br>
+too_far2 = 0x202000c<br>
+.global too_far3<br>
+.type too_far3,%function<br>
+too_far3 = 0x2020010<br>
<br>
Propchange: lld/trunk/test/ELF/Inputs/far-arm-abs.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/Inputs/far-arm-abs.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/Inputs/relocation-copy-arm.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/relocation-copy-arm.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/relocation-copy-arm.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/Inputs/relocation-copy-arm.s (added)<br>
+++ lld/trunk/test/ELF/Inputs/relocation-copy-arm.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,22 @@<br>
+.bss<br>
+<br>
+.type x,%object<br>
+.globl x<br>
+.balign 16<br>
+x:<br>
+.long 0<br>
+.size x, 4<br>
+<br>
+.type y,%object<br>
+.globl y<br>
+.balign 16<br>
+y:<br>
+.long 0<br>
+.size y, 4<br>
+<br>
+.type z,%object<br>
+.globl z<br>
+.balign 4<br>
+z:<br>
+.long 0<br>
+.size z, 4<br>
<br>
Propchange: lld/trunk/test/ELF/Inputs/relocation-copy-arm.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/Inputs/relocation-copy-arm.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-abs32-dyn.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-abs32-dyn.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-abs32-dyn.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-abs32-dyn.s (added)<br>
+++ lld/trunk/test/ELF/arm-abs32-dyn.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,32 @@<br>
+// REQUIRES: arm<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux %s -o %t.o<br>
+<br>
+// Creates a R_ARM_ABS32 relocation against foo and bar, bar has hidden<br>
+// visibility so we expect a R_ARM_RELATIVE<br>
+ .syntax unified<br>
+ .globl foo<br>
+foo:<br>
+ .globl bar<br>
+ .hidden bar<br>
+bar:<br>
+<br>
+ .data<br>
+ .word foo<br>
+ .word bar<br>
+<br>
+// RUN: ld.lld -shared -o %t.so %t.o<br>
+// RUN: llvm-readobj -symbols -dyn-relocations %t.so | FileCheck %s<br>
+<br>
+// CHECK: Dynamic Relocations {<br>
+// CHECK-NEXT: 0x2004 R_ARM_RELATIVE<br>
+// CHECK-NEXT: 0x2000 R_ARM_ABS32 foo 0x0<br>
+// CHECK-NEXT: }<br>
+<br>
+// CHECK: Symbols [<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: bar<br>
+// CHECK-NEXT: Value: 0x1000<br>
+<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: foo<br>
+// CHECK-NEXT: Value: 0x1000<br>
<br>
Propchange: lld/trunk/test/ELF/arm-abs32-dyn.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-abs32-dyn.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-attributes-remove.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-attributes-remove.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-attributes-remove.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-attributes-remove.s (added)<br>
+++ lld/trunk/test/ELF/arm-attributes-remove.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,44 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o<br>
+// RUN: ld.lld %t.o -o %t<br>
+// RUN: llvm-readobj -s %t | FileCheck %s<br>
+// RUN: ld.lld %t.o -shared -o %t2<br>
+// RUN: llvm-readobj -s %t2 | FileCheck %s<br>
+// RUN: ld.lld %t.o -r -o %t3<br>
+// RUN: llvm-readobj -s %t3 | FileCheck %s<br>
+<br>
+// The .ARM.attributes section should be removed from executables and<br>
+// shared objects.<br>
+<br>
+// At present we remove it from the -r object output as well which isn't ideal.<br>
+// Unfortunately combining per-object attributes cannot be safely done by just<br>
+// concatentation of input sections.<br>
+<br>
+// CHECK-NOT: Name: .ARM.attributes<br>
+ .text<br>
+ .syntax unified<br>
+ .eabi_attribute 67, "2.09" @ Tag_conformance<br>
+ .cpu cortex-a8<br>
+ .eabi_attribute 6, 10 @ Tag_CPU_arch<br>
+ .eabi_attribute 7, 65 @ Tag_CPU_arch_profile<br>
+ .eabi_attribute 8, 1 @ Tag_ARM_ISA_use<br>
+ .eabi_attribute 9, 2 @ Tag_THUMB_ISA_use<br>
+ .fpu neon<br>
+ .eabi_attribute 15, 1 @ Tag_ABI_PCS_RW_data<br>
+ .eabi_attribute 16, 1 @ Tag_ABI_PCS_RO_data<br>
+ .eabi_attribute 17, 2 @ Tag_ABI_PCS_GOT_use<br>
+ .eabi_attribute 20, 1 @ Tag_ABI_FP_denormal<br>
+ .eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions<br>
+ .eabi_attribute 23, 3 @ Tag_ABI_FP_number_model<br>
+ .eabi_attribute 34, 1 @ Tag_CPU_unaligned_access<br>
+ .eabi_attribute 24, 1 @ Tag_ABI_align_needed<br>
+ .eabi_attribute 25, 1 @ Tag_ABI_align_preserved<br>
+ .eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format<br>
+ .eabi_attribute 18, 4 @ Tag_ABI_PCS_wchar_t<br>
+ .eabi_attribute 26, 2 @ Tag_ABI_enum_size<br>
+ .eabi_attribute 14, 0 @ Tag_ABI_PCS_R9_use<br>
+ .eabi_attribute 68, 1 @ Tag_Virtualization_use<br>
+ .globl _start<br>
+ .p2align 2<br>
+ .type _start,%function<br>
+_start:<br>
+ bx lr<br>
<br>
Propchange: lld/trunk/test/ELF/arm-attributes-remove.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-attributes-remove.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-branch-error.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-branch-error.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-branch-error.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-branch-error.s (added)<br>
+++ lld/trunk/test/ELF/arm-branch-error.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,19 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/far-arm-abs.s -o %tfar<br>
+// RUN: not ld.lld %t %tfar -o %t2 2>&1 | FileCheck %s<br>
+// REQUIRES: arm<br>
+ .syntax unified<br>
+ .section .text, "ax",%progbits<br>
+ .globl _start<br>
+ .balign 0x10000<br>
+ .type _start,%function<br>
+_start:<br>
+ // address of too_far symbols are just out of range of ARM branch with<br>
+ // 26-bit immediate field and an addend of -8<br>
+ bl too_far1<br>
+ b too_far2<br>
+ beq too_far3<br>
+<br>
+// CHECK: R_ARM_CALL out of range<br>
+// CHECK-NEXT: R_ARM_JUMP24 out of range<br>
+// CHECK-NEXT: R_ARM_JUMP24 out of range<br>
<br>
Propchange: lld/trunk/test/ELF/arm-branch-error.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-branch-error.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-branch.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-branch.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-branch.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-branch.s (added)<br>
+++ lld/trunk/test/ELF/arm-branch.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,59 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/far-arm-abs.s -o %tfar<br>
+// RUN: echo "SECTIONS { \<br>
+// RUN: .callee1 : { *(.callee_low) } \<br>
+// RUN: .caller : { *(.text) } \<br>
+// RUN: .callee2 : { *(.callee_high) } } " > %t.script<br>
+// RUN: ld.lld --script %t.script %t %tfar -o %t2 2>&1<br>
+// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s<br>
+// REQUIRES: arm<br>
+ .syntax unified<br>
+ .section .callee_low, "ax",%progbits<br>
+ .align 2<br>
+ .type callee_low,%function<br>
+callee_low:<br>
+ bx lr<br>
+<br>
+ .section .text, "ax",%progbits<br>
+ .globl _start<br>
+ .balign 0x10000<br>
+ .type _start,%function<br>
+_start:<br>
+ bl callee_low<br>
+ b callee_low<br>
+ beq callee_low<br>
+ bl callee_high<br>
+ b callee_high<br>
+ bne callee_high<br>
+ bl far<br>
+ b far<br>
+ bgt far<br>
+ bx lr<br>
+<br>
+ .section .callee_high, "ax",%progbits<br>
+ .align 2<br>
+ .type callee_high,%function<br>
+callee_high:<br>
+ bx lr<br>
+<br>
+// CHECK: Disassembly of section .caller:<br>
+// CHECK-NEXT: _start:<br>
+// S(callee_low) = 0xb4 P = 0x10000 A = -8 = -0xff54 = -65364<br>
+// CHECK-NEXT: 10000: 2b c0 ff eb bl #-65364 <callee_low><br>
+// S(callee_low) = 0xb4 P = 0x10004 A = -8 = -0xff58 = -65368<br>
+// CHECK-NEXT: 10004: 2a c0 ff ea b #-65368 <callee_low><br>
+// S(callee_low) = 0xb4 P = 0x10008 A = -8 = -0xff5c -65372<br>
+// CHECK-NEXT: 10008: 29 c0 ff 0a beq #-65372 <callee_low><br>
+// S(callee_high) = 0x10028 P = 0x1000c A = -8 = 0x14 = 20<br>
+// CHECK-NEXT: 1000c: 05 00 00 eb bl #20 <callee_high><br>
+// S(callee_high) = 0x10028 P = 0x10010 A = -8 = 0x10 = 16<br>
+// CHECK-NEXT: 10010: 04 00 00 ea b #16 <callee_high><br>
+// S(callee_high) = 0x10028 P = 0x10014 A = -8 = 0x0c =12<br>
+// CHECK-NEXT: 10014: 03 00 00 1a bne #12 <callee_high><br>
+// S(far) = 0x201001c P = 0x10018 A = -8 = 0x1fffffc = 33554428<br>
+// CHECK-NEXT: 10018: ff ff 7f eb bl #33554428<br>
+// S(far) = 0x201001c P = 0x1001c A = -8 = 0x1fffff8 = 33554424<br>
+// CHECK-NEXT: 1001c: fe ff 7f ea b #33554424<br>
+// S(far) = 0x201001c P = 0x10020 A = -8 = 0x1fffff4 = 33554420<br>
+// CHECK-NEXT: 10020: fd ff 7f ca bgt #33554420<br>
+// CHECK-NEXT: 10024: 1e ff 2f e1 bx lr<br>
<br>
Propchange: lld/trunk/test/ELF/arm-branch.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-branch.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-copy.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-copy.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-copy.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-copy.s (added)<br>
+++ lld/trunk/test/ELF/arm-copy.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,81 @@<br>
+// REQUIRES: arm<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/relocation-copy-arm.s -o %t2.o<br>
+// RUN: ld.lld -shared %t2.o -o %t2.so<br>
+// RUN: ld.lld %t.o %t2.so -o %t3<br>
+// RUN: llvm-readobj -s -r --expand-relocs -symbols %t3 | FileCheck %s<br>
+// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CODE %s<br>
+// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi -section=.rodata %t3 | FileCheck -check-prefix=RODATA %s<br>
+<br>
+// Copy relocations R_ARM_COPY are required for y and z<br>
+ .syntax unified<br>
+ .text<br>
+ .globl _start<br>
+_start:<br>
+ movw r2,:lower16: y<br>
+ movt r2,:upper16: y<br>
+ ldr r3,[pc,#4]<br>
+ ldr r3,[r3,#0]<br>
+ .rodata<br>
+ .word z<br>
+<br>
+// CHECK: Name: .bss<br>
+// CHECK-NEXT: Type: SHT_NOBITS<br>
+// CHECK-NEXT: Flags [<br>
+// CHECK-NEXT: SHF_ALLOC<br>
+// CHECK-NEXT: SHF_WRITE<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Address: 0x13000<br>
+// CHECK-NEXT: Offset:<br>
+// CHECK-NEXT: Size: 8<br>
+// CHECK-NEXT: Link:<br>
+// CHECK-NEXT: Info:<br>
+// CHECK-NEXT: AddressAlignment: 16<br>
+<br>
+// CHECK: Relocations [<br>
+// CHECK-NEXT: Section (5) .rel.dyn {<br>
+// CHECK-NEXT: Relocation {<br>
+// CHECK-NEXT: Offset: 0x13000<br>
+// CHECK-NEXT: Type: R_ARM_COPY<br>
+// CHECK-NEXT: Symbol: y<br>
+// CHECK-NEXT: Addend: 0x0<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: Relocation {<br>
+// CHECK-NEXT: Offset: 0x13004<br>
+// CHECK-NEXT: Type: R_ARM_COPY<br>
+// CHECK-NEXT: Symbol: z<br>
+// CHECK-NEXT: Addend: 0x0<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: }<br>
+<br>
+// CHECK: Symbols [<br>
+// CHECK: Name: y<br>
+// CHECK-NEXT: Value: 0x13000<br>
+// CHECK-NEXT: Size: 4<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other:<br>
+// CHECK-NEXT: Section: .bss<br>
+// CHECK: Name: z<br>
+// CHECK-NEXT: Value: 0x13004<br>
+// CHECK-NEXT: Size: 4<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .bss<br>
+<br>
+// CODE: Disassembly of section .text:<br>
+// CODE-NEXT: _start:<br>
+// S(y) = 0x13000, A = 0<br>
+// (S + A) & 0x0000ffff = 0x3000 = #12288<br>
+// CODE-NEXT: 11000: 00 20 03 e3 movw r2, #12288<br>
+// S(y) = 0x13000, A = 0<br>
+// ((S + A) & 0xffff0000) >> 16 = 0x1<br>
+// CODE-NEXT: 11004: 01 20 40 e3 movt r2, #1<br>
+// CODE-NEXT: 11008: 04 30 9f e5 ldr r3, [pc, #4]<br>
+// CODE-NEXT: 1100c: 00 30 93 e5 ldr r3, [r3]<br>
+<br>
+<br>
+// RODATA: Contents of section .rodata:<br>
+// S(z) = 0x13004<br>
+// RODATA-NEXT: 10114 04300100<br>
<br>
Propchange: lld/trunk/test/ELF/arm-copy.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-copy.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-data-prel.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-data-prel.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-data-prel.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-data-prel.s (added)<br>
+++ lld/trunk/test/ELF/arm-data-prel.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,63 @@<br>
+// RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o %t.o<br>
+// RUN: echo "SECTIONS { \<br>
+// RUN: .text : { *(.text) } \<br>
+// RUN: .ARM.exidx : { *(.ARM.exidx) } \<br>
+// RUN: .ARM.exidx.TEST1 : { *(.ARM.exidx.TEST1) } \<br>
+// RUN: .TEST1 : { *(.TEST1) } } " > %t.script<br>
+// RUN: ld.lld --script %t.script %t.o -o %t<br>
+// RUN: llvm-readobj -s -sd %t | FileCheck --check-prefix=CHECK %s<br>
+// REQUIRES: arm<br>
+<br>
+// The R_ARM_PREL31 relocation is used in by the .ARM.exidx exception tables<br>
+// bit31 of the place denotes whether the field is an inline table entry<br>
+// (bit31=1) or relocation (bit31=0)<br>
+// The linker must preserve the value of bit31<br>
+<br>
+// This test case is adapted from llvm/test/MC/ARM/eh-compact-pr0.s<br>
+// We use a linker script to place the .ARM.exidx sections in between<br>
+// the code sections so that we can test positive and negative offsets<br>
+ .syntax unified<br>
+<br>
+ .section .TEST1, "ax",%progbits<br>
+ .globl _start<br>
+ .align 2<br>
+ .type _start,%function<br>
+_start:<br>
+ .fnstart<br>
+ .save {r11, lr}<br>
+ push {r11, lr}<br>
+ .setfp r11, sp<br>
+ mov r11, sp<br>
+ pop {r11, lr}<br>
+ mov pc, lr<br>
+ .fnend<br>
+<br>
+ .section .text, "ax",%progbits<br>
+// The generated .ARM.exidx section will refer to the personality<br>
+// routine __aeabi_unwind_cpp_pr0. Provide a dummy implementation<br>
+// to stop an undefined symbol error<br>
+ .globl __aeabi_unwind_cpp_pr0<br>
+ .align 2<br>
+ .type __aeabi_unwind_cpp_pr0,%function<br>
+__aeabi_unwind_cpp_pr0:<br>
+ .fnstart<br>
+ bx lr<br>
+ .fnend<br>
+<br>
+// The expected value of the exception table is<br>
+// Word0 0 in bit 31, -4 encoded in 31-bit signed offset<br>
+// Word1 Inline table entry EHT Inline Personality Routine #0<br>
+// CHECK: Name: .ARM.exidx<br>
+// CHECK: SectionData (<br>
+// CHECK: 0000: FCFFFF7F B0B0B080<br>
+// CHECK: )<br>
+<br>
+// The expected value of the exception table is<br>
+// Word0 0 in bit 31, +8 encoded in 31-bit signed offset<br>
+// Word1 Inline table entry EHT Inline Personality Routine #0<br>
+// set vsp = r11<br>
+// pop r11, r14<br>
+// CHECK: Name: .ARM.exidx.TEST1<br>
+// CHECK: SectionData (<br>
+// CHECK: 0000: 08000000 80849B80<br>
+// CHECK: )<br>
<br>
Propchange: lld/trunk/test/ELF/arm-data-prel.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-data-prel.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-data-relocs.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-data-relocs.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-data-relocs.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-data-relocs.s (added)<br>
+++ lld/trunk/test/ELF/arm-data-relocs.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,20 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/abs256.s -o %t256.o<br>
+// RUN: ld.lld %t %t256.o -o %t2<br>
+// RUN: llvm-objdump -d %t2 | FileCheck %s<br>
+// REQUIRES: arm<br>
+ .syntax unified<br>
+ .globl _start<br>
+_start:<br>
+ .section .R_ARM_ABS32POS, "ax",%progbits<br>
+ .word foo + 0x24<br>
+<br>
+// S = 0x100, A = 0x24<br>
+// S + A = 0x124<br>
+// CHECK: Disassembly of section .R_ARM_ABS32POS:<br>
+// CHECK: 11000: 24 01 00 00<br>
+ .section .R_ARM_ABS32NEG, "ax",%progbits<br>
+ .word foo - 0x24<br>
+// S = 0x100, A = -0x24<br>
+// CHECK: Disassembly of section .R_ARM_ABS32NEG:<br>
+// CHECK: 11004: dc 00 00 00<br>
<br>
Propchange: lld/trunk/test/ELF/arm-data-relocs.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-data-relocs.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-fpic-got.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-fpic-got.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-fpic-got.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-fpic-got.s (added)<br>
+++ lld/trunk/test/ELF/arm-fpic-got.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,63 @@<br>
+// REQUIRES: arm<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o<br>
+// RUN: ld.lld %t.o -o %t<br>
+// RUN: llvm-readobj -s %t | FileCheck %s<br>
+// RUN: llvm-readobj -s -symbols %t | FileCheck -check-prefix=SYMBOLS %s<br>
+// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t | FileCheck -check-prefix=CODE %s<br>
+<br>
+// Test the R_ARM_GOT_PREL relocation<br>
+ .syntax unified<br>
+ .text<br>
+ .globl _start<br>
+ .align 2<br>
+_start:<br>
+ ldr r0, .LCPI0_0<br>
+.LPC0_0:<br>
+ ldr r0, [pc, r0]<br>
+ ldr r0, [r0]<br>
+ bx lr<br>
+.LCPI0_0:<br>
+.Ltmp0:<br>
+ // Generate R_ARM_GOT_PREL<br>
+ .long val(GOT_PREL)-((.LPC0_0+8)-.Ltmp0)<br>
+<br>
+ .data<br>
+ .type val,%object<br>
+ .globl val<br>
+ .align 2<br>
+val:<br>
+ .long 10<br>
+ .size val, 4<br>
+<br>
+// CHECK: Section {<br>
+// CHECK: Name: .got<br>
+// CHECK-NEXT: Type: SHT_PROGBITS<br>
+// CHECK-NEXT: Flags [<br>
+// CHECK-NEXT: SHF_ALLOC<br>
+// CHECK-NEXT: SHF_WRITE<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Address: 0x12000<br>
+// CHECK-NEXT: Offset:<br>
+// CHECK-NEXT: Size: 4<br>
+// CHECK-NEXT: Link:<br>
+// CHECK-NEXT: Info:<br>
+// CHECK-NEXT: AddressAlignment: 4<br>
+// CHECK-NEXT: EntrySize:<br>
+<br>
+// SYMBOLS: Name: val<br>
+// SYMBOLS-NEXT: Value: 0x13000<br>
+// SYMBOLS-NEXT: Size: 4<br>
+// SYMBOLS-NEXT: Binding: Global<br>
+// SYMBOLS-NEXT: Type: Object<br>
+// SYMBOLS-NEXT: Other:<br>
+// SYMBOLS-NEXT: Section: .data<br>
+<br>
+// CODE: Disassembly of section .text:<br>
+// CODE-NEXT: _start:<br>
+// CODE-NEXT: 11000: 08 00 9f e5 ldr r0, [pc, #8]<br>
+// CODE-NEXT: 11004: 00 00 9f e7 ldr r0, [pc, r0]<br>
+// CODE-NEXT: 11008: 00 00 90 e5 ldr r0, [r0]<br>
+// CODE-NEXT: 1100c: 1e ff 2f e1 bx lr<br>
+// CODE: $d.1:<br>
+// 0x11004 + 0x0ff4 + 8 = 0x12000 = .got<br>
+// CODE-NEXT: 11010: f4 0f 00 00<br>
<br>
Propchange: lld/trunk/test/ELF/arm-fpic-got.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-fpic-got.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s (added)<br>
+++ lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,27 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o<br>
+// RUN: ld.lld -static %t.o -o %tout<br>
+// RUN: llvm-readobj -symbols %tout | FileCheck %s<br>
+// REQUIRES: arm<br>
+<br>
+// Check that no __rel_iplt_end/__rel_iplt_start<br>
+// appear in symtab if there are no references to them.<br>
+// CHECK: Symbols [<br>
+// CHECK-NOT: __rel_iplt_end<br>
+// CHECK-NOT: __rel_iplt_start<br>
+// CHECK: ]<br>
+ .syntax unified<br>
+ .text<br>
+ .type foo STT_GNU_IFUNC<br>
+ .globl foo<br>
+foo:<br>
+ bx lr<br>
+<br>
+ .type bar STT_GNU_IFUNC<br>
+ .globl bar<br>
+bar:<br>
+ bx lr<br>
+<br>
+ .globl _start<br>
+_start:<br>
+ bl foo<br>
+ bl bar<br>
<br>
Propchange: lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-gnu-ifunc-nosym.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-gnu-ifunc.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-gnu-ifunc.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-gnu-ifunc.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-gnu-ifunc.s (added)<br>
+++ lld/trunk/test/ELF/arm-gnu-ifunc.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,131 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o<br>
+// RUN: ld.lld -static %t.o -o %tout<br>
+// RUN: llvm-objdump -triple armv7a-none-linux-gnueabi -d %tout | FileCheck %s --check-prefix=DISASM<br>
+// RUN: llvm-readobj -r -symbols -sections %tout | FileCheck %s<br>
+// REQUIRES: arm<br>
+ .syntax unified<br>
+ .text<br>
+ .type foo STT_GNU_IFUNC<br>
+ .globl foo<br>
+foo:<br>
+ bx lr<br>
+<br>
+ .type bar STT_GNU_IFUNC<br>
+ .globl bar<br>
+bar:<br>
+ bx lr<br>
+<br>
+ .globl _start<br>
+_start:<br>
+ bl foo<br>
+ bl bar<br>
+ movw r0,:lower16:__rel_iplt_start<br>
+ movt r0,:upper16:__rel_iplt_start<br>
+ movw r0,:lower16:__rel_iplt_end<br>
+ movt r0,:upper16:__rel_iplt_end<br>
+<br>
+// CHECK: Sections [<br>
+// CHECK: Section {<br>
+// CHECK: Index: 1<br>
+// CHECK-NEXT: Name: .rel.plt<br>
+// CHECK-NEXT: Type: SHT_REL<br>
+// CHECK-NEXT: Flags [<br>
+// CHECK-NEXT: SHF_ALLOC<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Address: [[REL:.*]]<br>
+// CHECK-NEXT: Offset:<br>
+// CHECK-NEXT: Size: 16<br>
+// CHECK-NEXT: Link:<br>
+// CHECK-NEXT: Info:<br>
+// CHECK-NEXT: AddressAlignment: 4<br>
+// CHECK-NEXT: EntrySize: 8<br>
+// CHECK-NEXT: }<br>
+// CHECK: Relocations [<br>
+// CHECK-NEXT: Section (1) .rel.plt {<br>
+// CHECK-NEXT: 0x1200C R_ARM_IRELATIVE<br>
+// CHECK-NEXT: 0x12010 R_ARM_IRELATIVE<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT:]<br>
+// CHECK: Symbols [<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: __rel_iplt_end<br>
+// CHECK-NEXT: Value: 0x100E4<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Local<br>
+// CHECK-NEXT: Type: None<br>
+// CHECK-NEXT: Other [<br>
+// CHECK-NEXT: STV_HIDDEN<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Section: .rel.plt<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: Symbol {<br>
+// CHECK-NEXT: Name: __rel_iplt_start<br>
+// CHECK-NEXT: Value: 0x100D4<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Local<br>
+// CHECK-NEXT: Type: None<br>
+// CHECK-NEXT: Other [<br>
+// CHECK-NEXT: STV_HIDDEN<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Section: .rel.plt<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: Symbol {<br>
+// CHECK-NEXT: Name: _start (6)<br>
+// CHECK-NEXT: Value: 0x11008<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: None<br>
+// CHECK-NEXT: Other:<br>
+// CHECK-NEXT: Section: .text<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: Symbol {<br>
+// CHECK-NEXT: Name: bar<br>
+// CHECK-NEXT: Value: 0x11004<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: GNU_IFunc<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .text<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: Symbol {<br>
+// CHECK-NEXT: Name: foo<br>
+// CHECK-NEXT: Value: 0x11000<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: GNU_IFunc<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .text<br>
+// CHECK-NEXT: }<br>
+<br>
+// DISASM: Disassembly of section .text:<br>
+// DISASM-NEXT: foo:<br>
+// DISASM-NEXT: 11000: 1e ff 2f e1 bx lr<br>
+// DISASM: bar:<br>
+// DISASM-NEXT: 11004: 1e ff 2f e1 bx lr<br>
+// DISASM: _start:<br>
+// DISASM-NEXT: 11008: 09 00 00 eb bl #36<br>
+// DISASM-NEXT: 1100c: 0c 00 00 eb bl #48<br>
+// DISASM-NEXT: 11010: d4 00 00 e3 movw r0, #212<br>
+// DISASM-NEXT: 11014: 01 00 40 e3 movt r0, #1<br>
+// r0 = 212 + 1 * 65536 = 100D4 = __rel_iplt_start<br>
+// DISASM-NEXT: 11018: e4 00 00 e3 movw r0, #228<br>
+// DISASM-NEXT: 1101c: 01 00 40 e3 movt r0, #1<br>
+// r1 = 228 + 1 * 65536 = 100E4 = __rel_iplt_end<br>
+// DISASM-NEXT: Disassembly of section .plt:<br>
+// DISASM-NEXT: .plt:<br>
+// DISASM-NEXT: 11020: 04 e0 2d e5 str lr, [sp, #-4]!<br>
+// DISASM-NEXT: 11024: 04 e0 9f e5 ldr lr, [pc, #4]<br>
+// DISASM-NEXT: 11028: 0e e0 8f e0 add lr, pc, lr<br>
+// DISASM-NEXT: 1102c: 08 f0 be e5 ldr pc, [lr, #8]!<br>
+// 0x0fd0 + 0x11028 + 0x8 = 0x12000<br>
+// DISASM-NEXT: 11030: d0 0f 00 00<br>
+// DISASM-NEXT: 11034: 04 c0 9f e5 ldr r12, [pc, #4]<br>
+// DISASM-NEXT: 11038: 0f c0 8c e0 add r12, r12, pc<br>
+// DISASM-NEXT: 1103c: 00 f0 9c e5 ldr pc, [r12]<br>
+// 0x0fcc + 0x11038 + 0x8 = 0x1200C<br>
+// DISASM-NEXT: 11040: cc 0f 00 00<br>
+// DISASM-NEXT: 11044: 04 c0 9f e5 ldr r12, [pc, #4]<br>
+// DISASM-NEXT: 11048: 0f c0 8c e0 add r12, r12, pc<br>
+// DISASM-NEXT: 1104c: 00 f0 9c e5 ldr pc, [r12]<br>
+// 0x0fc0 + 0x11048 + 0x8 = 0x12010<br>
+// DISASM-NEXT: 11050: c0 0f 00 00<br>
<br>
Propchange: lld/trunk/test/ELF/arm-gnu-ifunc.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-gnu-ifunc.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-got-relative.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-got-relative.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-got-relative.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-got-relative.s (added)<br>
+++ lld/trunk/test/ELF/arm-got-relative.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,53 @@<br>
+// REQUIRES: arm<br>
+// RUN: llvm-mc -position-independent -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o<br>
+// RUN: ld.lld %t.o -shared -o %t<br>
+// RUN: llvm-readobj -s -symbols -dyn-relocations %t | FileCheck %s<br>
+// RUN: llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t | FileCheck -check-prefix=CODE %s<br>
+ .syntax unified<br>
+ .text<br>
+ .globl _start<br>
+ .align 2<br>
+_start:<br>
+ .type _start, %function<br>
+ ldr r3, .LGOT<br>
+ ldr r2, .LGOT+4<br>
+.LPIC:<br>
+ add r0, pc, r3<br>
+ bx lr<br>
+ .align 2<br>
+.LGOT:<br>
+ // gas implicitly uses (GOT_PREL) for _GLOBAL_OFFSET_TABLE_ in PIC<br>
+ // llvm-mc needs the (GOT_PREL) suffix or it generates R_ARM_REL32<br>
+ .word _GLOBAL_OFFSET_TABLE_(GOT_PREL) - (.LPIC+8)<br>
+ .word function(GOT)<br>
+<br>
+ .globl function<br>
+ .align 2<br>
+function:<br>
+ .type function, %function<br>
+ bx lr<br>
+<br>
+// CHECK: Dynamic Relocations {<br>
+// CHECK-NEXT: 0x204C R_ARM_GLOB_DAT function 0x0<br>
+<br>
+// CHECK: Name: _GLOBAL_OFFSET_TABLE_ (16)<br>
+// CHECK-NEXT: Value: 0x0<br>
+// CHECK-NEXT: Size:<br>
+// CHECK-NEXT: Binding: Local<br>
+// CHECK-NEXT: Type: None<br>
+// CHECK-NEXT: Other [<br>
+// CHECK-NEXT: STV_HIDDEN<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Section: Absolute<br>
+<br>
+// CODE: Disassembly of section .text:<br>
+// CODE-NEXT: _start:<br>
+// CODE-NEXT: 1000: 08 30 9f e5 ldr r3, [pc, #8]<br>
+// CODE-NEXT: 1004: 08 20 9f e5 ldr r2, [pc, #8]<br>
+// CODE-NEXT: 1008: 03 00 8f e0 add r0, pc, r3<br>
+// CODE-NEXT: 100c: 1e ff 2f e1 bx lr<br>
+// CODE:$d.1:<br>
+// (_GLOBAL_OFFSET_TABLE_ = 0x2048) - (0x1008 + 8) 0x1038<br>
+// CODE-NEXT: 1010: 38 10 00 00<br>
+// (Got(function) - GotBase = 0x4<br>
+// CODE-NEXT: 1014: 04 00 00 00<br>
<br>
Propchange: lld/trunk/test/ELF/arm-got-relative.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-got-relative.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-gotoff.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-gotoff.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-gotoff.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-gotoff.s (added)<br>
+++ lld/trunk/test/ELF/arm-gotoff.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,74 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabi %s -o %t.o<br>
+// RUN: ld.lld %t.o -o %t<br>
+// RUN: llvm-readobj -s -r -t %t | FileCheck %s<br>
+// RUN: llvm-objdump -triple=armv7a-linux-gnueabi -d %t | FileCheck --check-prefix=DISASM %s<br>
+// REQUIRES: arm<br>
+<br>
+// Test the R_ARM_GOTOFF32 relocation<br>
+<br>
+// CHECK: Name: .got<br>
+// CHECK-NEXT: Type: SHT_PROGBITS (0x1)<br>
+// CHECK-NEXT: Flags [<br>
+// CHECK-NEXT: SHF_ALLOC<br>
+// CHECK-NEXT: SHF_WRITE<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Address: 0x12000<br>
+// CHECK-NEXT: Offset: 0x2000<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Link:<br>
+// CHECK-NEXT: Info:<br>
+// CHECK-NEXT: AddressAlignment:<br>
+<br>
+// CHECK: Name: .bss<br>
+// CHECK-NEXT: Type: SHT_NOBITS<br>
+// CHECK-NEXT: Flags [<br>
+// CHECK-NEXT: SHF_ALLOC<br>
+// CHECK-NEXT: SHF_WRITE<br>
+// CHECK-NEXT: ]<br>
+// CHECK-NEXT: Address: 0x12000<br>
+// CHECK-NEXT: Offset:<br>
+// CHECK-NEXT: Size: 20<br>
+// CHECK-NEXT: Link:<br>
+// CHECK-NEXT: Info:<br>
+// CHECK-NEXT: AddressAlignment: 1<br>
+<br>
+// CHECK-NEXT: EntrySize: 0<br>
+<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: bar<br>
+// CHECK-NEXT: Value: 0x12000<br>
+// CHECK-NEXT: Size: 10<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .bss<br>
+// CHECK-NEXT: }<br>
+// CHECK-NEXT: Symbol {<br>
+// CHECK-NEXT: Name: obj<br>
+// CHECK-NEXT: Value: 0x1200A<br>
+// CHECK-NEXT: Size: 10<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .bss<br>
+<br>
+// DISASM: Disassembly of section .text:<br>
+// DISASM-NEXT :_start:<br>
+// DISASM-NEXT 11000: 1e ff 2f e1 bx lr<br>
+// Offset 0 from .got = bar<br>
+// DISASM 11004: 00 00 00 00<br>
+// Offset 10 from .got = obj<br>
+// DISASM-NEXT 11008: 0a 00 00 00<br>
+// Offset 15 from .got = obj +5<br>
+// DISASM-NEXT 1100c: 0f 00 00 00<br>
+ .syntax unified<br>
+ .globl _start<br>
+_start:<br>
+ bx lr<br>
+ .word bar(GOTOFF)<br>
+ .word obj(GOTOFF)<br>
+ .word obj(GOTOFF)+5<br>
+ .type bar, %object<br>
+ .comm bar, 10<br>
+ .type obj, %object<br>
+ .comm obj, 10<br>
<br>
Propchange: lld/trunk/test/ELF/arm-gotoff.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-gotoff.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-mov-relocs.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-mov-relocs.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-mov-relocs.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-mov-relocs.s (added)<br>
+++ lld/trunk/test/ELF/arm-mov-relocs.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,53 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-unknown-linux-gnueabi %s -o %t<br>
+// RUN: ld.lld %t -o %t2<br>
+// RUN: llvm-objdump -d %t2 -triple=armv7a-unknown-linux-gnueabi | FileCheck %s<br>
+// REQUIRES: arm<br>
+<br>
+// Test the R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS relocations<br>
+ .syntax unified<br>
+ .globl _start<br>
+_start:<br>
+ .section .R_ARM_MOVW_ABS_NC, "ax",%progbits<br>
+ movw r0, :lower16:label<br>
+ movw r1, :lower16:label1<br>
+ movw r2, :lower16:label2 + 4<br>
+ movw r3, :lower16:label3<br>
+ movw r4, :lower16:label3 + 4<br>
+// CHECK: Disassembly of section .R_ARM_MOVW_ABS_NC<br>
+// CHECK: movw r0, #0<br>
+// CHECK: movw r1, #4<br>
+// CHECK: movw r2, #12<br>
+// CHECK: movw r3, #65532<br>
+// CHECK: movw r4, #0<br>
+ .section .R_ARM_MOVT_ABS, "ax",%progbits<br>
+ movt r0, :upper16:label<br>
+ movt r1, :upper16:label1<br>
+// FIXME: We shouldn't need to multiply by 65536.<br>
+// arguably llvm-mc incorrectly assembles addends for<br>
+// SHT_REL relocated movt instructions. When there is a relocation<br>
+// the interpretation of the addend for SHT_REL is not shifted<br>
+ movt r2, :upper16:label2 + (4 * 65536)<br>
+ movt r3, :upper16:label3<br>
+// FIXME: We shouldn't need to multiply by 65536 see comment above.<br>
+ movt r4, :upper16:label3 + (4 * 65536)<br>
+// CHECK: Disassembly of section .R_ARM_MOVT_ABS<br>
+// CHECK: movt r0, #2<br>
+// CHECK: movt r1, #2<br>
+// CHECK: movt r2, #2<br>
+// CHECK: movt r3, #2<br>
+// CHECK: movt r4, #3<br>
+<br>
+ .section .destination, "aw",%progbits<br>
+ .balign 65536<br>
+label:<br>
+ .word 0<br>
+label1:<br>
+ .word 1<br>
+label2:<br>
+ .word 2<br>
+// Test label3 is immediately below 2^16 alignment boundary<br>
+ .space 65536 - 16<br>
+label3:<br>
+ .word 3<br>
+// label3 + 4 is on a 2^16 alignment boundary<br>
+ .word 4<br>
<br>
Propchange: lld/trunk/test/ELF/arm-mov-relocs.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-mov-relocs.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
Added: lld/trunk/test/ELF/arm-plt-reloc.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-plt-reloc.s?rev=271993&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-plt-reloc.s?rev=271993&view=auto</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/arm-plt-reloc.s (added)<br>
+++ lld/trunk/test/ELF/arm-plt-reloc.s Tue Jun 7 04:31:52 2016<br>
@@ -0,0 +1,90 @@<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-plt-reloc.s -o %t1<br>
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t2<br>
+// RUN: ld.lld %t1 %t2 -o %t<br>
+// RUN: llvm-objdump -triple=armv7a-none-linux-gnueabi -d %t | FileCheck %s<br>
+// RUN: ld.lld -shared %t1 %t2 -o %t3<br>
+// RUN: llvm-objdump -triple=armv7a-none-linux-gnueabi -d %t3 | FileCheck -check-prefix=DSO %s<br>
+// RUN: llvm-readobj -s -r %t3 | FileCheck -check-prefix=DSOREL %s<br>
+// REQUIRES: arm<br>
+//<br>
+// Test PLT entry generation<br>
+ .syntax unified<br>
+ .text<br>
+ .align 2<br>
+ .globl _start<br>
+ .type _start,%function<br>
+_start:<br>
+ b func1<br>
+ bl func2<br>
+ beq func3<br>
+<br>
+// Executable, expect no PLT<br>
+// CHECK: Disassembly of section .text:<br>
+// CHECK-NEXT: func1:<br>
+// CHECK-NEXT: 11000: 1e ff 2f e1 bx lr<br>
+// CHECK: func2:<br>
+// CHECK-NEXT: 11004: 1e ff 2f e1 bx lr<br>
+// CHECK: func3:<br>
+// CHECK-NEXT: 11008: 1e ff 2f e1 bx lr<br>
+// CHECK: _start:<br>
+// CHECK-NEXT: 1100c: fb ff ff ea b #-20 <func1><br>
+// CHECK-NEXT: 11010: fb ff ff eb bl #-20 <func2><br>
+// CHECK-NEXT: 11014: fb ff ff 0a beq #-20 <func3><br>
+<br>
+// Expect PLT entries as symbols can be preempted<br>
+// DSO: Disassembly of section .text:<br>
+// DSO-NEXT: func1:<br>
+// DSO-NEXT: 1000: 1e ff 2f e1 bx lr<br>
+// DSO: func2:<br>
+// DSO-NEXT: 1004: 1e ff 2f e1 bx lr<br>
+// DSO: func3:<br>
+// DSO-NEXT: 1008: 1e ff 2f e1 bx lr<br>
+// DSO: _start:<br>
+// S(0x1034) - P(0x100c) + A(-8) = 0x20 = 32<br>
+// DSO-NEXT: 100c: 08 00 00 ea b #32<br>
+// S(0x1044) - P(0x1010) + A(-8) = 0x2c = 44<br>
+// DSO-NEXT: 1010: 0b 00 00 eb bl #44<br>
+// S(0x1054) - P(0x1014) + A(-8) = 0x38 = 56<br>
+// DSO-NEXT: 1014: 0e 00 00 0a beq #56<br>
+// DSO: Disassembly of section .plt:<br>
+// DSO-NEXT:.plt:<br>
+// DSO-NEXT: 1020: 04 e0 2d e5 str lr, [sp, #-4]!<br>
+// DSO-NEXT: 1024: 04 e0 9f e5 ldr lr, [pc, #4]<br>
+// DSO-NEXT: 1028: 0e e0 8f e0 add lr, pc, lr<br>
+// DSO-NEXT: 102c: 08 f0 be e5 ldr pc, [lr, #8]!<br>
+// 0x1028 + 8 + 1fd0 = 0x3000<br>
+// DSO-NEXT: 1030: d0 1f 00 00<br>
+// DSO-NEXT: 1034: 04 c0 9f e5 ldr r12, [pc, #4]<br>
+// DSO-NEXT: 1038: 0f c0 8c e0 add r12, r12, pc<br>
+// DSO-NEXT: 103c: 00 f0 9c e5 ldr pc, [r12]<br>
+// 0x1038 + 8 + 1fcc = 0x300c<br>
+// DSO-NEXT: 1040: cc 1f 00 00<br>
+// DSO-NEXT: 1044: 04 c0 9f e5 ldr r12, [pc, #4]<br>
+// DSO-NEXT: 1048: 0f c0 8c e0 add r12, r12, pc<br>
+// DSO-NEXT: 104c: 00 f0 9c e5 ldr pc, [r12]<br>
+// 0x1048 + 8 + 1fc0 = 0x3010<br>
+// DSO-NEXT: 1050: c0 1f 00 00<br>
+// DSO-NEXT: 1054: 04 c0 9f e5 ldr r12, [pc, #4]<br>
+// DSO-NEXT: 1058: 0f c0 8c e0 add r12, r12, pc<br>
+// DSO-NEXT: 105c: 00 f0 9c e5 ldr pc, [r12]<br>
+// 0x1058 + 8 + 1fb4 = 0x3014<br>
+// DSO-NEXT: 1060: b4 1f 00 00<br>
+<br>
+// DSOREL: Name: .got.plt<br>
+// DSOREL-NEXT: Type: SHT_PROGBITS<br>
+// DSOREL-NEXT: Flags [<br>
+// DSOREL-NEXT: SHF_ALLOC<br>
+// DSOREL-NEXT: SHF_WRITE<br>
+// DSOREL-NEXT: ]<br>
+// DSOREL-NEXT: Address: 0x3000<br>
+// DSOREL-NEXT: Offset:<br>
+// DSOREL-NEXT: Size: 24<br>
+// DSOREL-NEXT: Link:<br>
+// DSOREL-NEXT: Info:<br>
+// DSOREL-NEXT: AddressAlignment: 4<br>
+// DSOREL-NEXT: EntrySize:<br>
+// DSOREL: Relocations [<br>
+// DSOREL-NEXT: Section (4) .rel.plt {<br>
+// DSOREL-NEXT: 0x300C R_ARM_JUMP_SLOT func1 0x0<br>
+// DSOREL-NEXT: 0x3010 R_ARM_JUMP_SLOT func2 0x0<br>
+// DSOREL-NEXT: 0x3014 R_ARM_JUMP_SLOT func3 0x0<br>
<br>
Propchange: lld/trunk/test/ELF/arm-plt-reloc.s<br>
------------------------------------------------------------------------------<br>
svn:eol-style = native<br>
<br>
Propchange: lld/trunk/test/ELF/arm-plt-reloc.s<br>
------------------------------------------------------------------------------<br>
svn:keywords = Rev Date Author URL Id<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>