Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: fix build error in arch/arm/kernel/process.c

/tmp/ccJ3ssZW.s: Assembler messages:
/tmp/ccJ3ssZW.s:1952: Error: can't resolve `.text' {.text section} - `.LFB1077'

This is caused because:

.section .data
.section .text
.section .text
.previous

does not return us to the .text section, but the .data section; this
makes use of .previous dangerous if the ordering of previous sections
is not known.

Fix up the other users of .previous; .pushsection and .popsection are
a safer pairing to use than .section and .previous.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+86 -86
+6 -6
arch/arm/include/asm/assembler.h
··· 149 149 150 150 #define USER(x...) \ 151 151 9999: x; \ 152 - .section __ex_table,"a"; \ 152 + .pushsection __ex_table,"a"; \ 153 153 .align 3; \ 154 154 .long 9999b,9001f; \ 155 - .previous 155 + .popsection 156 156 157 157 /* 158 158 * SMP data memory barrier ··· 193 193 .error "Unsupported inc macro argument" 194 194 .endif 195 195 196 - .section __ex_table,"a" 196 + .pushsection __ex_table,"a" 197 197 .align 3 198 198 .long 9999b, \abort 199 - .previous 199 + .popsection 200 200 .endm 201 201 202 202 .macro usracc, instr, reg, ptr, inc, cond, rept, abort ··· 234 234 .error "Unsupported inc macro argument" 235 235 .endif 236 236 237 - .section __ex_table,"a" 237 + .pushsection __ex_table,"a" 238 238 .align 3 239 239 .long 9999b, \abort 240 - .previous 240 + .popsection 241 241 .endr 242 242 .endm 243 243
+8 -8
arch/arm/include/asm/futex.h
··· 21 21 "2: strt %0, [%2]\n" \ 22 22 " mov %0, #0\n" \ 23 23 "3:\n" \ 24 - " .section __ex_table,\"a\"\n" \ 24 + " .pushsection __ex_table,\"a\"\n" \ 25 25 " .align 3\n" \ 26 26 " .long 1b, 4f, 2b, 4f\n" \ 27 - " .previous\n" \ 28 - " .section .fixup,\"ax\"\n" \ 27 + " .popsection\n" \ 28 + " .pushsection .fixup,\"ax\"\n" \ 29 29 "4: mov %0, %4\n" \ 30 30 " b 3b\n" \ 31 - " .previous" \ 31 + " .popsection" \ 32 32 : "=&r" (ret), "=&r" (oldval) \ 33 33 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \ 34 34 : "cc", "memory") ··· 102 102 " it eq @ explicit IT needed for the 2b label\n" 103 103 "2: streqt %2, [%3]\n" 104 104 "3:\n" 105 - " .section __ex_table,\"a\"\n" 105 + " .pushsection __ex_table,\"a\"\n" 106 106 " .align 3\n" 107 107 " .long 1b, 4f, 2b, 4f\n" 108 - " .previous\n" 109 - " .section .fixup,\"ax\"\n" 108 + " .popsection\n" 109 + " .pushsection .fixup,\"ax\"\n" 110 110 "4: mov %0, %4\n" 111 111 " b 3b\n" 112 - " .previous" 112 + " .popsection" 113 113 : "=&r" (val) 114 114 : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) 115 115 : "cc", "memory");
+20 -20
arch/arm/include/asm/uaccess.h
··· 229 229 __asm__ __volatile__( \ 230 230 "1: ldrbt %1,[%2]\n" \ 231 231 "2:\n" \ 232 - " .section .fixup,\"ax\"\n" \ 232 + " .pushsection .fixup,\"ax\"\n" \ 233 233 " .align 2\n" \ 234 234 "3: mov %0, %3\n" \ 235 235 " mov %1, #0\n" \ 236 236 " b 2b\n" \ 237 - " .previous\n" \ 238 - " .section __ex_table,\"a\"\n" \ 237 + " .popsection\n" \ 238 + " .pushsection __ex_table,\"a\"\n" \ 239 239 " .align 3\n" \ 240 240 " .long 1b, 3b\n" \ 241 - " .previous" \ 241 + " .popsection" \ 242 242 : "+r" (err), "=&r" (x) \ 243 243 : "r" (addr), "i" (-EFAULT) \ 244 244 : "cc") ··· 265 265 __asm__ __volatile__( \ 266 266 "1: ldrt %1,[%2]\n" \ 267 267 "2:\n" \ 268 - " .section .fixup,\"ax\"\n" \ 268 + " .pushsection .fixup,\"ax\"\n" \ 269 269 " .align 2\n" \ 270 270 "3: mov %0, %3\n" \ 271 271 " mov %1, #0\n" \ 272 272 " b 2b\n" \ 273 - " .previous\n" \ 274 - " .section __ex_table,\"a\"\n" \ 273 + " .popsection\n" \ 274 + " .pushsection __ex_table,\"a\"\n" \ 275 275 " .align 3\n" \ 276 276 " .long 1b, 3b\n" \ 277 - " .previous" \ 277 + " .popsection" \ 278 278 : "+r" (err), "=&r" (x) \ 279 279 : "r" (addr), "i" (-EFAULT) \ 280 280 : "cc") ··· 310 310 __asm__ __volatile__( \ 311 311 "1: strbt %1,[%2]\n" \ 312 312 "2:\n" \ 313 - " .section .fixup,\"ax\"\n" \ 313 + " .pushsection .fixup,\"ax\"\n" \ 314 314 " .align 2\n" \ 315 315 "3: mov %0, %3\n" \ 316 316 " b 2b\n" \ 317 - " .previous\n" \ 318 - " .section __ex_table,\"a\"\n" \ 317 + " .popsection\n" \ 318 + " .pushsection __ex_table,\"a\"\n" \ 319 319 " .align 3\n" \ 320 320 " .long 1b, 3b\n" \ 321 - " .previous" \ 321 + " .popsection" \ 322 322 : "+r" (err) \ 323 323 : "r" (x), "r" (__pu_addr), "i" (-EFAULT) \ 324 324 : "cc") ··· 343 343 __asm__ __volatile__( \ 344 344 "1: strt %1,[%2]\n" \ 345 345 "2:\n" \ 346 - " .section .fixup,\"ax\"\n" \ 346 + " .pushsection .fixup,\"ax\"\n" \ 347 347 " .align 2\n" \ 348 348 "3: mov %0, %3\n" \ 349 349 " b 2b\n" \ 350 - " .previous\n" \ 351 - " .section __ex_table,\"a\"\n" \ 350 + " .popsection\n" \ 351 + " .pushsection __ex_table,\"a\"\n" \ 352 352 " .align 3\n" \ 353 353 " .long 1b, 3b\n" \ 354 - " .previous" \ 354 + " .popsection" \ 355 355 : "+r" (err) \ 356 356 : "r" (x), "r" (__pu_addr), "i" (-EFAULT) \ 357 357 : "cc") ··· 371 371 THUMB( "1: strt " __reg_oper1 ", [%1]\n" ) \ 372 372 THUMB( "2: strt " __reg_oper0 ", [%1, #4]\n" ) \ 373 373 "3:\n" \ 374 - " .section .fixup,\"ax\"\n" \ 374 + " .pushsection .fixup,\"ax\"\n" \ 375 375 " .align 2\n" \ 376 376 "4: mov %0, %3\n" \ 377 377 " b 3b\n" \ 378 - " .previous\n" \ 379 - " .section __ex_table,\"a\"\n" \ 378 + " .popsection\n" \ 379 + " .pushsection __ex_table,\"a\"\n" \ 380 380 " .align 3\n" \ 381 381 " .long 1b, 4b\n" \ 382 382 " .long 2b, 4b\n" \ 383 - " .previous" \ 383 + " .popsection" \ 384 384 : "+r" (err), "+r" (__pu_addr) \ 385 385 : "r" (x), "i" (-EFAULT) \ 386 386 : "cc")
+5 -5
arch/arm/kernel/entry-armv.S
··· 523 523 /* 524 524 * The out of line fixup for the ldrt above. 525 525 */ 526 - .section .fixup, "ax" 526 + .pushsection .fixup, "ax" 527 527 4: mov pc, r9 528 - .previous 529 - .section __ex_table,"a" 528 + .popsection 529 + .pushsection __ex_table,"a" 530 530 .long 1b, 4b 531 531 #if __LINUX_ARM_ARCH__ >= 7 532 532 .long 2b, 4b 533 533 .long 3b, 4b 534 534 #endif 535 - .previous 535 + .popsection 536 536 537 537 /* 538 538 * Check whether the instruction is a co-processor instruction. ··· 679 679 .data 680 680 ENTRY(fp_enter) 681 681 .word no_fp 682 - .previous 682 + .text 683 683 684 684 ENTRY(no_fp) 685 685 mov pc, lr
+4 -4
arch/arm/kernel/ftrace.c
··· 62 62 " movne %0, #2 \n" 63 63 "3:\n" 64 64 65 - ".section .fixup, \"ax\"\n" 65 + ".pushsection .fixup, \"ax\"\n" 66 66 "4: mov %0, #1 \n" 67 67 " b 3b \n" 68 - ".previous\n" 68 + ".popsection\n" 69 69 70 - ".section __ex_table, \"a\"\n" 70 + ".pushsection __ex_table, \"a\"\n" 71 71 " .long 1b, 4b \n" 72 72 " .long 2b, 4b \n" 73 - ".previous\n" 73 + ".popsection\n" 74 74 75 75 : "=r"(err), "=r"(replaced) 76 76 : "r"(pc), "r"(new), "r"(old), "0"(err), "1"(replaced)
+4 -4
arch/arm/kernel/process.c
··· 355 355 * the thread function, and r3 points to the exit function. 356 356 */ 357 357 extern void kernel_thread_helper(void); 358 - asm( ".section .text\n" 358 + asm( ".pushsection .text\n" 359 359 " .align\n" 360 360 " .type kernel_thread_helper, #function\n" 361 361 "kernel_thread_helper:\n" ··· 363 363 " mov lr, r3\n" 364 364 " mov pc, r2\n" 365 365 " .size kernel_thread_helper, . - kernel_thread_helper\n" 366 - " .previous"); 366 + " .popsection"); 367 367 368 368 #ifdef CONFIG_ARM_UNWIND 369 369 extern void kernel_thread_exit(long code); 370 - asm( ".section .text\n" 370 + asm( ".pushsection .text\n" 371 371 " .align\n" 372 372 " .type kernel_thread_exit, #function\n" 373 373 "kernel_thread_exit:\n" ··· 377 377 " nop\n" 378 378 " .fnend\n" 379 379 " .size kernel_thread_exit, . - kernel_thread_exit\n" 380 - " .previous"); 380 + " .popsection"); 381 381 #else 382 382 #define kernel_thread_exit do_exit 383 383 #endif
+2 -2
arch/arm/lib/backtrace.S
··· 110 110 ENDPROC(__backtrace) 111 111 ENDPROC(c_backtrace) 112 112 113 - .section __ex_table,"a" 113 + .pushsection __ex_table,"a" 114 114 .align 3 115 115 .long 1001b, 1006b 116 116 .long 1002b, 1006b 117 117 .long 1003b, 1006b 118 118 .long 1004b, 1006b 119 - .previous 119 + .popsection 120 120 121 121 #define instr r4 122 122 #define reg r5
+2 -2
arch/arm/lib/clear_user.S
··· 46 46 ldmfd sp!, {r1, pc} 47 47 ENDPROC(__clear_user) 48 48 49 - .section .fixup,"ax" 49 + .pushsection .fixup,"ax" 50 50 .align 0 51 51 9001: ldmfd sp!, {r0, pc} 52 - .previous 52 + .popsection 53 53
+2 -2
arch/arm/lib/copy_from_user.S
··· 90 90 91 91 ENDPROC(__copy_from_user) 92 92 93 - .section .fixup,"ax" 93 + .pushsection .fixup,"ax" 94 94 .align 0 95 95 copy_abort_preamble 96 96 ldmfd sp!, {r1, r2} ··· 100 100 bl __memzero 101 101 ldr r0, [sp], #4 102 102 copy_abort_end 103 - .previous 103 + .popsection 104 104
+2 -2
arch/arm/lib/copy_to_user.S
··· 94 94 95 95 ENDPROC(__copy_to_user) 96 96 97 - .section .fixup,"ax" 97 + .pushsection .fixup,"ax" 98 98 .align 0 99 99 copy_abort_preamble 100 100 ldmfd sp!, {r1, r2, r3} 101 101 sub r0, r0, r1 102 102 rsb r0, r0, r2 103 103 copy_abort_end 104 - .previous 104 + .popsection 105 105
+2 -2
arch/arm/lib/csumpartialcopyuser.S
··· 68 68 * so properly, we would have to add in whatever registers were loaded before 69 69 * the fault, which, with the current asm above is not predictable. 70 70 */ 71 - .section .fixup,"ax" 71 + .pushsection .fixup,"ax" 72 72 .align 4 73 73 9001: mov r4, #-EFAULT 74 74 ldr r5, [fp, #4] @ *err_ptr ··· 80 80 strneb r0, [r1], #1 81 81 bne 9002b 82 82 load_regs 83 - .previous 83 + .popsection
+2 -2
arch/arm/lib/getuser.S
··· 64 64 mov pc, lr 65 65 ENDPROC(__get_user_bad) 66 66 67 - .section __ex_table, "a" 67 + .pushsection __ex_table, "a" 68 68 .long 1b, __get_user_bad 69 69 .long 2b, __get_user_bad 70 70 .long 3b, __get_user_bad 71 71 .long 4b, __get_user_bad 72 - .previous 72 + .popsection
+2 -2
arch/arm/lib/putuser.S
··· 81 81 mov pc, lr 82 82 ENDPROC(__put_user_bad) 83 83 84 - .section __ex_table, "a" 84 + .pushsection __ex_table, "a" 85 85 .long 1b, __put_user_bad 86 86 .long 2b, __put_user_bad 87 87 .long 3b, __put_user_bad 88 88 .long 4b, __put_user_bad 89 89 .long 5b, __put_user_bad 90 90 .long 6b, __put_user_bad 91 - .previous 91 + .popsection
+2 -2
arch/arm/lib/strncpy_from_user.S
··· 33 33 mov pc, lr 34 34 ENDPROC(__strncpy_from_user) 35 35 36 - .section .fixup,"ax" 36 + .pushsection .fixup,"ax" 37 37 .align 0 38 38 9001: mov r3, #0 39 39 strb r3, [r0, #0] @ null terminate 40 40 mov r0, #-EFAULT 41 41 mov pc, lr 42 - .previous 42 + .popsection 43 43
+2 -2
arch/arm/lib/strnlen_user.S
··· 33 33 mov pc, lr 34 34 ENDPROC(__strnlen_user) 35 35 36 - .section .fixup,"ax" 36 + .pushsection .fixup,"ax" 37 37 .align 0 38 38 9001: mov r0, #0 39 39 mov pc, lr 40 - .previous 40 + .popsection
+4 -4
arch/arm/lib/uaccess.S
··· 279 279 b .Lc2u_finished 280 280 ENDPROC(__copy_to_user) 281 281 282 - .section .fixup,"ax" 282 + .pushsection .fixup,"ax" 283 283 .align 0 284 284 9001: ldmfd sp!, {r0, r4 - r7, pc} 285 - .previous 285 + .popsection 286 286 287 287 /* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n); 288 288 * Purpose : copy a block from user memory to kernel memory ··· 545 545 b .Lcfu_finished 546 546 ENDPROC(__copy_from_user) 547 547 548 - .section .fixup,"ax" 548 + .pushsection .fixup,"ax" 549 549 .align 0 550 550 /* 551 551 * We took an exception. r0 contains a pointer to ··· 559 559 blne __memzero 560 560 mov r0, r4 561 561 ldmfd sp!, {r4 - r7, pc} 562 - .previous 562 + .popsection 563 563
+12 -12
arch/arm/mm/alignment.c
··· 166 166 THUMB( "1: "ins" %1, [%2]\n" ) \ 167 167 THUMB( " add %2, %2, #1\n" ) \ 168 168 "2:\n" \ 169 - " .section .fixup,\"ax\"\n" \ 169 + " .pushsection .fixup,\"ax\"\n" \ 170 170 " .align 2\n" \ 171 171 "3: mov %0, #1\n" \ 172 172 " b 2b\n" \ 173 - " .previous\n" \ 174 - " .section __ex_table,\"a\"\n" \ 173 + " .popsection\n" \ 174 + " .pushsection __ex_table,\"a\"\n" \ 175 175 " .align 3\n" \ 176 176 " .long 1b, 3b\n" \ 177 - " .previous\n" \ 177 + " .popsection\n" \ 178 178 : "=r" (err), "=&r" (val), "=r" (addr) \ 179 179 : "0" (err), "2" (addr)) 180 180 ··· 226 226 " mov %1, %1, "NEXT_BYTE"\n" \ 227 227 "2: "ins" %1, [%2]\n" \ 228 228 "3:\n" \ 229 - " .section .fixup,\"ax\"\n" \ 229 + " .pushsection .fixup,\"ax\"\n" \ 230 230 " .align 2\n" \ 231 231 "4: mov %0, #1\n" \ 232 232 " b 3b\n" \ 233 - " .previous\n" \ 234 - " .section __ex_table,\"a\"\n" \ 233 + " .popsection\n" \ 234 + " .pushsection __ex_table,\"a\"\n" \ 235 235 " .align 3\n" \ 236 236 " .long 1b, 4b\n" \ 237 237 " .long 2b, 4b\n" \ 238 - " .previous\n" \ 238 + " .popsection\n" \ 239 239 : "=r" (err), "=&r" (v), "=&r" (a) \ 240 240 : "0" (err), "1" (v), "2" (a)); \ 241 241 if (err) \ ··· 266 266 " mov %1, %1, "NEXT_BYTE"\n" \ 267 267 "4: "ins" %1, [%2]\n" \ 268 268 "5:\n" \ 269 - " .section .fixup,\"ax\"\n" \ 269 + " .pushsection .fixup,\"ax\"\n" \ 270 270 " .align 2\n" \ 271 271 "6: mov %0, #1\n" \ 272 272 " b 5b\n" \ 273 - " .previous\n" \ 274 - " .section __ex_table,\"a\"\n" \ 273 + " .popsection\n" \ 274 + " .pushsection __ex_table,\"a\"\n" \ 275 275 " .align 3\n" \ 276 276 " .long 1b, 6b\n" \ 277 277 " .long 2b, 6b\n" \ 278 278 " .long 3b, 6b\n" \ 279 279 " .long 4b, 6b\n" \ 280 - " .previous\n" \ 280 + " .popsection\n" \ 281 281 : "=r" (err), "=&r" (v), "=&r" (a) \ 282 282 : "0" (err), "1" (v), "2" (a)); \ 283 283 if (err) \
+1 -1
arch/arm/mm/proc-sa1100.S
··· 45 45 mcr p15, 0, r0, c9, c0, 5 @ Allow read-buffer operations from userland 46 46 mov pc, lr 47 47 48 - .previous 48 + .section .text 49 49 50 50 /* 51 51 * cpu_sa1100_proc_fin()
+4 -4
arch/arm/nwfpe/entry.S
··· 111 111 @ to fault. Emit the appropriate exception gunk to fix things up. 112 112 @ ??? For some reason, faults can happen at .Lx2 even with a 113 113 @ plain LDR instruction. Weird, but it seems harmless. 114 - .section .fixup,"ax" 114 + .pushsection .fixup,"ax" 115 115 .align 2 116 116 .Lfix: mov pc, r9 @ let the user eat segfaults 117 - .previous 117 + .popsection 118 118 119 - .section __ex_table,"a" 119 + .pushsection __ex_table,"a" 120 120 .align 3 121 121 .long .Lx1, .Lfix 122 - .previous 122 + .popsection