Loading arch/arm64/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S GZFLAGS :=-9 ifneq ($(CONFIG_RELOCATABLE),) LDFLAGS_vmlinux += -pie LDFLAGS_vmlinux += -pie -Bsymbolic endif KBUILD_DEFCONFIG := defconfig Loading arch/arm64/kernel/head.S +3 −18 Original line number Diff line number Diff line Loading @@ -717,40 +717,25 @@ __primary_switch: * Iterate over each entry in the relocation table, and apply the * relocations in place. */ ldr w8, =__dynsym_offset // offset to symbol table ldr w9, =__rela_offset // offset to reloc table ldr w10, =__rela_size // size of reloc table mov_q x11, KIMAGE_VADDR // default virtual offset add x11, x11, x23 // actual virtual offset add x8, x8, x11 // __va(.dynsym) add x9, x9, x11 // __va(.rela) add x10, x9, x10 // __va(.rela) + sizeof(.rela) 0: cmp x9, x10 b.hs 2f b.hs 1f ldp x11, x12, [x9], #24 ldr x13, [x9, #-8] cmp w12, #R_AARCH64_RELATIVE b.ne 1f b.ne 0b add x13, x13, x23 // relocate str x13, [x11, x23] b 0b 1: cmp w12, #R_AARCH64_ABS64 b.ne 0b add x12, x12, x12, lsl #1 // symtab offset: 24x top word add x12, x8, x12, lsr #(32 - 3) // ... shifted into bottom word ldrsh w14, [x12, #6] // Elf64_Sym::st_shndx ldr x15, [x12, #8] // Elf64_Sym::st_value cmp w14, #-0xf // SHN_ABS (0xfff1) ? add x14, x15, x23 // relocate csel x15, x14, x15, ne add x15, x13, x15 str x15, [x11, x23] b 0b 2: 1: #endif ldr x8, =__primary_switched br x8 Loading arch/arm64/kernel/vmlinux.lds.S +2 −11 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ SECTIONS *(.discard) *(.discard.*) *(.interp .dynamic) *(.dynsym .dynstr .hash) } . = KIMAGE_VADDR + TEXT_OFFSET; Loading Loading @@ -158,19 +159,9 @@ SECTIONS .rela : ALIGN(8) { *(.rela .rela*) } .dynsym : ALIGN(8) { *(.dynsym) } .dynstr : { *(.dynstr) } .hash : { *(.hash) } __rela_offset = ADDR(.rela) - KIMAGE_VADDR; __rela_offset = ABSOLUTE(ADDR(.rela) - KIMAGE_VADDR); __rela_size = SIZEOF(.rela); __dynsym_offset = ADDR(.dynsym) - KIMAGE_VADDR; . = ALIGN(SEGMENT_ALIGN); __init_end = .; Loading Loading
arch/arm64/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S GZFLAGS :=-9 ifneq ($(CONFIG_RELOCATABLE),) LDFLAGS_vmlinux += -pie LDFLAGS_vmlinux += -pie -Bsymbolic endif KBUILD_DEFCONFIG := defconfig Loading
arch/arm64/kernel/head.S +3 −18 Original line number Diff line number Diff line Loading @@ -717,40 +717,25 @@ __primary_switch: * Iterate over each entry in the relocation table, and apply the * relocations in place. */ ldr w8, =__dynsym_offset // offset to symbol table ldr w9, =__rela_offset // offset to reloc table ldr w10, =__rela_size // size of reloc table mov_q x11, KIMAGE_VADDR // default virtual offset add x11, x11, x23 // actual virtual offset add x8, x8, x11 // __va(.dynsym) add x9, x9, x11 // __va(.rela) add x10, x9, x10 // __va(.rela) + sizeof(.rela) 0: cmp x9, x10 b.hs 2f b.hs 1f ldp x11, x12, [x9], #24 ldr x13, [x9, #-8] cmp w12, #R_AARCH64_RELATIVE b.ne 1f b.ne 0b add x13, x13, x23 // relocate str x13, [x11, x23] b 0b 1: cmp w12, #R_AARCH64_ABS64 b.ne 0b add x12, x12, x12, lsl #1 // symtab offset: 24x top word add x12, x8, x12, lsr #(32 - 3) // ... shifted into bottom word ldrsh w14, [x12, #6] // Elf64_Sym::st_shndx ldr x15, [x12, #8] // Elf64_Sym::st_value cmp w14, #-0xf // SHN_ABS (0xfff1) ? add x14, x15, x23 // relocate csel x15, x14, x15, ne add x15, x13, x15 str x15, [x11, x23] b 0b 2: 1: #endif ldr x8, =__primary_switched br x8 Loading
arch/arm64/kernel/vmlinux.lds.S +2 −11 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ SECTIONS *(.discard) *(.discard.*) *(.interp .dynamic) *(.dynsym .dynstr .hash) } . = KIMAGE_VADDR + TEXT_OFFSET; Loading Loading @@ -158,19 +159,9 @@ SECTIONS .rela : ALIGN(8) { *(.rela .rela*) } .dynsym : ALIGN(8) { *(.dynsym) } .dynstr : { *(.dynstr) } .hash : { *(.hash) } __rela_offset = ADDR(.rela) - KIMAGE_VADDR; __rela_offset = ABSOLUTE(ADDR(.rela) - KIMAGE_VADDR); __rela_size = SIZEOF(.rela); __dynsym_offset = ADDR(.dynsym) - KIMAGE_VADDR; . = ALIGN(SEGMENT_ALIGN); __init_end = .; Loading