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

sparc64: Kill .fixup section bloat.

This is an implementation of a suggestion made by Chris Torek:
--------------------
Something else I noticed in passing: the EX and EX_LD/EX_ST macros
scattered throughout the various .S files make a fair bit of .fixup
code, all of which does the same thing. At the cost of one symbol
in copy_in_user.S, you could just have one common two-instruction
retl-and-mov-1 fixup that they all share.
--------------------

The following is with a defconfig build:

text data bss dec hex filename
3972767 344024 584449 4901240 4ac978 vmlinux.orig
3968887 344024 584449 4897360 4aba50 vmlinux

Signed-off-by: David S. Miller <davem@davemloft.net>

+42 -77
+28 -3
arch/sparc/kernel/head_64.S
··· 891 891 tlb_type: .word 0 /* Must NOT end up in BSS */ 892 892 .section ".fixup",#alloc,#execinstr 893 893 894 - .globl __ret_efault, __retl_efault 895 - __ret_efault: 894 + .globl __ret_efault, __retl_efault, __ret_one, __retl_one 895 + ENTRY(__ret_efault) 896 896 ret 897 897 restore %g0, -EFAULT, %o0 898 - __retl_efault: 898 + ENDPROC(__ret_efault) 899 + 900 + ENTRY(__retl_efault) 899 901 retl 900 902 mov -EFAULT, %o0 903 + ENDPROC(__retl_efault) 904 + 905 + ENTRY(__retl_one) 906 + retl 907 + mov 1, %o0 908 + ENDPROC(__retl_one) 909 + 910 + ENTRY(__ret_one_asi) 911 + wr %g0, ASI_AIUS, %asi 912 + ret 913 + restore %g0, 1, %o0 914 + ENDPROC(__ret_one_asi) 915 + 916 + ENTRY(__retl_one_asi) 917 + wr %g0, ASI_AIUS, %asi 918 + retl 919 + mov 1, %o0 920 + ENDPROC(__retl_one_asi) 921 + 922 + ENTRY(__retl_o1) 923 + retl 924 + mov %o1, %o0 925 + ENDPROC(__retl_o1)
+1 -5
arch/sparc/lib/GENbzero.S
··· 6 6 7 7 #define EX_ST(x,y) \ 8 8 98: x,y; \ 9 - .section .fixup; \ 10 - .align 4; \ 11 - 99: retl; \ 12 - mov %o1, %o0; \ 13 9 .section __ex_table,"a";\ 14 10 .align 4; \ 15 - .word 98b, 99b; \ 11 + .word 98b, __retl_o1; \ 16 12 .text; \ 17 13 .align 4; 18 14
+1 -5
arch/sparc/lib/GENcopy_from_user.S
··· 5 5 6 6 #define EX_LD(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: retl; \ 11 - mov 1, %o0; \ 12 8 .section __ex_table,"a";\ 13 9 .align 4; \ 14 - .word 98b, 99b; \ 10 + .word 98b, __retl_one; \ 15 11 .text; \ 16 12 .align 4; 17 13
+1 -5
arch/sparc/lib/GENcopy_to_user.S
··· 5 5 6 6 #define EX_ST(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: retl; \ 11 - mov 1, %o0; \ 12 8 .section __ex_table,"a";\ 13 9 .align 4; \ 14 - .word 98b, 99b; \ 10 + .word 98b, __retl_one; \ 15 11 .text; \ 16 12 .align 4; 17 13
+1 -6
arch/sparc/lib/NG2copy_from_user.S
··· 5 5 6 6 #define EX_LD(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: wr %g0, ASI_AIUS, %asi;\ 11 - retl; \ 12 - mov 1, %o0; \ 13 8 .section __ex_table,"a";\ 14 9 .align 4; \ 15 - .word 98b, 99b; \ 10 + .word 98b, __retl_one_asi;\ 16 11 .text; \ 17 12 .align 4; 18 13
+1 -6
arch/sparc/lib/NG2copy_to_user.S
··· 5 5 6 6 #define EX_ST(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: wr %g0, ASI_AIUS, %asi;\ 11 - retl; \ 12 - mov 1, %o0; \ 13 8 .section __ex_table,"a";\ 14 9 .align 4; \ 15 - .word 98b, 99b; \ 10 + .word 98b, __retl_one_asi;\ 16 11 .text; \ 17 12 .align 4; 18 13
+1 -5
arch/sparc/lib/NGbzero.S
··· 6 6 7 7 #define EX_ST(x,y) \ 8 8 98: x,y; \ 9 - .section .fixup; \ 10 - .align 4; \ 11 - 99: retl; \ 12 - mov %o1, %o0; \ 13 9 .section __ex_table,"a";\ 14 10 .align 4; \ 15 - .word 98b, 99b; \ 11 + .word 98b, __retl_o1; \ 16 12 .text; \ 17 13 .align 4; 18 14
+1 -6
arch/sparc/lib/NGcopy_from_user.S
··· 5 5 6 6 #define EX_LD(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: wr %g0, ASI_AIUS, %asi;\ 11 - ret; \ 12 - restore %g0, 1, %o0; \ 13 8 .section __ex_table,"a";\ 14 9 .align 4; \ 15 - .word 98b, 99b; \ 10 + .word 98b, __ret_one_asi;\ 16 11 .text; \ 17 12 .align 4; 18 13
+1 -6
arch/sparc/lib/NGcopy_to_user.S
··· 5 5 6 6 #define EX_ST(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: wr %g0, ASI_AIUS, %asi;\ 11 - ret; \ 12 - restore %g0, 1, %o0; \ 13 8 .section __ex_table,"a";\ 14 9 .align 4; \ 15 - .word 98b, 99b; \ 10 + .word 98b, __ret_one_asi;\ 16 11 .text; \ 17 12 .align 4; 18 13
+1 -5
arch/sparc/lib/U1copy_from_user.S
··· 5 5 6 6 #define EX_LD(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: retl; \ 11 - mov 1, %o0; \ 12 8 .section __ex_table,"a";\ 13 9 .align 4; \ 14 - .word 98b, 99b; \ 10 + .word 98b, __retl_one; \ 15 11 .text; \ 16 12 .align 4; 17 13
+1 -5
arch/sparc/lib/U1copy_to_user.S
··· 5 5 6 6 #define EX_ST(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: retl; \ 11 - mov 1, %o0; \ 12 8 .section __ex_table,"a";\ 13 9 .align 4; \ 14 - .word 98b, 99b; \ 10 + .word 98b, __retl_one; \ 15 11 .text; \ 16 12 .align 4; 17 13
+1 -5
arch/sparc/lib/U3copy_from_user.S
··· 5 5 6 6 #define EX_LD(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: retl; \ 11 - mov 1, %o0; \ 12 8 .section __ex_table,"a";\ 13 9 .align 4; \ 14 - .word 98b, 99b; \ 10 + .word 98b, __retl_one; \ 15 11 .text; \ 16 12 .align 4; 17 13
+1 -5
arch/sparc/lib/U3copy_to_user.S
··· 5 5 6 6 #define EX_ST(x) \ 7 7 98: x; \ 8 - .section .fixup; \ 9 - .align 4; \ 10 - 99: retl; \ 11 - mov 1, %o0; \ 12 8 .section __ex_table,"a";\ 13 9 .align 4; \ 14 - .word 98b, 99b; \ 10 + .word 98b, __retl_one; \ 15 11 .text; \ 16 12 .align 4; 17 13
+1 -5
arch/sparc/lib/bzero.S
··· 88 88 89 89 #define EX_ST(x,y) \ 90 90 98: x,y; \ 91 - .section .fixup; \ 92 - .align 4; \ 93 - 99: retl; \ 94 - mov %o1, %o0; \ 95 91 .section __ex_table,"a";\ 96 92 .align 4; \ 97 - .word 98b, 99b; \ 93 + .word 98b, __retl_o1; \ 98 94 .text; \ 99 95 .align 4; 100 96
+1 -5
arch/sparc/lib/copy_in_user.S
··· 9 9 10 10 #define EX(x,y) \ 11 11 98: x,y; \ 12 - .section .fixup; \ 13 - .align 4; \ 14 - 99: retl; \ 15 - mov 1, %o0; \ 16 12 .section __ex_table,"a";\ 17 13 .align 4; \ 18 - .word 98b, 99b; \ 14 + .word 98b, __retl_one; \ 19 15 .text; \ 20 16 .align 4; 21 17