diff options
| author | David Miller <davem@davemloft.net> | 2012-02-01 17:17:54 -0500 |
|---|---|---|
| committer | James Morris <jmorris@namei.org> | 2012-02-01 18:34:23 -0500 |
| commit | c6df4b17c8539f737a6a2d7b797eac41e8e34cdc (patch) | |
| tree | 7b891178267aa9486fed1197419aac57d3036b5f /lib | |
| parent | 86f8bedc9e1a8ddb4f1d9ff1f0c1229cc0797d6d (diff) | |
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>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig | 4 | ||||
| -rw-r--r-- | lib/Makefile | 2 | ||||
| -rw-r--r-- | lib/clz_tab.c | 18 | ||||
| -rw-r--r-- | lib/mpi/mpi-bit.c | 19 |
4 files changed, 24 insertions, 19 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 169eb7c598e5..d69d321a0997 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
| @@ -279,6 +279,9 @@ config AVERAGE | |||
| 279 | 279 | ||
| 280 | If unsure, say N. | 280 | If unsure, say N. |
| 281 | 281 | ||
| 282 | config CLZ_TAB | ||
| 283 | bool | ||
| 284 | |||
| 282 | config CORDIC | 285 | config CORDIC |
| 283 | tristate "CORDIC algorithm" | 286 | tristate "CORDIC algorithm" |
| 284 | help | 287 | help |
| @@ -287,6 +290,7 @@ config CORDIC | |||
| 287 | 290 | ||
| 288 | config MPILIB | 291 | config MPILIB |
| 289 | tristate | 292 | tristate |
| 293 | select CLZ_TAB | ||
| 290 | help | 294 | help |
| 291 | Multiprecision maths library from GnuPG. | 295 | Multiprecision maths library from GnuPG. |
| 292 | It is used to implement RSA digital signature verification, | 296 | It is used to implement RSA digital signature verification, |
diff --git a/lib/Makefile b/lib/Makefile index d71aae1b01b3..18515f0267c4 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -121,6 +121,8 @@ obj-$(CONFIG_DQL) += dynamic_queue_limits.o | |||
| 121 | obj-$(CONFIG_MPILIB) += mpi/ | 121 | obj-$(CONFIG_MPILIB) += mpi/ |
| 122 | obj-$(CONFIG_SIGNATURE) += digsig.o | 122 | obj-$(CONFIG_SIGNATURE) += digsig.o |
| 123 | 123 | ||
| 124 | obj-$(CONFIG_CLZ_TAB) += clz_tab.o | ||
| 125 | |||
| 124 | hostprogs-y := gen_crc32table | 126 | hostprogs-y := gen_crc32table |
| 125 | clean-files := crc32table.h | 127 | clean-files := crc32table.h |
| 126 | 128 | ||
diff --git a/lib/clz_tab.c b/lib/clz_tab.c new file mode 100644 index 000000000000..7287b4a991a7 --- /dev/null +++ b/lib/clz_tab.c | |||
| @@ -0,0 +1,18 @@ | |||
| 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 13 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 14 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 15 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 16 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 17 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 18 | }; | ||
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c index 854c9c6da025..2f526627e4f5 100644 --- a/lib/mpi/mpi-bit.c +++ b/lib/mpi/mpi-bit.c | |||
| @@ -21,25 +21,6 @@ | |||
| 21 | #include "mpi-internal.h" | 21 | #include "mpi-internal.h" |
| 22 | #include "longlong.h" | 22 | #include "longlong.h" |
| 23 | 23 | ||
| 24 | const unsigned char __clz_tab[] = { | ||
| 25 | 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 26 | 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 27 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
| 28 | 6, 6, 6, 6, 6, 6, 6, 6, | ||
| 29 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
| 30 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
| 31 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
| 32 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
| 33 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 34 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 35 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 36 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 37 | 8, 8, 8, 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 | #define A_LIMB_1 ((mpi_limb_t) 1) | 24 | #define A_LIMB_1 ((mpi_limb_t) 1) |
| 44 | 25 | ||
| 45 | /**************** | 26 | /**************** |
