]> git.pld-linux.org Git - packages/sheepdog.git/blob - 32bits-targets.patch
c498848fe4f1ffb811b5b25717d985efa5364faa
[packages/sheepdog.git] / 32bits-targets.patch
1 From 1b0dafa7a6920dd2e9ce97a1c8c084e4c8fc5f68 Mon Sep 17 00:00:00 2001
2 From: Alexander Evseev <aevseev@mirantis.com>
3 Date: Wed, 29 Jul 2015 16:13:32 +0300
4 Subject: [PATCH] Fix build for 32 bit targets
5
6   * Define CPU flags for non-x86_64 targets
7   * Use non-SSE version of ec_encode_data for non-x86_64 targets
8   * Add make variable "arch" as it should be used in isa-l
9
10 Signed-off-by: Alexander Evseev <aevseev@mirantis.com>
11 ---
12  configure.ac       |  1 +
13  include/compiler.h |  6 ++++++
14  lib/Makefile.am    | 14 ++++++++++++--
15  lib/fec.c          |  5 ++++-
16  4 files changed, 23 insertions(+), 3 deletions(-)
17
18 diff --git a/configure.ac b/configure.ac
19 index e637f42..66b733b 100644
20 --- a/configure.ac
21 +++ b/configure.ac
22 @@ -199,6 +199,7 @@ LINT_FLAGS="-weak -unrecog +posixlib +ignoresigns -fcnuse \
23         -badflag -D__gnuc_va_list=va_list -D__attribute\(x\)="
24  
25  AM_CONDITIONAL(BUILD_SHA1_HW, [[[[ $host = *x86_64* ]]]])
26 +AM_CONDITIONAL(X86_64,        [[[[ $host = *x86_64* ]]]])
27  
28  AC_ARG_ENABLE([fatal-warnings],
29         [  --enable-fatal-warnings : enable fatal warnings. ],
30 diff --git a/include/compiler.h b/include/compiler.h
31 index 3c68b75..64ab6b4 100644
32 --- a/include/compiler.h
33 +++ b/include/compiler.h
34 @@ -155,6 +155,12 @@ static inline uint64_t xgetbv(uint32_t idx)
35  #define cpu_has_avx            cpu_has(X86_FEATURE_AVX)
36  #define cpu_has_osxsave                cpu_has(X86_FEATURE_OSXSAVE)
37  
38 +#else  /* __x86_64__ */
39 +
40 +#define cpu_has_ssse3   0
41 +#define cpu_has_avx     0
42 +#define cpu_has_osxsave 0
43 +
44  #endif /* __x86_64__ */
45  
46  #endif /* SD_COMPILER_H */
47 diff --git a/lib/Makefile.am b/lib/Makefile.am
48 index dec81c7..dfb2fb0 100644
49 --- a/lib/Makefile.am
50 +++ b/lib/Makefile.am
51 @@ -38,7 +38,7 @@ libsd_a_SOURCES               = event.c logger.c net.c util.c rbtree.c strbuf.c \
52                           sha1.c option.c work.c sockfd_cache.c fec.c \
53                           sd_inode.c common.c
54  
55 -libsheepdog_a_LIBADD   = isa-l/bin/ec_base.o \
56 +libsheepdog_a_LIBADD_  = isa-l/bin/ec_base.o \
57                           isa-l/bin/ec_highlevel_func.o \
58                           isa-l/bin/ec_multibinary.o \
59                           isa-l/bin/gf_2vect_dot_prod_sse.o \
60 @@ -50,6 +50,16 @@ libsd_a_LIBADD               = isa-l/bin/ec_base.o \
61                           isa-l/bin/gf_vect_mul_avx.o \
62                           isa-l/bin/gf_vect_mul_sse.o
63  
64 +libsheepdog_a_LIBADD_32        = isa-l/bin/ec_base.o \
65 +                         isa-l/bin/ec_highlevel_func.o \
66 +                         isa-l/bin/ec_multibinary.o
67 +
68 +if !X86_64
69 +arch = 32
70 +endif
71 +
72 +libsheepdog_a_LIBADD           = $(libsheepdog_a_LIBADD_$(arch))
73 +
74  if BUILD_SHA1_HW
75  libsd_a_SOURCES                += sha1_ssse3.S
76  endif
77 @@ -74,7 +84,7 @@ check-style:
78         @$(CHECK_STYLE) $(libsd_a_SOURCES)
79  
80  libisa.a:
81 -       cd isa-l/ && $(MAKE) && cd ..
82 +       cd isa-l/ && $(MAKE) arch=$(arch) && cd ..
83  
84  clean-local:
85         rm -f *.o gmon.out *.da *.bb *.bbg
86 diff --git a/lib/fec.c b/lib/fec.c
87 index e0908bc..e2d5cd1 100644
88 --- a/lib/fec.c
89 +++ b/lib/fec.c
90 @@ -739,5 +739,8 @@ void isa_decode_buffer(struct fec *ctx, uint8_t *input[], const int in_idx[],
91  
92         lost[0] = (unsigned char *)buf;
93         ec_init_tables(ed, 1, cm, ec_tbl);
94 -       ec_encode_data_sse(len, ed, 1, ec_tbl, input, lost);
95 +       if (cpu_has_ssse3)
96 +               ec_encode_data_sse(len, ed, 1, ec_tbl, input, lost);
97 +       else
98 +               ec_encode_data(len, ed, 1, ec_tbl, input, lost);
99  }
This page took 0.102166 seconds and 2 git commands to generate.