[lld] r369121 - [lld][Hexagon]Support HEX_32 when building shared objects
Sid Manning via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 08:35:02 PDT 2019
Author: sidneym
Date: Fri Aug 16 08:35:02 2019
New Revision: 369121
URL: http://llvm.org/viewvc/llvm-project?rev=369121&view=rev
Log:
[lld][Hexagon]Support HEX_32 when building shared objects
Differential Revision: https://reviews.llvm.org/D66105
Modified:
lld/trunk/ELF/Arch/Hexagon.cpp
lld/trunk/test/ELF/hexagon-shared.s
Modified: lld/trunk/ELF/Arch/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Hexagon.cpp?rev=369121&r1=369120&r2=369121&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp (original)
+++ lld/trunk/ELF/Arch/Hexagon.cpp Fri Aug 16 08:35:02 2019
@@ -29,6 +29,7 @@ public:
uint32_t calcEFlags() const override;
RelExpr getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const override;
+ RelType getDynRel(RelType type) const override;
void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override;
void writePltHeader(uint8_t *buf) const override;
void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr,
@@ -285,6 +286,12 @@ void Hexagon::writePlt(uint8_t *buf, uin
relocateOne(buf + 4, R_HEX_6_PCREL_X, gotPltEntryAddr - pltEntryAddr);
}
+RelType Hexagon::getDynRel(RelType type) const {
+ if (type == R_HEX_32)
+ return type;
+ return R_HEX_NONE;
+}
+
TargetInfo *elf::getHexagonTargetInfo() {
static Hexagon target;
return ⌖
Modified: lld/trunk/test/ELF/hexagon-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/hexagon-shared.s?rev=369121&r1=369120&r2=369121&view=diff
==============================================================================
--- lld/trunk/test/ELF/hexagon-shared.s (original)
+++ lld/trunk/test/ELF/hexagon-shared.s Fri Aug 16 08:35:02 2019
@@ -6,6 +6,7 @@
# RUN: llvm-objdump -d -j .plt %t4.so | FileCheck --check-prefix=PLT %s
# RUN: llvm-objdump -d -j .text %t4.so | FileCheck --check-prefix=TEXT %s
# RUN: llvm-objdump -D -j .got %t4.so | FileCheck --check-prefix=GOT %s
+# RUN: llvm-readelf -r %t4.so | FileCheck --check-prefix=RELO %s
.global foo
foo:
@@ -25,8 +26,22 @@ jumpr r0
# R_HEX_GOT_16_X
r0 = add(r1,##bar at GOT)
+# R_HEX_32
+.data
+.global var
+.type var, at object
+.p2align 2
+var:
+ .word 10
+ .size var, 4
+.global pvar
+.type pvar, at object
+pvar:
+ .word var
+ .size pvar, 4
+
# PLT: { immext(#131008
-# PLT: r28 = add(pc,##131024) }
+# PLT: r28 = add(pc,##131032) }
# PLT: { r14 -= add(r28,#16)
# PLT: r15 = memw(r28+#8)
# PLT: r28 = memw(r28+#4) }
@@ -34,13 +49,17 @@ r0 = add(r1,##bar at GOT)
# PLT: jumpr r28 }
# PLT: { trap0(#219) }
# PLT: immext(#131008)
-# PLT: r14 = add(pc,##131008) }
+# PLT: r14 = add(pc,##131016) }
# PLT: r28 = memw(r14+#0) }
# PLT: jumpr r28 }
# TEXT: 10000: 00 00 01 00 00010000
# TEXT: { call 0x10050 }
-# TEXT: r0 = add(r1,##-65408) }
+# TEXT: r0 = add(r1,##-65416) }
# GOT: .got:
# GOT: 20080: 00 00 00 00 00000000 <unknown>
+
+# RELO: 00020080 00000121 R_HEX_GLOB_DAT
+# RELO: 00030004 00000406 R_HEX_32
+# RELO: 00030018 00000122 R_HEX_JMP_SLOT
More information about the llvm-commits
mailing list