[SPARC64]: Fix linkage of enormous kernels.
authorDavid S. Miller <davem@sunset.davemloft.net>
Wed, 31 Oct 2007 04:11:28 +0000 (21:11 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 31 Oct 2007 22:30:56 +0000 (15:30 -0700)
This was found by make randconfig

If the kernel .text is very large, the .fixup section branches
are too far away to be relocated correctly.

Use "sethi %hi(label), reg; jmpl reg + %lo(label); %g0" sequence
instead of the branch to fix this.

There is another case in switch_to() involving a branch, which
is fixed similarly.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/asm-sparc64/futex.h
include/asm-sparc64/system.h
include/asm-sparc64/uaccess.h

index 876312fe82ccf9dbf894a100a26978a5f8267f10..df1097d6ffbe63258dc566924cedb9e393438d5f 100644 (file)
@@ -17,7 +17,8 @@
        "3:\n"                                          \
        "       .section .fixup,#alloc,#execinstr\n"    \
        "       .align  4\n"                            \
-       "4:     ba      3b\n"                           \
+       "4:     sethi   %%hi(3b), %0\n"                 \
+       "       jmpl    %0 + %%lo(3b), %%g0\n"          \
        "        mov    %5, %0\n"                       \
        "       .previous\n"                            \
        "       .section __ex_table,\"a\"\n"            \
@@ -91,7 +92,8 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
        "2:\n"
        "       .section .fixup,#alloc,#execinstr\n"
        "       .align  4\n"
-       "3:     ba      2b\n"
+       "3:     sethi   %%hi(2b), %0\n"
+       "       jmpl    %0 + %%lo(2b), %%g0\n"
        "        mov    %4, %0\n"
        "       .previous\n"
        "       .section __ex_table,\"a\"\n"
index 159e62b51d705055b7b975ab4a4f68f21c6e429a..99a669c190c776a030ddc2be595693982a1c3fe0 100644 (file)
@@ -178,7 +178,9 @@ do {        if (test_thread_flag(TIF_PERFCTR)) {                            \
        "ldx    [%%g6 + %9], %%g4\n\t"                                  \
        "brz,pt %%o7, 1f\n\t"                                           \
        " mov   %%g7, %0\n\t"                                           \
-       "b,a ret_from_syscall\n\t"                                      \
+       "sethi  %%hi(ret_from_syscall), %%g1\n\t"                       \
+       "jmpl   %%g1 + %%lo(ret_from_syscall), %%g0\n\t"                \
+       " nop\n\t"                                                      \
        "1:\n\t"                                                        \
        : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \
          "=r" (__local_per_cpu_offset)                                 \
index afe236ba555b97527f197079ec213e0c38ee6307..93720e7b0289250267dbc461b1defb9d4160e6e5 100644 (file)
@@ -123,7 +123,8 @@ __asm__ __volatile__(                                                       \
        ".section .fixup,#alloc,#execinstr\n\t"                         \
        ".align 4\n"                                                    \
 "3:\n\t"                                                               \
-       "b      2b\n\t"                                                 \
+       "sethi  %%hi(2b), %0\n\t"                                       \
+       "jmpl   %0 + %%lo(2b), %%g0\n\t"                                \
        " mov   %3, %0\n\n\t"                                           \
        ".previous\n\t"                                                 \
        ".section __ex_table,\"a\"\n\t"                                 \
@@ -165,8 +166,9 @@ __asm__ __volatile__(                                                       \
        ".section .fixup,#alloc,#execinstr\n\t"                         \
        ".align 4\n"                                                    \
 "3:\n\t"                                                               \
+       "sethi  %%hi(2b), %0\n\t"                                       \
        "clr    %1\n\t"                                                 \
-       "b      2b\n\t"                                                 \
+       "jmpl   %0 + %%lo(2b), %%g0\n\t"                                \
        " mov   %3, %0\n\n\t"                                           \
        ".previous\n\t"                                                 \
        ".section __ex_table,\"a\"\n\t"                                 \