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

lib: Fix multiple definitions of clz_tab

Both sparc 32-bit's software divide assembler and MPILIB provide
clz_tab[] with identical contents.

Break it out into a seperate object file and select it when
SPARC32 or MPILIB is set.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: James Morris <jmorris@namei.org>

authored by

David Miller and committed by
James Morris
c6df4b17 86f8bedc

+26 -34
+1
arch/sparc/Kconfig
··· 33 33 config SPARC32 34 34 def_bool !64BIT 35 35 select GENERIC_ATOMIC64 36 + select CLZ_TAB 36 37 37 38 config SPARC64 38 39 def_bool 64BIT
+1 -15
arch/sparc/lib/divdi3.S
··· 17 17 the Free Software Foundation, 59 Temple Place - Suite 330, 18 18 Boston, MA 02111-1307, USA. */ 19 19 20 - .data 21 - .align 8 22 - .globl __clz_tab 23 - __clz_tab: 24 - .byte 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 25 - .byte 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6 26 - .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 27 - .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 28 - .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 29 - .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 30 - .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 31 - .byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 32 - .size __clz_tab,256 33 - .global .udiv 34 - 35 20 .text 36 21 .align 4 22 + .global .udiv 37 23 .globl __divdi3 38 24 __divdi3: 39 25 save %sp,-104,%sp
+4
lib/Kconfig
··· 279 279 280 280 If unsure, say N. 281 281 282 + config CLZ_TAB 283 + bool 284 + 282 285 config CORDIC 283 286 tristate "CORDIC algorithm" 284 287 help ··· 290 287 291 288 config MPILIB 292 289 tristate 290 + select CLZ_TAB 293 291 help 294 292 Multiprecision maths library from GnuPG. 295 293 It is used to implement RSA digital signature verification,
+2
lib/Makefile
··· 121 121 obj-$(CONFIG_MPILIB) += mpi/ 122 122 obj-$(CONFIG_SIGNATURE) += digsig.o 123 123 124 + obj-$(CONFIG_CLZ_TAB) += clz_tab.o 125 + 124 126 hostprogs-y := gen_crc32table 125 127 clean-files := crc32table.h 126 128
+18
lib/clz_tab.c
··· 1 + const unsigned char __clz_tab[] = { 2 + 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 3 + 5, 5, 5, 5, 5, 5, 5, 5, 4 + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5 + 6, 6, 6, 6, 6, 6, 6, 6, 6 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 + 7, 7, 7, 7, 7, 7, 7, 7, 8 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9 + 7, 7, 7, 7, 7, 7, 7, 7, 10 + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 11 + 8, 8, 8, 8, 8, 8, 8, 8, 12 + 8,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 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 38 - 8, 8, 8, 8, 8, 8, 8, 8, 39 - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 40 - 8, 8, 8, 8, 8, 8, 8, 8, 41 - }; 42 - 43 24 #define A_LIMB_1 ((mpi_limb_t) 1) 44 25 45 26 /****************