Index: COFF/Chunks.cpp =================================================================== --- COFF/Chunks.cpp +++ COFF/Chunks.cpp @@ -223,6 +223,7 @@ case IMAGE_REL_ARM64_BRANCH26: or32(Off, ((S - P) & 0x0FFFFFFC) >> 2); break; case IMAGE_REL_ARM64_ADDR32: add32(Off, S + Config->ImageBase); break; case IMAGE_REL_ARM64_ADDR64: add64(Off, S + Config->ImageBase); break; + case IMAGE_REL_ARM64_ADDR32NB: add32(Off, S); break; default: fatal("unsupported relocation type 0x" + Twine::utohexstr(Type)); } Index: test/COFF/arm64-relocs-imports.test =================================================================== --- test/COFF/arm64-relocs-imports.test +++ test/COFF/arm64-relocs-imports.test @@ -36,12 +36,13 @@ # BEFORE: 6c: c0 03 5f d6 ret # BEFORE: 70: 08 00 00 00 # BEFORE: 74: 00 00 00 00 +# BEFORE: 78: 01 00 00 00 # AFTER: Disassembly of section .text: # AFTER: 140002000: fe 0f 1f f8 str x30, [sp, #-16]! # AFTER: 140002004: e0 ff ff f0 adrp x0, #-4096 # AFTER: 140002008: 00 18 00 91 add x0, x0, #6 -# AFTER: 14000200c: 1b 00 00 94 bl #108 +# AFTER: 14000200c: 1c 00 00 94 bl #112 # AFTER: 140002010: 00 21 40 39 ldrb w0, [x8, #8] # AFTER: 140002014: 00 11 40 79 ldrh w0, [x8, #8] # AFTER: 140002018: 00 09 40 b9 ldr w0, [x8, #8] @@ -68,9 +69,10 @@ # AFTER: 14000206c: c0 03 5f d6 ret # AFTER: 140002070: 10 10 00 40 # AFTER: 140002074: 01 00 00 00 -# AFTER: 140002078: 10 00 00 b0 adrp x16, #4096 -# AFTER: 14000207c: 10 1e 40 f9 ldr x16, [x16, #56] -# AFTER: 140002080: 00 02 1f d6 br x16 +# AFTER: 140002078: 09 10 00 00 +# AFTER: 14000207c: 10 00 00 b0 adrp x16, #4096 +# AFTER: 140002080: 10 1e 40 f9 ldr x16, [x16, #56] +# AFTER: 140002084: 00 02 1f d6 br x16 --- !COFF header: @@ -80,7 +82,7 @@ - Name: .text Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] Alignment: 4 - SectionData: FE0F1FF80000009000080091000000940001403900014079000140B9000140F90001003900010079000100B9000100F90001403D0001407D000140BD000140FD0001C03D0001003D0001007D000100BD000100FD0001803D000540F9201A01B000FC4FF9E0031F2AFE0741F8C0035FD60800000000000000 + SectionData: FE0F1FF80000009000080091000000940001403900014079000140B9000140F90001003900010079000100B9000100F90001403D0001407D000140BD000140FD0001C03D0001003D0001007D000100BD000100FD0001803D000540F9201A01B000FC4FF9E0031F2AFE0741F8C0035FD6080000000000000001000000 Relocations: - VirtualAddress: 4 SymbolName: .Lstr @@ -157,6 +159,9 @@ - VirtualAddress: 112 SymbolName: .Lglobal Type: 14 + - VirtualAddress: 120 + SymbolName: .Lglobal + Type: 2 - Name: .data Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] Alignment: 4