avr32: Fix out-of-range rcalls in large kernels
authorBen Nizette <bn@niasdigital.com>
Tue, 13 Jan 2009 22:32:19 +0000 (09:32 +1100)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Fri, 16 Jan 2009 08:31:57 +0000 (09:31 +0100)
Replace handcoded rcall instructions with the call pseudo-instruction.
For kernels too far over 1MB the rcall instruction can't reach and
linking will fail.  We already call the final linker with --relax which
converts call pseudo-instructions to the right things anyway.

This fixes

arch/avr32/kernel/built-in.o: In function `syscall_exit_work':
(.ex.text+0x198): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `schedule' defined in .sched.text section in kernel/built-in.o
arch/avr32/kernel/built-in.o: In function `fault_exit_work':
(.ex.text+0x3b6): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `schedule' defined in .sched.text section in kernel/built-in.o

But I'm still left with

arch/avr32/kernel/built-in.o:(.fixup+0x2): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+45a
arch/avr32/kernel/built-in.o:(.fixup+0x8): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+8ea
arch/avr32/kernel/built-in.o:(.fixup+0xe): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+abe
arch/avr32/kernel/built-in.o:(.fixup+0x14): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+ac8
arch/avr32/kernel/built-in.o:(.fixup+0x1a): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+ad2
arch/avr32/kernel/built-in.o:(.fixup+0x20): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+adc
arch/avr32/kernel/built-in.o:(.fixup+0x26): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+ae6
arch/avr32/kernel/built-in.o:(.fixup+0x2c): relocation truncated to fit: R_AVR32_22H_PCREL against `.text'+af0
arch/avr32/kernel/built-in.o:(.fixup+0x32): additional relocation overflows omitted from the output

These are caused by a similar problem with 'rjmp' instructions.
Unfortunately, there's no easy fix for these at the moment since we
don't have a arbitrary-range 'jmp' instruction similar to 'call'.

Signed-off-by: Ben Nizette <bn@niasdigital.com>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
arch/avr32/kernel/entry-avr32b.S
arch/avr32/kernel/syscall-stubs.S
arch/avr32/lib/strnlen_user.S

index 33d49377b8beda6ae217cf40928d304d5eabfa6d..009a80155d67d96b7da1ee34e60ec726abcfdb4b 100644 (file)
@@ -150,10 +150,10 @@ page_not_present:
        tlbmiss_restore
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        mfsr    r12, SYSREG_ECR
        mov     r11, sp
-       rcall   do_page_fault
+       call    do_page_fault
        rjmp    ret_from_exception
 
        .align  2
@@ -250,7 +250,7 @@ syscall_badsys:
 
        .global ret_from_fork
 ret_from_fork:
-       rcall   schedule_tail
+       call   schedule_tail
 
        /* check for syscall tracing */
        get_thread_info r0
@@ -261,7 +261,7 @@ ret_from_fork:
 
 syscall_trace_enter:
        pushm   r8-r12
-       rcall   syscall_trace
+       call    syscall_trace
        popm    r8-r12
        rjmp    syscall_trace_cont
 
@@ -269,14 +269,14 @@ syscall_exit_work:
        bld     r1, TIF_SYSCALL_TRACE
        brcc    1f
        unmask_interrupts
-       rcall   syscall_trace
+       call    syscall_trace
        mask_interrupts
        ld.w    r1, r0[TI_flags]
 
 1:     bld     r1, TIF_NEED_RESCHED
        brcc    2f
        unmask_interrupts
-       rcall   schedule
+       call    schedule
        mask_interrupts
        ld.w    r1, r0[TI_flags]
        rjmp    1b
@@ -287,7 +287,7 @@ syscall_exit_work:
        unmask_interrupts
        mov     r12, sp
        mov     r11, r0
-       rcall   do_notify_resume
+       call    do_notify_resume
        mask_interrupts
        ld.w    r1, r0[TI_flags]
        rjmp    1b
@@ -394,7 +394,7 @@ handle_critical:
 
        mfsr    r12, SYSREG_ECR
        mov     r11, sp
-       rcall   do_critical_exception
+       call    do_critical_exception
 
        /* We should never get here... */
 bad_return:
@@ -407,18 +407,18 @@ bad_return:
 do_bus_error_write:
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        mov     r11, 1
        rjmp    1f
 
 do_bus_error_read:
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        mov     r11, 0
 1:     mfsr    r12, SYSREG_BEAR
        mov     r10, sp
-       rcall   do_bus_error
+       call    do_bus_error
        rjmp    ret_from_exception
 
        .align  1
@@ -433,7 +433,7 @@ do_nmi_ll:
 1:     pushm   r8, r9  /* PC and SR */
        mfsr    r12, SYSREG_ECR
        mov     r11, sp
-       rcall   do_nmi
+       call    do_nmi
        popm    r8-r9
        mtsr    SYSREG_RAR_NMI, r8
        tst     r0, r0
@@ -457,29 +457,29 @@ do_nmi_ll:
 handle_address_fault:
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        mfsr    r12, SYSREG_ECR
        mov     r11, sp
-       rcall   do_address_exception
+       call    do_address_exception
        rjmp    ret_from_exception
 
 handle_protection_fault:
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        mfsr    r12, SYSREG_ECR
        mov     r11, sp
-       rcall   do_page_fault
+       call    do_page_fault
        rjmp    ret_from_exception
 
        .align  1
 do_illegal_opcode_ll:
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        mfsr    r12, SYSREG_ECR
        mov     r11, sp
-       rcall   do_illegal_opcode
+       call    do_illegal_opcode
        rjmp    ret_from_exception
 
 do_dtlb_modified:
@@ -513,11 +513,11 @@ do_dtlb_modified:
 do_fpe_ll:
        sub     sp, 4
        stmts   --sp, r0-lr
-       rcall   save_full_context_ex
+       call    save_full_context_ex
        unmask_interrupts
        mov     r12, 26
        mov     r11, sp
-       rcall   do_fpe
+       call    do_fpe
        rjmp    ret_from_exception
 
 ret_from_exception:
@@ -553,7 +553,7 @@ fault_resume_kernel:
        lddsp   r4, sp[REG_SR]
        bld     r4, SYSREG_GM_OFFSET
        brcs    1f
-       rcall   preempt_schedule_irq
+       call    preempt_schedule_irq
 1:
 #endif
 
@@ -582,7 +582,7 @@ fault_exit_work:
        bld     r1, TIF_NEED_RESCHED
        brcc    1f
        unmask_interrupts
-       rcall   schedule
+       call    schedule
        mask_interrupts
        ld.w    r1, r0[TI_flags]
        rjmp    fault_exit_work
@@ -593,7 +593,7 @@ fault_exit_work:
        unmask_interrupts
        mov     r12, sp
        mov     r11, r0
-       rcall   do_notify_resume
+       call    do_notify_resume
        mask_interrupts
        ld.w    r1, r0[TI_flags]
        rjmp    fault_exit_work
@@ -616,10 +616,10 @@ handle_debug:
 
 .Ldebug_fixup_cont:
 #ifdef CONFIG_TRACE_IRQFLAGS
-       rcall   trace_hardirqs_off
+       call    trace_hardirqs_off
 #endif
        mov     r12, sp
-       rcall   do_debug
+       call    do_debug
        mov     sp, r12
 
        lddsp   r2, sp[REG_SR]
@@ -643,7 +643,7 @@ handle_debug:
        mtsr    SYSREG_RSR_DBG, r11
        mtsr    SYSREG_RAR_DBG, r10
 #ifdef CONFIG_TRACE_IRQFLAGS
-       rcall   trace_hardirqs_on
+       call    trace_hardirqs_on
 1:
 #endif
        ldmts   sp++, r0-lr
@@ -676,7 +676,7 @@ debug_resume_kernel:
 #ifdef CONFIG_TRACE_IRQFLAGS
        bld     r11, SYSREG_GM_OFFSET
        brcc    1f
-       rcall   trace_hardirqs_on
+       call    trace_hardirqs_on
 1:
 #endif
        mfsr    r2, SYSREG_SR
@@ -747,7 +747,7 @@ irq_level\level:
        mov     r11, sp
        mov     r12, \level
 
-       rcall   do_IRQ
+       call    do_IRQ
 
        lddsp   r4, sp[REG_SR]
        bfextu  r4, r4, SYSREG_M0_OFFSET, 3
@@ -767,7 +767,7 @@ irq_level\level:
 
 1:
 #ifdef CONFIG_TRACE_IRQFLAGS
-       rcall   trace_hardirqs_on
+       call    trace_hardirqs_on
 #endif
        popm    r8-r9
        mtsr    rar_int\level, r8
@@ -807,7 +807,7 @@ irq_level\level:
        lddsp   r4, sp[REG_SR]
        bld     r4, SYSREG_GM_OFFSET
        brcs    1b
-       rcall   preempt_schedule_irq
+       call    preempt_schedule_irq
 #endif
        rjmp    1b
        .endm
index 673178e235f3a485005ecfd43415f86fad13ab9e..f7244cd02fbbf0b96fd31f56f40c47e14d61430b 100644 (file)
@@ -61,7 +61,7 @@ __sys_execve:
 __sys_mmap2:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_mmap2
+       call    sys_mmap2
        sub     sp, -4
        popm    pc
 
@@ -70,7 +70,7 @@ __sys_mmap2:
 __sys_sendto:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_sendto
+       call    sys_sendto
        sub     sp, -4
        popm    pc
 
@@ -79,7 +79,7 @@ __sys_sendto:
 __sys_recvfrom:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_recvfrom
+       call    sys_recvfrom
        sub     sp, -4
        popm    pc
 
@@ -88,7 +88,7 @@ __sys_recvfrom:
 __sys_pselect6:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_pselect6
+       call    sys_pselect6
        sub     sp, -4
        popm    pc
 
@@ -97,7 +97,7 @@ __sys_pselect6:
 __sys_splice:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_splice
+       call    sys_splice
        sub     sp, -4
        popm    pc
 
@@ -106,7 +106,7 @@ __sys_splice:
 __sys_epoll_pwait:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_epoll_pwait
+       call    sys_epoll_pwait
        sub     sp, -4
        popm    pc
 
@@ -115,6 +115,6 @@ __sys_epoll_pwait:
 __sys_sync_file_range:
        pushm   lr
        st.w    --sp, ARG6
-       rcall   sys_sync_file_range
+       call    sys_sync_file_range
        sub     sp, -4
        popm    pc
index 65ce11afa66a258d31d413a6c578c2452789d9d7..e46f4724962b79bcc03c5b54042d2f11f4fc1981 100644 (file)
@@ -48,7 +48,7 @@ adjust_length:
        lddpc   lr, _task_size
        sub     r11, lr, r12
        mov     r9, r11
-       rcall   __strnlen_user
+       call    __strnlen_user
        cp.w    r12, r9
        brgt    1f
        popm    pc