Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -2224,7 +2224,7 @@ // in its own pages, not sharable with adjacent segments. // // TODO Enable this technique on other targets. - if (config->emachine != EM_PPC64) + if (config->emachine != EM_AARCH64 && config->emachine != EM_PPC64) force_align = true; if (force_align || (config->zSeparateCode && last && Index: test/ELF/aarch64-abs16.s =================================================================== --- test/ELF/aarch64-abs16.s +++ test/ELF/aarch64-abs16.s @@ -14,11 +14,11 @@ // RUN: llvm-objdump -s -section=.data %t2 | FileCheck %s // CHECK: Contents of section .data: -// 210000: S = 0x100, A = 0xfeff +// 220158: S = 0x100, A = 0xfeff // S + A = 0xffff -// 210002: S = 0x100, A = -0x8100 +// 22015c: S = 0x100, A = -0x8100 // S + A = 0x8000 -// CHECK-NEXT: 210000 ffff0080 +// CHECK-NEXT: 220158 ffff0080 // RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1 // OVERFLOW1: relocation R_AARCH64_ABS16 out of range: -32769 is not in [-32768, 65535] Index: test/ELF/aarch64-abs32.s =================================================================== --- test/ELF/aarch64-abs32.s +++ test/ELF/aarch64-abs32.s @@ -14,11 +14,11 @@ // RUN: llvm-objdump -s -section=.data %t2 | FileCheck %s // CHECK: Contents of section .data: -// 210000: S = 0x100, A = 0xfffffeff +// 220158: S = 0x100, A = 0xfffffeff // S + A = 0xffffffff -// 210004: S = 0x100, A = -0x80000100 +// 22015c: S = 0x100, A = -0x80000100 // S + A = 0x80000000 -// CHECK-NEXT: 210000 ffffffff 00000080 +// CHECK-NEXT: 220158 ffffffff 00000080 // RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1 // OVERFLOW1: relocation R_AARCH64_ABS32 out of range: -2147483649 is not in [-2147483648, 4294967295] Index: test/ELF/aarch64-call26-thunk.s =================================================================== --- test/ELF/aarch64-call26-thunk.s +++ test/ELF/aarch64-call26-thunk.s @@ -12,11 +12,11 @@ // CHECK: Disassembly of section .text: // CHECK-EMPTY: // CHECK-NEXT: _start: -// CHECK-NEXT: 210000: 02 00 00 94 bl #8 +// CHECK-NEXT: 210120: 02 00 00 94 bl #8 // CHECK: __AArch64AbsLongThunk_big: -// CHECK-NEXT: 210008: 50 00 00 58 ldr x16, #8 -// CHECK-NEXT: 21000c: 00 02 1f d6 br x16 +// CHECK-NEXT: 210128: 50 00 00 58 ldr x16, #8 +// CHECK-NEXT: 21012c: 00 02 1f d6 br x16 // CHECK: $d: -// CHECK-NEXT: 210010: 00 00 00 00 .word 0x00000000 -// CHECK-NEXT: 210014: 10 00 00 00 .word 0x00000010 +// CHECK-NEXT: 210130: 00 00 00 00 .word 0x00000000 +// CHECK-NEXT: 210134: 10 00 00 00 .word 0x00000010 Index: test/ELF/basic-aarch64.s =================================================================== --- test/ELF/basic-aarch64.s +++ test/ELF/basic-aarch64.s @@ -26,7 +26,7 @@ # CHECK-NEXT: Version: 1 # CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]] # CHECK-NEXT: ProgramHeaderOffset: 0x40 -# CHECK-NEXT: SectionHeaderOffset: 0x10098 +# CHECK-NEXT: SectionHeaderOffset: 0x1B8 # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: HeaderSize: 64 @@ -59,8 +59,8 @@ # CHECK-NEXT: SHF_ALLOC (0x2) # CHECK-NEXT: SHF_EXECINSTR (0x4) # CHECK-NEXT: ] -# CHECK-NEXT: Address: 0x210000 -# CHECK-NEXT: Offset: 0x10000 +# CHECK-NEXT: Address: 0x210120 +# CHECK-NEXT: Offset: 0x120 # CHECK-NEXT: Size: 12 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -76,7 +76,7 @@ # CHECK-NEXT: SHF_STRINGS (0x20) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x1000C +# CHECK-NEXT: Offset: 0x12C # CHECK-NEXT: Size: 8 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -90,7 +90,7 @@ # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x10018 +# CHECK-NEXT: Offset: 0x138 # CHECK-NEXT: Size: 72 # CHECK-NEXT: Link: 5 # CHECK-NEXT: Info: 2 @@ -104,7 +104,7 @@ # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x10060 +# CHECK-NEXT: Offset: 0x180 # CHECK-NEXT: Size: 42 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -118,7 +118,7 @@ # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 -# CHECK-NEXT: Offset: 0x1008A +# CHECK-NEXT: Offset: 0x1AA # CHECK-NEXT: Size: 13 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 @@ -138,7 +138,7 @@ # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: $x.0 -# CHECK-NEXT: Value: 0x210000 +# CHECK-NEXT: Value: 0x210120 # CHECK-NEXT: Size: 0 # CHECK-NEXT: Binding: Local (0x0) # CHECK-NEXT: Type: None (0x0) @@ -159,8 +159,8 @@ # CHECK-NEXT: ProgramHeader { # CHECK-NEXT: Type: PT_PHDR (0x6) # CHECK-NEXT: Offset: 0x40 -# CHECK-NEXT: VirtualAddress: 0x200040 -# CHECK-NEXT: PhysicalAddress: 0x200040 +# CHECK-NEXT: VirtualAddress: 0x210040 +# CHECK-NEXT: PhysicalAddress: 0x210040 # CHECK-NEXT: FileSize: 224 # CHECK-NEXT: MemSize: 224 # CHECK-NEXT: Flags [ (0x4) @@ -171,20 +171,20 @@ # CHECK-NEXT: ProgramHeader { # CHECK-NEXT: Type: PT_LOAD (0x1) # CHECK-NEXT: Offset: 0x0 -# CHECK-NEXT: VirtualAddress: 0x200000 -# CHECK-NEXT: PhysicalAddress: 0x200000 -# CHECK-NEXT: FileSize: 288 -# CHECK-NEXT: MemSize: 288 -# CHECK-NEXT: Flags [ -# CHECK-NEXT: PF_R -# CHECK-NEXT: ] -# CHECK-NEXT: Alignment: 65536 -# CHECK-NEXT: } -# CHECK-NEXT: ProgramHeader { -# CHECK-NEXT: Type: PT_LOAD (0x1) -# CHECK-NEXT: Offset: 0x1000 # CHECK-NEXT: VirtualAddress: 0x210000 # CHECK-NEXT: PhysicalAddress: 0x210000 +# CHECK-NEXT: FileSize: 288 +# CHECK-NEXT: MemSize: 288 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 65536 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD (0x1) +# CHECK-NEXT: Offset: 0x120 +# CHECK-NEXT: VirtualAddress: 0x210120 +# CHECK-NEXT: PhysicalAddress: 0x210120 # CHECK-NEXT: FileSize: 12 # CHECK-NEXT: MemSize: 12 # CHECK-NEXT: Flags [ (0x5) Index: test/ELF/plt-aarch64.s =================================================================== --- test/ELF/plt-aarch64.s +++ test/ELF/plt-aarch64.s @@ -17,7 +17,7 @@ // CHECKDSO-NEXT: SHF_ALLOC // CHECKDSO-NEXT: SHF_EXECINSTR // CHECKDSO-NEXT: ] -// CHECKDSO-NEXT: Address: 0x10010 +// CHECKDSO-NEXT: Address: 0x10390 // CHECKDSO-NEXT: Offset: // CHECKDSO-NEXT: Size: 80 // CHECKDSO-NEXT: Link: @@ -55,16 +55,16 @@ // .got.plt[0..2] = 0 (reserved) // .got.plt[3..5] = .plt = 0x10010 // DUMPDSO-NEXT: 30000 00000000 00000000 00000000 00000000 ................ -// DUMPDSO-NEXT: 30010 00000000 00000000 10000100 00000000 ................ -// DUMPDSO-NEXT: 30020 10000100 00000000 10000100 00000000 ................ +// DUMPDSO-NEXT: 30010 00000000 00000000 90030100 00000000 ................ +// DUMPDSO-NEXT: 30020 90030100 00000000 90030100 00000000 ................ // DISASMDSO: _start: -// 0x10030 - 0x10000 = 0x30 = 48 -// DISASMDSO-NEXT: 10000: 0c 00 00 14 b #48 -// 0x10040 - 0x10004 = 0x3c = 60 -// DISASMDSO-NEXT: 10004: 0f 00 00 14 b #60 -// 0x10050 - 0x10008 = 0x48 = 72 -// DISASMDSO-NEXT: 10008: 12 00 00 14 b #72 +// 0x103b0 - 0x10378 = 56 +// DISASMDSO-NEXT: 10378: 0c 00 00 14 b #56 +// 0x103c0 - 0x1037c = 60 +// DISASMDSO-NEXT: 1037c: 0f 00 00 14 b #60 +// 0x103d0 - 0x10380 = 72 +// DISASMDSO-NEXT: 10380: 12 00 00 14 b #72 // DISASMDSO: foo: // DISASMDSO-NEXT: 1000c: 1f 20 03 d5 nop @@ -88,7 +88,7 @@ // Page(0x30018) - Page(0x10030) = 0x30000 - 0x10000 = 0x20000 = 131072 // DISASMDSO-EMPTY: // DISASMDSO-NEXT: foo@plt: -// DISASMDSO-NEXT: 10030: 10 01 00 90 adrp x16, #131072 +// DISASMDSO-NEXT: 103b0: 10 01 00 90 adrp x16, #131072 // 0x3018 & 0xFFF = 0x18 = 24 // DISASMDSO-NEXT: 10034: 11 0e 40 f9 ldr x17, [x16, #24] // DISASMDSO-NEXT: 10038: 10 62 00 91 add x16, x16, #24 @@ -98,7 +98,7 @@ // Page(0x30020) - Page(0x10040) = 0x30000 - 0x10000 = 0x20000 = 131072 // DISASMDSO-EMPTY: // DISASMDSO-NEXT: bar@plt: -// DISASMDSO-NEXT: 10040: 10 01 00 90 adrp x16, #131072 +// DISASMDSO-NEXT: 103c0: 10 01 00 90 adrp x16, #131072 // 0x3020 & 0xFFF = 0x20 = 32 // DISASMDSO-NEXT: 10044: 11 12 40 f9 ldr x17, [x16, #32] // DISASMDSO-NEXT: 10048: 10 82 00 91 add x16, x16, #32 @@ -108,7 +108,7 @@ // Page(0x30028) - Page(0x10050) = 0x30000 - 0x10000 = 0x20000 = 131072 // DISASMDSO-EMPTY: // DISASMDSO-NEXT: weak@plt: -// DISASMDSO-NEXT: 10050: 10 01 00 90 adrp x16, #131072 +// DISASMDSO-NEXT: 103d0: 10 01 00 90 adrp x16, #131072 // 0x3028 & 0xFFF = 0x28 = 40 // DISASMDSO-NEXT: 10054: 11 16 40 f9 ldr x17, [x16, #40] // DISASMDSO-NEXT: 10058: 10 a2 00 91 add x16, x16, #40