aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuriy Kolerov <yuriy.kolerov@synopsys.com>2015-08-12 10:23:32 -0400
committerVineet Gupta <vgupta@synopsys.com>2015-08-20 09:23:15 -0400
commit6de6066c0d24a66df465cf87a4041ef7ef35ba6f (patch)
treef04687c44c4d3e537fcd83e287c9132d8737ef1e
parenteb2cd8b72b08fe56998600aee8a5dff93f7be5a2 (diff)
ARC: change some branchs to jumps to resolve linkage errors
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>
-rw-r--r--arch/arc/include/asm/futex.h6
-rw-r--r--arch/arc/kernel/entry.S6
-rw-r--r--arch/arc/kernel/unaligned.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/arch/arc/include/asm/futex.h b/arch/arc/include/asm/futex.h
index 8f449982523b..11e1b1f3acda 100644
--- a/arch/arc/include/asm/futex.h
+++ b/arch/arc/include/asm/futex.h
@@ -31,7 +31,7 @@
31 " .section .fixup,\"ax\" \n" \ 31 " .section .fixup,\"ax\" \n" \
32 " .align 4 \n" \ 32 " .align 4 \n" \
33 "4: mov %0, %4 \n" \ 33 "4: mov %0, %4 \n" \
34 " b 3b \n" \ 34 " j 3b \n" \
35 " .previous \n" \ 35 " .previous \n" \
36 " .section __ex_table,\"a\" \n" \ 36 " .section __ex_table,\"a\" \n" \
37 " .align 4 \n" \ 37 " .align 4 \n" \
@@ -58,7 +58,7 @@
58 " .section .fixup,\"ax\" \n" \ 58 " .section .fixup,\"ax\" \n" \
59 " .align 4 \n" \ 59 " .align 4 \n" \
60 "4: mov %0, %4 \n" \ 60 "4: mov %0, %4 \n" \
61 " b 3b \n" \ 61 " j 3b \n" \
62 " .previous \n" \ 62 " .previous \n" \
63 " .section __ex_table,\"a\" \n" \ 63 " .section __ex_table,\"a\" \n" \
64 " .align 4 \n" \ 64 " .align 4 \n" \
@@ -178,7 +178,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 expval,
178 "3: \n" 178 "3: \n"
179 " .section .fixup,\"ax\" \n" 179 " .section .fixup,\"ax\" \n"
180 "4: mov %0, %5 \n" 180 "4: mov %0, %5 \n"
181 " b 3b \n" 181 " j 3b \n"
182 " .previous \n" 182 " .previous \n"
183 " .section __ex_table,\"a\" \n" 183 " .section __ex_table,\"a\" \n"
184 " .align 4 \n" 184 " .align 4 \n"
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index f7a82fd4d601..589abf5172d6 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -42,7 +42,7 @@ ENTRY(ret_from_fork)
42 ; when the forked child comes here from the __switch_to function 42 ; when the forked child comes here from the __switch_to function
43 ; r0 has the last task pointer. 43 ; r0 has the last task pointer.
44 ; put last task in scheduler queue 44 ; put last task in scheduler queue
45 bl @schedule_tail 45 jl @schedule_tail
46 46
47 ld r9, [sp, PT_status32] 47 ld r9, [sp, PT_status32]
48 brne r9, 0, 1f 48 brne r9, 0, 1f
@@ -320,7 +320,7 @@ resume_user_mode_begin:
320 ; --- (Slow Path #1) task preemption --- 320 ; --- (Slow Path #1) task preemption ---
321 bbit0 r9, TIF_NEED_RESCHED, .Lchk_pend_signals 321 bbit0 r9, TIF_NEED_RESCHED, .Lchk_pend_signals
322 mov blink, resume_user_mode_begin ; tail-call to U mode ret chks 322 mov blink, resume_user_mode_begin ; tail-call to U mode ret chks
323 b @schedule ; BTST+Bnz causes relo error in link 323 j @schedule ; BTST+Bnz causes relo error in link
324 324
325.Lchk_pend_signals: 325.Lchk_pend_signals:
326 IRQ_ENABLE r10 326 IRQ_ENABLE r10
@@ -381,7 +381,7 @@ resume_kernel_mode:
381 bbit0 r9, TIF_NEED_RESCHED, .Lrestore_regs 381 bbit0 r9, TIF_NEED_RESCHED, .Lrestore_regs
382 382
383 ; Invoke PREEMPTION 383 ; Invoke PREEMPTION
384 bl preempt_schedule_irq 384 jl preempt_schedule_irq
385 385
386 ; preempt_schedule_irq() always returns with IRQ disabled 386 ; preempt_schedule_irq() always returns with IRQ disabled
387#endif 387#endif
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c
index 74db59b6f392..abd961f3e763 100644
--- a/arch/arc/kernel/unaligned.c
+++ b/arch/arc/kernel/unaligned.c
@@ -34,7 +34,7 @@
34 " .section .fixup,\"ax\"\n" \ 34 " .section .fixup,\"ax\"\n" \
35 " .align 4\n" \ 35 " .align 4\n" \
36 "3: mov %0, 1\n" \ 36 "3: mov %0, 1\n" \
37 " b 2b\n" \ 37 " j 2b\n" \
38 " .previous\n" \ 38 " .previous\n" \
39 " .section __ex_table,\"a\"\n" \ 39 " .section __ex_table,\"a\"\n" \
40 " .align 4\n" \ 40 " .align 4\n" \
@@ -82,7 +82,7 @@
82 " .section .fixup,\"ax\"\n" \ 82 " .section .fixup,\"ax\"\n" \
83 " .align 4\n" \ 83 " .align 4\n" \
84 "4: mov %0, 1\n" \ 84 "4: mov %0, 1\n" \
85 " b 3b\n" \ 85 " j 3b\n" \
86 " .previous\n" \ 86 " .previous\n" \
87 " .section __ex_table,\"a\"\n" \ 87 " .section __ex_table,\"a\"\n" \
88 " .align 4\n" \ 88 " .align 4\n" \
@@ -113,7 +113,7 @@
113 " .section .fixup,\"ax\"\n" \ 113 " .section .fixup,\"ax\"\n" \
114 " .align 4\n" \ 114 " .align 4\n" \
115 "6: mov %0, 1\n" \ 115 "6: mov %0, 1\n" \
116 " b 5b\n" \ 116 " j 5b\n" \
117 " .previous\n" \ 117 " .previous\n" \
118 " .section __ex_table,\"a\"\n" \ 118 " .section __ex_table,\"a\"\n" \
119 " .align 4\n" \ 119 " .align 4\n" \