[lld] r316306 - Add R_PPC_ADDR16_HI relocation support
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 22 16:33:49 PDT 2017
Author: ruiu
Date: Sun Oct 22 16:33:49 2017
New Revision: 316306
URL: http://llvm.org/viewvc/llvm-project?rev=316306&view=rev
Log:
Add R_PPC_ADDR16_HI relocation support
The support of R_PPC_ADDR16_HI improves ld compatibility and makes
things on par with RuntimeDyldELF that already implements this
relocation.
Patch by vit9696.
Modified:
lld/trunk/ELF/Arch/PPC.cpp
lld/trunk/test/ELF/ppc-relocs.s
Modified: lld/trunk/ELF/Arch/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC.cpp?rev=316306&r1=316305&r2=316306&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC.cpp (original)
+++ lld/trunk/ELF/Arch/PPC.cpp Sun Oct 22 16:33:49 2017
@@ -44,6 +44,9 @@ void PPC::relocateOne(uint8_t *Loc, RelT
case R_PPC_ADDR16_HA:
write16be(Loc, (Val + 0x8000) >> 16);
break;
+ case R_PPC_ADDR16_HI:
+ write16be(Loc, Val >> 16);
+ break;
case R_PPC_ADDR16_LO:
write16be(Loc, Val);
break;
Modified: lld/trunk/test/ELF/ppc-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc-relocs.s?rev=316306&r1=316305&r2=316306&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc-relocs.s (original)
+++ lld/trunk/test/ELF/ppc-relocs.s Sun Oct 22 16:33:49 2017
@@ -17,6 +17,20 @@ msg:
# CHECK: msg:
# CHECK: 11004: 66 6f 6f 00 oris 15, 19, 28416
+.section .R_PPC_ADDR16_HI,"ax", at progbits
+.globl _starti
+_starti:
+ lis 4,msgi at h
+msgi:
+ .string "foo"
+ leni = . - msgi
+
+# CHECK: Disassembly of section .R_PPC_ADDR16_HI:
+# CHECK: _starti:
+# CHECK: 11008: 3c 80 00 01 lis 4, 1
+# CHECK: msgi:
+# CHECK: 1100c: 66 6f 6f 00 oris 15, 19, 28416
+
.section .R_PPC_ADDR16_LO,"ax", at progbits
addi 4, 4, msg at l
mystr:
@@ -25,9 +39,9 @@ mystr:
# CHECK: Disassembly of section .R_PPC_ADDR16_LO:
# CHECK: .R_PPC_ADDR16_LO:
-# CHECK: 11008: 38 84 10 04 addi 4, 4, 4100
+# CHECK: 11010: 38 84 10 04 addi 4, 4, 4100
# CHECK: mystr:
-# CHECK: 1100c: 62 6c 61 68 ori 12, 19, 24936
+# CHECK: 11014: 62 6c 61 68 ori 12, 19, 24936
.align 2
.section .R_PPC_REL24,"ax", at progbits
@@ -39,7 +53,7 @@ mystr:
# CHECK: Disassembly of section .R_PPC_REL24:
# CHECK: .FR_PPC_REL24:
-# CHECK: 11014: 48 00 00 04 b .+4
+# CHECK: 1101c: 48 00 00 04 b .+4
.section .R_PPC_REL32,"ax", at progbits
.globl .FR_PPC_REL32
@@ -50,7 +64,7 @@ mystr:
# CHECK: Disassembly of section .R_PPC_REL32:
# CHECK: .FR_PPC_REL32:
-# CHECK: 11018: 00 00 00 04
+# CHECK: 11020: 00 00 00 04
.section .R_PPC_ADDR32,"ax", at progbits
.globl .FR_PPC_ADDR32
@@ -61,4 +75,4 @@ mystr:
# CHECK: Disassembly of section .R_PPC_ADDR32:
# CHECK: .FR_PPC_ADDR32:
-# CHECK: 1101c: 00 01 10 20
+# CHECK: 11024: 00 01 10 28
More information about the llvm-commits
mailing list