Re: [PATCH 1/2] lib: Fix multiple definitions of clz_tab

From: Kasatkin, Dmitry
Date: Thu Jan 26 2012 - 18:02:09 EST


On Fri, Jan 27, 2012 at 12:32 AM, David Miller <davem@xxxxxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
> ---
> Âarch/sparc/Kconfig   Â|  Â1 +
> Âarch/sparc/lib/divdi3.S | Â 16 +---------------
> Âlib/Kconfig       |  Â4 ++++
> Âlib/Makefile      Â|  Â2 ++
> Âlib/clz_tab.c      |  18 ++++++++++++++++++
> Âlib/mpi/mpi-bit.c    |  19 -------------------
> Â6 files changed, 26 insertions(+), 34 deletions(-)
> Âcreate mode 100644 lib/clz_tab.c
>
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 9665799..ca5580e 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -33,6 +33,7 @@ config SPARC
> Âconfig SPARC32
> Â Â Â Âdef_bool !64BIT
> Â Â Â Âselect GENERIC_ATOMIC64
> + Â Â Â select CLZ_TAB
>
> Âconfig SPARC64
> Â Â Â Âdef_bool 64BIT
> diff --git a/arch/sparc/lib/divdi3.S b/arch/sparc/lib/divdi3.S
> index 681b368..d74bc09 100644
> --- a/arch/sparc/lib/divdi3.S
> +++ b/arch/sparc/lib/divdi3.S
> @@ -17,23 +17,9 @@ along with GNU CC; see the file COPYING. ÂIf not, write to
> Âthe Free Software Foundation, 59 Temple Place - Suite 330,
> ÂBoston, MA 02111-1307, USA. Â*/
>
> - Â Â Â .data
> - Â Â Â .align 8
> - Â Â Â .globl Â__clz_tab
> -__clz_tab:
> -    .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
> -    .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
> -    .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
> -    .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
> -    .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
> -    .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
> -    .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
> -    .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
> -    .size  Â__clz_tab,256
> - Â Â Â .global .udiv
> -
> Â Â Â Â.text
> Â Â Â Â.align 4
> + Â Â Â .global .udiv
> Â Â Â Â.globl __divdi3
> Â__divdi3:
> Â Â Â Âsave %sp,-104,%sp
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 169eb7c..d69d321 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -279,6 +279,9 @@ config AVERAGE
>
> Â Â Â Â ÂIf unsure, say N.
>
> +config CLZ_TAB
> + Â Â Â bool
> +
> Âconfig CORDIC
> Â Â Â Âtristate "CORDIC algorithm"
> Â Â Â Âhelp
> @@ -287,6 +290,7 @@ config CORDIC
>
> Âconfig MPILIB
> Â Â Â Âtristate
> + Â Â Â select CLZ_TAB
> Â Â Â Âhelp
> Â Â Â Â ÂMultiprecision maths library from GnuPG.
> Â Â Â Â ÂIt is used to implement RSA digital signature verification,
> diff --git a/lib/Makefile b/lib/Makefile
> index d71aae1..18515f0 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -121,6 +121,8 @@ obj-$(CONFIG_DQL) += dynamic_queue_limits.o
> Âobj-$(CONFIG_MPILIB) += mpi/
> Âobj-$(CONFIG_SIGNATURE) += digsig.o
>
> +obj-$(CONFIG_CLZ_TAB) += clz_tab.o
> +
> Âhostprogs-y  Â:= gen_crc32table
> Âclean-files  Â:= crc32table.h
>
> diff --git a/lib/clz_tab.c b/lib/clz_tab.c
> new file mode 100644
> index 0000000..7287b4a
> --- /dev/null
> +++ b/lib/clz_tab.c
> @@ -0,0 +1,18 @@
> +const unsigned char __clz_tab[] = {
> + Â Â Â 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,
> + Â Â Â 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,
> + Â Â Â 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, 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, 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, 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, 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, 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,
> +};
> diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c
> index 854c9c6..2f52662 100644
> --- a/lib/mpi/mpi-bit.c
> +++ b/lib/mpi/mpi-bit.c
> @@ -21,25 +21,6 @@
> Â#include "mpi-internal.h"
> Â#include "longlong.h"
>
> -const unsigned char __clz_tab[] = {
> - Â Â Â 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,
> - Â Â Â 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,
> - Â Â Â 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, 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, 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, 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, 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, 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,
> -};
> -
> Â#define A_LIMB_1 ((mpi_limb_t) 1)
>
> Â/****************
> --
> 1.7.6.401.g6a319
>

Nice...
How should I deal with your patches?
I send patches via LSM list. James Morris applies them.
Should I re-send them along with my patches?

- Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/