Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -764,7 +764,7 @@ if (IsExec) { if (IsWrite) Rank |= RF_EXEC_WRITE; - else if (!Config->SingleRoRx) + else Rank |= RF_EXEC; } else { if (IsWrite) Index: test/ELF/aarch64-thunk-pi.s =================================================================== --- test/ELF/aarch64-thunk-pi.s +++ test/ELF/aarch64-thunk-pi.s @@ -16,8 +16,8 @@ bl high_target ret // CHECK: low_target: -// CHECK-NEXT: 0: 04 00 00 94 bl #16 -// CHECK-NEXT: 4: c0 03 5f d6 ret +// CHECK-NEXT: 8: 04 00 00 94 bl #16 +// CHECK-NEXT: c: c0 03 5f d6 ret .hidden low_target2 .globl low_target2 @@ -27,19 +27,19 @@ bl high_target2 ret // CHECK: low_target2: -// CHECK-NEXT: 8: 05 00 00 94 bl #20 -// CHECK-NEXT: c: c0 03 5f d6 ret +// CHECK-NEXT: 0: 05 00 00 94 bl #20 +// CHECK-NEXT: 4: c0 03 5f d6 ret // Expect range extension thunks for .text_low // adrp calculation is (PC + signed immediate) & (!0xfff) // CHECK: __AArch64ADRPThunk_high_target: -// CHECK-NEXT: 70: 10 00 08 90 adrp x16, #268435456 -// CHECK-NEXT: 74: 10 02 03 91 add x16, x16, #192 -// CHECK-NEXT: 78: 00 02 1f d6 br x16 +// CHECK-NEXT: e8: 10 00 08 90 adrp x16, #268435456 +// CHECK-NEXT: ec: 10 02 01 91 add x16, x16, #64 +// CHECK-NEXT: f0: 00 02 1f d6 br x16 // CHECK: __AArch64ADRPThunk_high_target2: -// CHECK-NEXT: 7c: 10 00 08 90 adrp x16, #268435456 -// CHECK-NEXT: 80: 10 22 00 91 add x16, x16, #8 -// CHECK-NEXT: 84: 00 02 1f d6 br x16 +// CHECK-NEXT: f4: 10 00 08 90 adrp x16, #268435456 +// CHECK-NEXT: f8: 10 22 00 91 add x16, x16, #8 +// CHECK-NEXT: fc: 00 02 1f d6 br x16 .section .text_high, "ax", %progbits @@ -50,7 +50,7 @@ bl low_target ret // CHECK: high_target: -// CHECK-NEXT: 10000000: 34 00 00 94 bl #208 +// CHECK-NEXT: 10000000: 14 00 00 94 bl #80 // CHECK-NEXT: 10000004: c0 03 5f d6 ret .hidden high_target2 @@ -68,24 +68,24 @@ // CHECK: __AArch64ADRPThunk_low_target2: // CHECK-NEXT: 10000010: 10 00 f8 90 adrp x16, #-268435456 -// CHECK-NEXT: 10000014: 10 a2 01 91 add x16, x16, #104 +// CHECK-NEXT: 10000014: 10 82 03 91 add x16, x16, #224 // CHECK-NEXT: 10000018: 00 02 1f d6 br x16 // CHECK: Disassembly of section .plt: // CHECK-NEXT: .plt: -// CHECK-NEXT: 100000a0: f0 7b bf a9 stp x16, x30, [sp, #-16]! -// CHECK-NEXT: 100000a4: 10 00 00 90 adrp x16, #0 -// CHECK-NEXT: 100000a8: 11 7a 40 f9 ldr x17, [x16, #240] -// CHECK-NEXT: 100000ac: 10 c2 03 91 add x16, x16, #240 -// CHECK-NEXT: 100000b0: 20 02 1f d6 br x17 -// CHECK-NEXT: 100000b4: 1f 20 03 d5 nop -// CHECK-NEXT: 100000b8: 1f 20 03 d5 nop -// CHECK-NEXT: 100000bc: 1f 20 03 d5 nop -// CHECK-NEXT: 100000c0: 10 00 00 90 adrp x16, #0 -// CHECK-NEXT: 100000c4: 11 7e 40 f9 ldr x17, [x16, #248] -// CHECK-NEXT: 100000c8: 10 e2 03 91 add x16, x16, #248 -// CHECK-NEXT: 100000cc: 20 02 1f d6 br x17 -// CHECK-NEXT: 100000d0: 10 00 00 90 adrp x16, #0 -// CHECK-NEXT: 100000d4: 11 82 40 f9 ldr x17, [x16, #256] -// CHECK-NEXT: 100000d8: 10 02 04 91 add x16, x16, #256 -// CHECK-NEXT: 100000dc: 20 02 1f d6 br x17 +// CHECK-NEXT: 10000020: f0 7b bf a9 stp x16, x30, [sp, #-16]! +// CHECK-NEXT: 10000024: 10 00 00 90 adrp x16, #0 +// CHECK-NEXT: 10000028: 11 3a 40 f9 ldr x17, [x16, #112] +// CHECK-NEXT: 1000002c: 10 c2 01 91 add x16, x16, #112 +// CHECK-NEXT: 10000030: 20 02 1f d6 br x17 +// CHECK-NEXT: 10000034: 1f 20 03 d5 nop +// CHECK-NEXT: 10000038: 1f 20 03 d5 nop +// CHECK-NEXT: 1000003c: 1f 20 03 d5 nop +// CHECK-NEXT: 10000040: 10 00 00 90 adrp x16, #0 +// CHECK-NEXT: 10000044: 11 3e 40 f9 ldr x17, [x16, #120] +// CHECK-NEXT: 10000048: 10 e2 01 91 add x16, x16, #120 +// CHECK-NEXT: 1000004c: 20 02 1f d6 br x17 +// CHECK-NEXT: 10000050: 10 00 00 90 adrp x16, #0 +// CHECK-NEXT: 10000054: 11 42 40 f9 ldr x17, [x16, #128] +// CHECK-NEXT: 10000058: 10 02 02 91 add x16, x16, #128 +// CHECK-NEXT: 1000005c: 20 02 1f d6 br x17 Index: test/ELF/synthetic-got.s =================================================================== --- test/ELF/synthetic-got.s +++ test/ELF/synthetic-got.s @@ -7,13 +7,13 @@ # RUN: | FileCheck %s --check-prefix=GOTDATA # GOT: Sections: -# GOT: 8 .got.plt 00000020 00000000000000d0 DATA -# GOT: 10 .got 00000008 00000000000001c0 DATA +# GOT: 8 .got.plt 00000020 00000000000000e0 DATA +# GOT: 10 .got 00000008 00000000000001d0 DATA # GOTDATA: Contents of section .got.plt: -# GOTDATA-NEXT: 00d0 f0000000 00000000 00000000 00000000 -# GOTDATA-NEXT: 00e0 00000000 00000000 c6000000 00000000 +# GOTDATA-NEXT: 00e0 00010000 00000000 00000000 00000000 +# GOTDATA-NEXT: 00f0 00000000 00000000 d6000000 00000000 # GOTDATA-NEXT: Contents of section .got: -# GOTDATA-NEXT: 01c0 00000000 00000000 +# GOTDATA-NEXT: 01d0 00000000 00000000 # RUN: echo "SECTIONS { .mygot : { *(.got) *(.got.plt) } }" > %t1.script # RUN: ld.lld --hash-style=sysv -shared %t.o -o %t1.out --script %t1.script @@ -21,12 +21,12 @@ # RUN: llvm-objdump -s -section=.mygot %t1.out | FileCheck %s --check-prefix=MYGOTDATA # MYGOT: Sections: -# MYGOT: 8 .mygot 00000028 00000000000000d0 DATA +# MYGOT: 8 .mygot 00000028 00000000000000e0 DATA # MYGOT-NOT: .got # MYGOT-NOT: .got.plt -# MYGOTDATA: 00d0 00000000 00000000 f8000000 00000000 -# MYGOTDATA-NEXT: 00e0 00000000 00000000 00000000 00000000 -# MYGOTDATA-NEXT: 00f0 c6000000 00000000 +# MYGOTDATA: 00e0 00000000 00000000 08010000 00000000 +# MYGOTDATA-NEXT: 00f0 00000000 00000000 00000000 00000000 +# MYGOTDATA-NEXT: 0100 d6000000 00000000 mov bar@gotpcrel(%rip), %rax call foo@plt Index: test/ELF/x86-64-retpoline-linkerscript.s =================================================================== --- test/ELF/x86-64-retpoline-linkerscript.s +++ test/ELF/x86-64-retpoline-linkerscript.s @@ -14,8 +14,8 @@ // CHECK: Disassembly of section .plt: // CHECK-NEXT: .plt: -// CHECK-NEXT: 10: ff 35 ea 00 00 00 pushq 234(%rip) -// CHECK-NEXT: 16: 4c 8b 1d eb 00 00 00 movq 235(%rip), %r11 +// CHECK-NEXT: 10: ff 35 72 00 00 00 pushq 114(%rip) +// CHECK-NEXT: 16: 4c 8b 1d 73 00 00 00 movq 115(%rip), %r11 // CHECK-NEXT: 1d: e8 0e 00 00 00 callq 14 <.plt+0x20> // CHECK-NEXT: 22: f3 90 pause // CHECK-NEXT: 24: 0f ae e8 lfence @@ -40,7 +40,7 @@ // CHECK-NEXT: 3d: cc int3 // CHECK-NEXT: 3e: cc int3 // CHECK-NEXT: 3f: cc int3 -// CHECK-NEXT: 40: 4c 8b 1d c9 00 00 00 movq 201(%rip), %r11 +// CHECK-NEXT: 40: 4c 8b 1d 51 00 00 00 movq 81(%rip), %r11 // CHECK-NEXT: 47: e8 e4 ff ff ff callq -28 <.plt+0x20> // CHECK-NEXT: 4c: e9 d1 ff ff ff jmp -47 <.plt+0x12> // CHECK-NEXT: 51: 68 00 00 00 00 pushq $0 @@ -50,7 +50,7 @@ // CHECK-NEXT: 5d: cc int3 // CHECK-NEXT: 5e: cc int3 // CHECK-NEXT: 5f: cc int3 -// CHECK-NEXT: 60: 4c 8b 1d b1 00 00 00 movq 177(%rip), %r11 +// CHECK-NEXT: 60: 4c 8b 1d 39 00 00 00 movq 57(%rip), %r11 // CHECK-NEXT: 67: e8 c4 ff ff ff callq -60 <.plt+0x20> // CHECK-NEXT: 6c: e9 b1 ff ff ff jmp -79 <.plt+0x12> // CHECK-NEXT: 71: 68 01 00 00 00 pushq $1