]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARC: change some branchs to jumps to resolve linkage errors
authorYuriy Kolerov <yuriy.kolerov@synopsys.com>
Wed, 12 Aug 2015 14:23:32 +0000 (17:23 +0300)
committerVineet Gupta <vgupta@synopsys.com>
Thu, 20 Aug 2015 13:23:15 +0000 (18:53 +0530)
When kernel's binary becomes large enough (32M and more) errors
may occur during the final linkage stage. It happens because
the build system uses short relocations for ARC  by default.
This problem may be easily resolved by passing -mlong-calls
option to GCC to use long absolute jumps (j) instead of short
relative branchs (b).

But there are fragments of pure assembler code exist which use
branchs in inappropriate places and cause a linkage error because
of relocations overflow.

First of these fragments is .fixup insertion in futex.h and
unaligned.c. It inserts a code in the separate section (.fixup)
with branch instruction. It leads to the linkage error when
kernel becomes large.

Second of these fragments is calling scheduler's functions
(common kernel code) from entry.S of ARC's code. When kernel's
binary becomes large it may lead to the linkage error because
scheduler may occur far enough from ARC's code in the final
binary.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/include/asm/futex.h
arch/arc/kernel/entry.S
arch/arc/kernel/unaligned.c

index 8f449982523bb04cf8f035d59005b863a14fa0ba..11e1b1f3acda7fb0a741dcf2d3aed5ae55d79de1 100644 (file)
@@ -31,7 +31,7 @@
        "       .section .fixup,\"ax\"          \n"     \
        "       .align  4                       \n"     \
        "4:     mov %0, %4                      \n"     \
-       "       b   3b                          \n"     \
+       "       j   3b                          \n"     \
        "       .previous                       \n"     \
        "       .section __ex_table,\"a\"       \n"     \
        "       .align  4                       \n"     \
@@ -58,7 +58,7 @@
        "       .section .fixup,\"ax\"          \n"     \
        "       .align  4                       \n"     \
        "4:     mov %0, %4                      \n"     \
-       "       b   3b                          \n"     \
+       "       j   3b                          \n"     \
        "       .previous                       \n"     \
        "       .section __ex_table,\"a\"       \n"     \
        "       .align  4                       \n"     \
@@ -178,7 +178,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 expval,
        "3:     \n"
        "       .section .fixup,\"ax\"  \n"
        "4:     mov %0, %5      \n"
-       "       b   3b  \n"
+       "       j   3b  \n"
        "       .previous       \n"
        "       .section __ex_table,\"a\"       \n"
        "       .align  4       \n"
index f7a82fd4d6018b29c4e4297af9b839ca1a154fab..589abf5172d6a19047337e315fb2ff5ad1fab8a4 100644 (file)
@@ -42,7 +42,7 @@ ENTRY(ret_from_fork)
        ; when the forked child comes here from the __switch_to function
        ; r0 has the last task pointer.
        ; put last task in scheduler queue
-       bl   @schedule_tail
+       jl   @schedule_tail
 
        ld   r9, [sp, PT_status32]
        brne r9, 0, 1f
@@ -320,7 +320,7 @@ resume_user_mode_begin:
        ; --- (Slow Path #1) task preemption ---
        bbit0  r9, TIF_NEED_RESCHED, .Lchk_pend_signals
        mov    blink, resume_user_mode_begin  ; tail-call to U mode ret chks
-       b      @schedule        ; BTST+Bnz causes relo error in link
+       j      @schedule        ; BTST+Bnz causes relo error in link
 
 .Lchk_pend_signals:
        IRQ_ENABLE      r10
@@ -381,7 +381,7 @@ resume_kernel_mode:
        bbit0  r9, TIF_NEED_RESCHED, .Lrestore_regs
 
        ; Invoke PREEMPTION
-       bl      preempt_schedule_irq
+       jl      preempt_schedule_irq
 
        ; preempt_schedule_irq() always returns with IRQ disabled
 #endif
index 74db59b6f39269f072ce606700375ae14ab9ec8c..abd961f3e7639f13fb7954da68885ed0215f432c 100644 (file)
@@ -34,7 +34,7 @@
        "       .section .fixup,\"ax\"\n"               \
        "       .align  4\n"                            \
        "3:     mov     %0, 1\n"                        \
-       "       b       2b\n"                           \
+       "       j       2b\n"                           \
        "       .previous\n"                            \
        "       .section __ex_table,\"a\"\n"            \
        "       .align  4\n"                            \
@@ -82,7 +82,7 @@
                "       .section .fixup,\"ax\"\n"       \
                "       .align  4\n"                    \
                "4:     mov     %0, 1\n"                \
-               "       b       3b\n"                   \
+               "       j       3b\n"                   \
                "       .previous\n"                    \
                "       .section __ex_table,\"a\"\n"    \
                "       .align  4\n"                    \
                "       .section .fixup,\"ax\"\n"       \
                "       .align  4\n"                    \
                "6:     mov     %0, 1\n"                \
-               "       b       5b\n"                   \
+               "       j       5b\n"                   \
                "       .previous\n"                    \
                "       .section __ex_table,\"a\"\n"    \
                "       .align  4\n"                    \