[PATCH] D57292: [LLD] [COFF] Add support for the new relocation IMAGE_REL_ARM64_REL32
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 26 12:46:54 PST 2019
mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk, pcc, compnerd, TomTan.
Herald added subscribers: kristof.beyls, javed.absar.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D57292
Files:
COFF/Chunks.cpp
test/COFF/arm64-relocs-imports.test
Index: test/COFF/arm64-relocs-imports.test
===================================================================
--- test/COFF/arm64-relocs-imports.test
+++ test/COFF/arm64-relocs-imports.test
@@ -45,12 +45,13 @@
# BEFORE: 90: 20 1a 09 30 adr x0, #74565
# BEFORE: 94: 01 00 00 54 b.ne #0
# BEFORE: 98: 00 00 00 36 tbz w0, #0, #0
+# BEFORE: 9c: 01 00 00 00 udf #1
# AFTER: Disassembly of section .text:
# AFTER: 140001000: fe 0f 1f f8 str x30, [sp, #-16]!
# AFTER: 140001004: 00 00 00 b0 adrp x0, #4096
# AFTER: 140001008: 00 18 00 91 add x0, x0, #6
-# AFTER: 14000100c: 24 00 00 94 bl #144
+# AFTER: 14000100c: 25 00 00 94 bl #148
# AFTER: 140001010: 00 21 40 39 ldrb w0, [x8, #8]
# AFTER: 140001014: 00 11 40 79 ldrh w0, [x8, #8]
# AFTER: 140001018: 00 09 40 b9 ldr w0, [x8, #8]
@@ -84,11 +85,12 @@
# AFTER: 140001088: 00 c4 41 f9 ldr x0, [x0, #904]
# AFTER: 14000108c: 03 00 00 00 udf #3
# AFTER: 140001090: e0 95 09 30 adr x0, #78525
-# AFTER: 140001094: 41 00 00 54 b.ne #8
-# AFTER: 140001098: 20 00 00 36 tbz w0, #0, #4
-# AFTER: 14000109c: 10 00 00 b0 adrp x16, #4096
-# AFTER: 1400010a0: 10 2a 40 f9 ldr x16, [x16, #80]
-# AFTER: 1400010a4: 00 02 1f d6 br x16
+# AFTER: 140001094: 61 00 00 54 b.ne #12
+# AFTER: 140001098: 40 00 00 36 tbz w0, #0, #8
+# AFTER: 14000109c: 61 ff ff ff <unknown>
+# AFTER: 1400010a0: 10 00 00 b0 adrp x16, #4096
+# AFTER: 1400010a4: 10 2a 40 f9 ldr x16, [x16, #80]
+# AFTER: 1400010a8: 00 02 1f d6 br x16
--- !COFF
header:
@@ -98,7 +100,7 @@
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 4
- SectionData: FE0F1FF80000009000080091000000940001403900014079000140B9000140F90001003900010079000100B9000100F90001403D0001407D000140BD000140FD0001C03D0001003D0001007D000100BD000100FD0001803D000540F9201A01B000FC4FF9E0031F2AFE0741F8C0035FD6080000000000000001000000010000000000009100004091000040f901000000201a09300100005400000036
+ SectionData: FE0F1FF80000009000080091000000940001403900014079000140B9000140F90001003900010079000100B9000100F90001403D0001407D000140BD000140FD0001C03D0001003D0001007D000100BD000100FD0001803D000540F9201A01B000FC4FF9E0031F2AFE0741F8C0035FD6080000000000000001000000010000000000009100004091000040f901000000201a0930010000540000003601000000
Relocations:
- VirtualAddress: 4
SymbolName: .Lstr
@@ -202,6 +204,9 @@
- VirtualAddress: 152
SymbolName: function
Type: IMAGE_REL_ARM64_BRANCH14
+ - VirtualAddress: 156
+ SymbolName: main
+ Type: IMAGE_REL_ARM64_REL32
- Name: .data
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
Alignment: 4
Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -309,6 +309,7 @@
case IMAGE_REL_ARM64_SECREL_HIGH12A: applySecRelHigh12A(this, Off, OS, S); break;
case IMAGE_REL_ARM64_SECREL_LOW12L: applySecRelLdr(this, Off, OS, S); break;
case IMAGE_REL_ARM64_SECTION: applySecIdx(Off, OS); break;
+ case IMAGE_REL_ARM64_REL32: add32(Off, S - P - 4); break;
default:
error("unsupported relocation type 0x" + Twine::utohexstr(Type) + " in " +
toString(File));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57292.183725.patch
Type: text/x-patch
Size: 3732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190126/a94bf0f0/attachment.bin>
More information about the llvm-commits
mailing list