Patch "LoongArch: Apply dynamic relocations for LLD" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    LoongArch: Apply dynamic relocations for LLD

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     loongarch-apply-dynamic-relocations-for-lld.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 776ee1df593679ce3cb70ee9db7b4e4d85ba4f92
Author: WANG Rui <wangrui@xxxxxxxxxxx>
Date:   Sat Dec 9 15:49:15 2023 +0800

    LoongArch: Apply dynamic relocations for LLD
    
    [ Upstream commit eea673e9d5ea994c60b550ffb684413d3759b3f4 ]
    
    For the following assembly code:
    
         .text
         .global func
     func:
         nop
    
         .data
     var:
         .dword func
    
    When linked with `-pie`, GNU LD populates the `var` variable with the
    pre-relocated value of `func`. However, LLVM LLD does not exhibit the
    same behavior. This issue also arises with the `kernel_entry` in arch/
    loongarch/kernel/head.S:
    
     _head:
         .word   MZ_MAGIC                /* "MZ", MS-DOS header */
         .org    0x8
         .dword  kernel_entry            /* Kernel entry point */
    
    The correct kernel entry from the MS-DOS header is crucial for jumping
    to vmlinux from zboot. This necessity is why the compressed relocatable
    kernel compiled by Clang encounters difficulties in booting.
    
    To address this problem, it is proposed to apply dynamic relocations to
    place with `--apply-dynamic-relocs`.
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1962
    Signed-off-by: WANG Rui <wangrui@xxxxxxxxxxx>
    Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index 96747bfec1a1..d423fba7c406 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -80,7 +80,7 @@ endif
 
 ifeq ($(CONFIG_RELOCATABLE),y)
 KBUILD_CFLAGS_KERNEL		+= -fPIE
-LDFLAGS_vmlinux			+= -static -pie --no-dynamic-linker -z notext
+LDFLAGS_vmlinux			+= -static -pie --no-dynamic-linker -z notext $(call ld-option, --apply-dynamic-relocs)
 endif
 
 cflags-y += $(call cc-option, -mno-check-zero-division)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux