From 18acc0275debc2edd26a0a9b2e0f42425b50ce1b Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mar 28 2016 13:30:19 +0000 Subject: 7.4.2-8 - pull in upstream (7.4 branch) fixes - Add support for 64-bit MIPS (#1317509) - use %license --- diff --git a/0002-Fix-makefile-preventing-AO_pause-undefined-in-libato.patch b/0002-Fix-makefile-preventing-AO_pause-undefined-in-libato.patch new file mode 100644 index 0000000..7665c83 --- /dev/null +++ b/0002-Fix-makefile-preventing-AO_pause-undefined-in-libato.patch @@ -0,0 +1,26 @@ +From c634636a66f3afd885b30d0287c78a8b223a4c19 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Tue, 13 May 2014 13:46:23 +0200 +Subject: [PATCH 02/20] Fix makefile preventing AO_pause undefined in + libatomic_ops_gpl + +* src/Makefile.am (libatomic_ops_gpl_la_LIBADD): New dependency. +--- + src/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 7d586e9..d2cf718 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -12,6 +12,7 @@ libatomic_ops_la_LDFLAGS = -version-info 1:3:0 -no-undefined + + libatomic_ops_gpl_la_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c + libatomic_ops_gpl_la_LDFLAGS = -version-info 1:3:0 -no-undefined ++libatomic_ops_gpl_la_LIBADD = libatomic_ops.la + + EXTRA_DIST = Makefile.msft atomic_ops/sysdeps/README \ + atomic_ops/generalize-arithm.template \ +-- +1.9.3 + diff --git a/0005-Fix-missing-casts-to-match-printf-format-specifier-i.patch b/0005-Fix-missing-casts-to-match-printf-format-specifier-i.patch new file mode 100644 index 0000000..18eadbc --- /dev/null +++ b/0005-Fix-missing-casts-to-match-printf-format-specifier-i.patch @@ -0,0 +1,38 @@ +From 952543ab656f8cf787a39018b8c8b41c475d8902 Mon Sep 17 00:00:00 2001 +From: Ivan Maidanski +Date: Fri, 13 Jun 2014 12:17:08 +0400 +Subject: [PATCH 05/20] Fix missing casts to match printf format specifier in + test_atomic + +* tests/test_atomic.c (test_and_set_thr): Add missing casts to long +for locked_counter (which is unsigned long) to match printf format +specifier. +--- + tests/test_atomic.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_atomic.c b/tests/test_atomic.c +index 86fede1..b063a92 100644 +--- a/tests/test_atomic.c ++++ b/tests/test_atomic.c +@@ -148,7 +148,7 @@ void * test_and_set_thr(void * id) + if (locked_counter != 1) + { + fprintf(stderr, "Test and set failure 1, counter = %ld, id = %d\n", +- locked_counter, (int)(AO_PTRDIFF_T)id); ++ (long)locked_counter, (int)(AO_PTRDIFF_T)id); + abort(); + } + locked_counter *= 2; +@@ -158,7 +158,7 @@ void * test_and_set_thr(void * id) + if (locked_counter != 1) + { + fprintf(stderr, "Test and set failure 2, counter = %ld, id = %d\n", +- locked_counter, (int)(AO_PTRDIFF_T)id); ++ (long)locked_counter, (int)(AO_PTRDIFF_T)id); + abort(); + } + --locked_counter; +-- +1.9.3 + diff --git a/0006-Eliminate-variable-set-but-not-used-Cppcheck-warning.patch b/0006-Eliminate-variable-set-but-not-used-Cppcheck-warning.patch new file mode 100644 index 0000000..ea0be26 --- /dev/null +++ b/0006-Eliminate-variable-set-but-not-used-Cppcheck-warning.patch @@ -0,0 +1,76 @@ +From 658d0711f76ed015aafa2f50604d9ff74e79d28c Mon Sep 17 00:00:00 2001 +From: Ivan Maidanski +Date: Fri, 13 Jun 2014 16:35:55 +0400 +Subject: [PATCH 06/20] Eliminate 'variable set but not used' Cppcheck warnings + in test_stack + +* tests/test_stack.c (run_one_test): Define "j" local variable only +if VERBOSE. +* tests/test_stack.c (main): Do not define "sum" local variable (and +don not compute the sum) if NO_TIMES. +--- + tests/test_stack.c | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/tests/test_stack.c b/tests/test_stack.c +index 8170e5c..a3c5c30 100644 +--- a/tests/test_stack.c ++++ b/tests/test_stack.c +@@ -175,9 +175,9 @@ volatile AO_t ops_performed = 0; + list_element * t[MAX_NTHREADS + 1]; + int index = (int)(size_t)arg; + int i; +- int j = 0; +- + # ifdef VERBOSE ++ int j = 0; ++ + printf("starting thread %d\n", index); + # endif + while (fetch_and_add(&ops_performed, index + 1) + index + 1 < LIMIT) +@@ -195,7 +195,9 @@ volatile AO_t ops_performed = 0; + { + AO_stack_push(&the_list, (AO_t *)t[i]); + } +- j += (index + 1); ++# ifdef VERBOSE ++ j += index + 1; ++# endif + } + # ifdef VERBOSE + printf("finished thread %d: %d total ops\n", index, j); +@@ -303,22 +305,23 @@ int main(int argc, char **argv) + } + for (nthreads = 1; nthreads <= max_nthreads; ++nthreads) + { +- unsigned long sum = 0; ++# ifndef NO_TIMES ++ unsigned long sum = 0; ++# endif + + printf("About %d pushes + %d pops in %d threads:", + LIMIT, LIMIT, nthreads); +- for (exper_n = 0; exper_n < N_EXPERIMENTS; ++exper_n) +- { ++# ifndef NO_TIMES ++ for (exper_n = 0; exper_n < N_EXPERIMENTS; ++exper_n) { + # if defined(VERBOSE) + printf(" [%lu]", times[nthreads][exper_n]); + # endif + sum += times[nthreads][exper_n]; + } +-# ifndef NO_TIMES +- printf(" %lu msecs\n", (sum + N_EXPERIMENTS/2)/N_EXPERIMENTS); +-# else +- printf(" completed\n"); +-# endif ++ printf(" %lu msecs\n", (sum + N_EXPERIMENTS/2)/N_EXPERIMENTS); ++# else ++ printf(" completed\n"); ++# endif + } + return 0; + } +-- +1.9.3 + diff --git a/0007-Fix-missing-output-folder-on-making-auto-generated-h.patch b/0007-Fix-missing-output-folder-on-making-auto-generated-h.patch new file mode 100644 index 0000000..2fee97c --- /dev/null +++ b/0007-Fix-missing-output-folder-on-making-auto-generated-h.patch @@ -0,0 +1,141 @@ +From e45146b18c19ba39b8f8631619dda26f00dba04c Mon Sep 17 00:00:00 2001 +From: Kochin Chang +Date: Fri, 12 Sep 2014 13:35:53 -0400 +Subject: [PATCH 07/20] Fix missing output folder on making auto-generated + headers (Automake) + +Create the directories before sed needs them (otherwise build fails +when sed tries to redirect output to a non-existent directory in case +of build root folder is not identical to source root folder). + +* src/Makefile.am (atomic_ops/generalize-small.h, +atomic_ops/generalize-arithm.h, atomic_ops/sysdeps/ao_t_is_int.h, +atomic_ops/sysdeps/gcc/generic-arithm.h, +atomic_ops/sysdeps/loadstore/*.h): Add mkdir for output folder. +--- + src/Makefile.am | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/src/Makefile.am b/src/Makefile.am +index d2cf718..fc09b27 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -103,6 +103,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \ + atomic_ops/sysdeps/sunc/x86.h + + atomic_ops/generalize-small.h: atomic_ops/generalize-small.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@ + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@ +@@ -110,12 +111,14 @@ atomic_ops/generalize-small.h: atomic_ops/generalize-small.template + sed -e s:XSIZE:double:g -e s:XCTYPE:AO_double_t:g $? >> $@ + + atomic_ops/generalize-arithm.h: atomic_ops/generalize-arithm.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@ + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g $? >> $@ + + atomic_ops/sysdeps/ao_t_is_int.h: atomic_ops/sysdeps/ao_t_is_int.template ++ mkdir -p `dirname $@` + sed -e s:_XBAR::g $? > $@ + sed -e s:XBAR:full:g $? >> $@ + sed -e s:XBAR:acquire:g $? >> $@ +@@ -125,6 +128,7 @@ atomic_ops/sysdeps/ao_t_is_int.h: atomic_ops/sysdeps/ao_t_is_int.template + + atomic_ops/sysdeps/gcc/generic-arithm.h: \ + atomic_ops/sysdeps/gcc/generic-arithm.template ++ mkdir -p `dirname $@` + sed -e s:_XBAR::g -e s:XGCCBAR:RELAXED:g \ + -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + sed -e s:_XBAR::g -e s:XGCCBAR:RELAXED:g \ +@@ -160,6 +164,7 @@ atomic_ops/sysdeps/gcc/generic-arithm.h: \ + + atomic_ops/sysdeps/gcc/generic-small.h: \ + atomic_ops/sysdeps/gcc/generic-small.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@ + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@ +@@ -167,6 +172,7 @@ atomic_ops/sysdeps/gcc/generic-small.h: \ + + atomic_ops/sysdeps/loadstore/ordered_loads_only.h: \ + atomic_ops/sysdeps/loadstore/ordered_loads_only.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@ + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@ +@@ -175,6 +181,7 @@ atomic_ops/sysdeps/loadstore/ordered_loads_only.h: \ + + atomic_ops/sysdeps/loadstore/ordered_stores_only.h: \ + atomic_ops/sysdeps/loadstore/ordered_stores_only.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? >> $@ + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? >> $@ +@@ -183,48 +190,60 @@ atomic_ops/sysdeps/loadstore/ordered_stores_only.h: \ + + atomic_ops/sysdeps/loadstore/acquire_release_volatile.h: \ + atomic_ops/sysdeps/loadstore/acquire_release_volatile.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g $? > $@ + + atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h: \ + atomic_ops/sysdeps/loadstore/acquire_release_volatile.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + + atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h: \ + atomic_ops/sysdeps/loadstore/acquire_release_volatile.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? > $@ + + atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h: \ + atomic_ops/sysdeps/loadstore/acquire_release_volatile.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? > $@ + + atomic_ops/sysdeps/loadstore/atomic_load.h: \ + atomic_ops/sysdeps/loadstore/atomic_load.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g $? > $@ + + atomic_ops/sysdeps/loadstore/char_atomic_load.h: \ + atomic_ops/sysdeps/loadstore/atomic_load.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + + atomic_ops/sysdeps/loadstore/int_atomic_load.h: \ + atomic_ops/sysdeps/loadstore/atomic_load.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? > $@ + + atomic_ops/sysdeps/loadstore/short_atomic_load.h: \ + atomic_ops/sysdeps/loadstore/atomic_load.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? > $@ + + atomic_ops/sysdeps/loadstore/atomic_store.h: \ + atomic_ops/sysdeps/loadstore/atomic_store.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g $? > $@ + + atomic_ops/sysdeps/loadstore/char_atomic_store.h: \ + atomic_ops/sysdeps/loadstore/atomic_store.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:char:g -e s:XCTYPE:unsigned/**/char:g $? > $@ + + atomic_ops/sysdeps/loadstore/int_atomic_store.h: \ + atomic_ops/sysdeps/loadstore/atomic_store.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:int:g -e s:XCTYPE:unsigned:g $? > $@ + + atomic_ops/sysdeps/loadstore/short_atomic_store.h: \ + atomic_ops/sysdeps/loadstore/atomic_store.template ++ mkdir -p `dirname $@` + sed -e s:XSIZE:short:g -e s:XCTYPE:unsigned/**/short:g $? > $@ +-- +1.9.3 + diff --git a/0009-Fix-missing-output-folder-on-making-auto-generated-t.patch b/0009-Fix-missing-output-folder-on-making-auto-generated-t.patch new file mode 100644 index 0000000..2170a74 --- /dev/null +++ b/0009-Fix-missing-output-folder-on-making-auto-generated-t.patch @@ -0,0 +1,43 @@ +From 5cc7d46bd05cfd863c3e8765b908877702e9940a Mon Sep 17 00:00:00 2001 +From: Ivan Maidanski +Date: Sat, 25 Oct 2014 20:58:06 +0400 +Subject: [PATCH 09/20] Fix missing output folder on making auto-generated test + files (Automake) + +* tests/Makefile.am (test_atomic_include.h, list_atomic.c, +list_atomic.i): Add mkdir for output folder. +--- + tests/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 6bfe33c..c8812bb 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -35,6 +35,7 @@ test_malloc_LDADD = $(THREADDLLIBS) \ + $(top_builddir)/src/libatomic_ops.la + + test_atomic_include.h: test_atomic_include.template ++ mkdir -p `dirname $@` + sed -e s:XX::g $? > $@ + sed -e s:XX:_release:g $? >> $@ + sed -e s:XX:_acquire:g $? >> $@ +@@ -45,6 +46,7 @@ test_atomic_include.h: test_atomic_include.template + sed -e s:XX:_acquire_read:g $? >> $@ + + list_atomic.c: list_atomic.template ++ mkdir -p `dirname $@` + echo "#include \"atomic_ops.h\"" > $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s:XX::g $? >> $@ + sed -e s:XSIZE_::g -e s:XCTYPE:AO_t:g -e s:XX:_release:g $? >> $@ +@@ -93,6 +95,7 @@ list_atomic.c: list_atomic.template + sed -e s:XSIZE:double:g -e s:XCTYPE:AO_double_t:g -e s:XX:_dd_acquire_read:g $? >> $@ + + list_atomic.i: list_atomic.c ++ mkdir -p `dirname $@` + $(COMPILE) $? -E > $@ + + # Verify list_atomic.c syntax: +-- +1.9.3 + diff --git a/0015-Eliminate-signed-to-unsigned-value-extension-compile.patch b/0015-Eliminate-signed-to-unsigned-value-extension-compile.patch new file mode 100644 index 0000000..2e7902f --- /dev/null +++ b/0015-Eliminate-signed-to-unsigned-value-extension-compile.patch @@ -0,0 +1,55 @@ +From 481b4eb85ac49af5b0034930aa375cff05e1b8f9 Mon Sep 17 00:00:00 2001 +From: Ivan Maidanski +Date: Mon, 8 Feb 2016 10:13:47 +0300 +Subject: [PATCH 15/20] Eliminate 'signed-to-unsigned value extension' compiler + warning in AO_malloc + +* src/atomic_ops_malloc.c (msbs): Change type from int to unsigned +char. +* src/atomic_ops_malloc.c (msb): Change return type from int to +unsigned. +* src/atomic_ops_malloc.c (msb, AO_malloc): Change type of v, result, +log_sz local variables from int to unsigned. +--- + src/atomic_ops_malloc.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/atomic_ops_malloc.c b/src/atomic_ops_malloc.c +index 60757cf..124c87c 100644 +--- a/src/atomic_ops_malloc.c ++++ b/src/atomic_ops_malloc.c +@@ -224,16 +224,18 @@ static void add_chunk_as(void * chunk, unsigned log_sz) + } + } + +-static const int msbs[16] = {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}; ++static const unsigned char msbs[16] = { ++ 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 ++}; + + /* Return the position of the most significant set bit in the */ + /* argument. */ + /* We follow the conventions of ffs(), i.e. the least */ + /* significant bit is number one. */ +-static int msb(size_t s) ++static unsigned msb(size_t s) + { +- int result = 0; +- int v; ++ unsigned result = 0; ++ unsigned v; + if ((s & 0xff) != s) { + /* The following is a tricky code ought to be equivalent to */ + /* "(v = s >> 32) != 0" but suppresses warnings on 32-bit arch's. */ +@@ -266,7 +268,7 @@ void * + AO_malloc(size_t sz) + { + AO_t *result; +- int log_sz; ++ unsigned log_sz; + + if (sz > CHUNK_SIZE) + return AO_malloc_large(sz); +-- +1.9.3 + diff --git a/0016-Use-LLD-and-SCD-instructions-on-mips64.patch b/0016-Use-LLD-and-SCD-instructions-on-mips64.patch new file mode 100644 index 0000000..aeee45e --- /dev/null +++ b/0016-Use-LLD-and-SCD-instructions-on-mips64.patch @@ -0,0 +1,142 @@ +From 54d1da56809b892d2fc521fea0fd41ea8c23e4f2 Mon Sep 17 00:00:00 2001 +From: James Cowgill +Date: Thu, 8 Jan 2015 16:00:38 +0000 +Subject: [PATCH 16/36] Use LLD and SCD instructions on mips64 + +--- + src/atomic_ops/sysdeps/gcc/mips.h | 54 ++++++++++++++++++++++----------------- + 1 file changed, 30 insertions(+), 24 deletions(-) + +diff --git a/src/atomic_ops/sysdeps/gcc/mips.h b/src/atomic_ops/sysdeps/gcc/mips.h +index a891de6..83a6bd3 100644 +--- a/src/atomic_ops/sysdeps/gcc/mips.h ++++ b/src/atomic_ops/sysdeps/gcc/mips.h +@@ -15,7 +15,6 @@ + * FIXME: This should probably make finer distinctions. SGI MIPS is + * much more strongly ordered, and in fact closer to sequentially + * consistent. This is really aimed at modern embedded implementations. +- * It looks to me like this assumes a 32-bit ABI. -HB + */ + + #include "../all_aligned_atomic_load_store.h" +@@ -27,14 +26,24 @@ + /* Data dependence does not imply read ordering. */ + #define AO_NO_DD_ORDERING + ++#ifdef __mips64 ++# define AO_MIPS_SET_ISA " .set mips3\n" ++# define AO_MIPS_LL_1(args) " lld " args "\n" ++# define AO_MIPS_SC(args) " scd " args "\n" ++#else ++# define AO_MIPS_SET_ISA " .set mips2\n" ++# define AO_MIPS_LL_1(args) " ll " args "\n" ++# define AO_MIPS_SC(args) " sc " args "\n" ++# define AO_T_IS_INT ++#endif ++ + #ifdef AO_ICE9A1_LLSC_WAR + /* ICE9 rev A1 chip (used in very few systems) is reported to */ + /* have a low-frequency bug that causes LL to fail. */ + /* To workaround, just issue the second 'LL'. */ +-# define AO_MIPS_LL_FIX(args_str) \ +- " ll " args_str "\n" ++# define AO_MIPS_LL(args) AO_MIPS_LL_1(args) AO_MIPS_LL_1(args) + #else +-# define AO_MIPS_LL_FIX(args_str) "" ++# define AO_MIPS_LL(args) AO_MIPS_LL_1(args) + #endif + + AO_INLINE void +@@ -42,7 +51,7 @@ AO_nop_full(void) + { + __asm__ __volatile__( + " .set push \n" +- " .set mips2 \n" ++ AO_MIPS_SET_ISA + " .set noreorder \n" + " .set nomacro \n" + " sync \n" +@@ -60,13 +69,13 @@ AO_fetch_and_add(volatile AO_t *addr, AO_t incr) + + __asm__ __volatile__( + " .set push\n" +- " .set mips2\n" ++ AO_MIPS_SET_ISA + " .set noreorder\n" + " .set nomacro\n" +- "1: ll %0, %2\n" +- AO_MIPS_LL_FIX("%0, %2") ++ "1: " ++ AO_MIPS_LL("%0, %2") + " addu %1, %0, %3\n" +- " sc %1, %2\n" ++ AO_MIPS_SC("%1, %2") + " beqz %1, 1b\n" + " nop\n" + " .set pop " +@@ -85,13 +94,13 @@ AO_test_and_set(volatile AO_TS_t *addr) + + __asm__ __volatile__( + " .set push\n" +- " .set mips2\n" ++ AO_MIPS_SET_ISA + " .set noreorder\n" + " .set nomacro\n" +- "1: ll %0, %2\n" +- AO_MIPS_LL_FIX("%0, %2") ++ "1: " ++ AO_MIPS_LL("%0, %2") + " move %1, %3\n" +- " sc %1, %2\n" ++ AO_MIPS_SC("%1, %2") + " beqz %1, 1b\n" + " nop\n" + " .set pop " +@@ -114,14 +123,14 @@ AO_test_and_set(volatile AO_TS_t *addr) + + __asm__ __volatile__( + " .set push \n" +- " .set mips2 \n" ++ AO_MIPS_SET_ISA + " .set noreorder \n" + " .set nomacro \n" +- "1: ll %0, %1 \n" +- AO_MIPS_LL_FIX("%0, %1") ++ "1: " ++ AO_MIPS_LL("%0, %1") + " bne %0, %4, 2f \n" + " move %0, %3 \n" +- " sc %0, %1 \n" ++ AO_MIPS_SC("%0, %1") + " .set pop \n" + " beqz %0, 1b \n" + " li %2, 1 \n" +@@ -142,14 +151,14 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) + + __asm__ __volatile__( + " .set push\n" +- " .set mips2\n" ++ AO_MIPS_SET_ISA + " .set noreorder\n" + " .set nomacro\n" +- "1: ll %0, %2\n" +- AO_MIPS_LL_FIX("%0, %2") ++ "1: " ++ AO_MIPS_LL("%0, %2") + " bne %0, %4, 2f\n" + " move %1, %3\n" +- " sc %1, %2\n" ++ AO_MIPS_SC("%1, %2") + " beqz %1, 1b\n" + " nop\n" + " .set pop\n" +@@ -167,6 +176,3 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) + /* CAS primitives with acquire, release and full semantics are */ + /* generated automatically (and AO_int_... primitives are */ + /* defined properly after the first generalization pass). */ +- +-/* FIXME: 32-bit ABI is assumed. */ +-#define AO_T_IS_INT +-- +1.9.3 + diff --git a/0017-Fix-GCC-5.x-compatibility-for-AArch64-double-wide-pr.patch b/0017-Fix-GCC-5.x-compatibility-for-AArch64-double-wide-pr.patch new file mode 100644 index 0000000..6865dc5 --- /dev/null +++ b/0017-Fix-GCC-5.x-compatibility-for-AArch64-double-wide-pr.patch @@ -0,0 +1,42 @@ +From 133375739ed5dd59bb3f3efeaf9db17f32bf36e1 Mon Sep 17 00:00:00 2001 +From: Frank Schaefer +Date: Tue, 9 Jun 2015 17:10:00 -0500 +Subject: [PATCH 17/20] Fix GCC 5.x compatibility for AArch64 double-wide + primitives + +Small change to make aarch64 support work with gcc 5.x. Otherwise it +demands gcc -latomic and still fails test_stack. + +* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_double_load, +AO_double_load_acquire, AO_double_store, AO_double_store_release, +AO_double_compare_and_swap, AO_double_compare_and_swap_acquire, +AO_double_compare_and_swap_release, AO_double_compare_and_swap_full): +Use assembly implementation even for GCC v5+ (not just GCC 4.x). +--- + src/atomic_ops/sysdeps/gcc/aarch64.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h +index 54e6d7f..b9624ef 100644 +--- a/src/atomic_ops/sysdeps/gcc/aarch64.h ++++ b/src/atomic_ops/sysdeps/gcc/aarch64.h +@@ -29,7 +29,7 @@ + #endif + + /* TODO: Adjust version check on fixing double-wide AO support in GCC. */ +-#if __GNUC__ == 4 ++#if __GNUC__ >= 4 + + AO_INLINE AO_double_t + AO_double_load(const volatile AO_double_t *addr) +@@ -194,6 +194,6 @@ + return !result; + } + # define AO_HAVE_double_compare_and_swap_full +-#endif /* __GNUC__ == 4 */ ++#endif /* __GNUC__ >= 4 */ + + #include "generic.h" +-- +1.9.3 + diff --git a/0017-Remove-inclusion-of-acquire_release_volatile.h-on-mi.patch b/0017-Remove-inclusion-of-acquire_release_volatile.h-on-mi.patch new file mode 100644 index 0000000..6ecc701 --- /dev/null +++ b/0017-Remove-inclusion-of-acquire_release_volatile.h-on-mi.patch @@ -0,0 +1,29 @@ +From 0f838defa3e466aff725213638f90e850430f2f9 Mon Sep 17 00:00:00 2001 +From: James Cowgill +Date: Thu, 8 Jan 2015 16:05:57 +0000 +Subject: [PATCH 17/36] Remove inclusion of acquire_release_volatile.h on mips + +I'm not entirely sure how this ended up here. It might have been the case +that MIPS processors used to do this, but the ISA manuals don't say anything +about volatile loads / stores having aquire / release semnatics, so just +remove it to be safe. +--- + src/atomic_ops/sysdeps/gcc/mips.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/atomic_ops/sysdeps/gcc/mips.h b/src/atomic_ops/sysdeps/gcc/mips.h +index 83a6bd3..f3796ea 100644 +--- a/src/atomic_ops/sysdeps/gcc/mips.h ++++ b/src/atomic_ops/sysdeps/gcc/mips.h +@@ -19,8 +19,6 @@ + + #include "../all_aligned_atomic_load_store.h" + +-#include "../loadstore/acquire_release_volatile.h" +- + #include "../test_and_set_t_is_ao_t.h" + + /* Data dependence does not imply read ordering. */ +-- +1.9.3 + diff --git a/0018-Minor-fix-of-code-alignment-in-mips-AO_compare_and_s.patch b/0018-Minor-fix-of-code-alignment-in-mips-AO_compare_and_s.patch new file mode 100644 index 0000000..01fb98e --- /dev/null +++ b/0018-Minor-fix-of-code-alignment-in-mips-AO_compare_and_s.patch @@ -0,0 +1,25 @@ +From 22ca163649571c72852f5892c05a4c1c53d50cc5 Mon Sep 17 00:00:00 2001 +From: James Cowgill +Date: Thu, 8 Jan 2015 16:14:22 +0000 +Subject: [PATCH 18/36] Minor fix of code alignment in mips AO_compare_and_swap + +--- + src/atomic_ops/sysdeps/gcc/mips.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/atomic_ops/sysdeps/gcc/mips.h b/src/atomic_ops/sysdeps/gcc/mips.h +index f3796ea..1ad47f2 100644 +--- a/src/atomic_ops/sysdeps/gcc/mips.h ++++ b/src/atomic_ops/sysdeps/gcc/mips.h +@@ -127,7 +127,7 @@ AO_test_and_set(volatile AO_TS_t *addr) + "1: " + AO_MIPS_LL("%0, %1") + " bne %0, %4, 2f \n" +- " move %0, %3 \n" ++ " move %0, %3 \n" + AO_MIPS_SC("%0, %1") + " .set pop \n" + " beqz %0, 1b \n" +-- +1.9.3 + diff --git a/libatomic_ops-7.4.2-no_undefined.patch b/libatomic_ops-7.4.2-no_undefined.patch deleted file mode 100644 index 9807396..0000000 --- a/libatomic_ops-7.4.2-no_undefined.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up libatomic_ops-7.4.2/src/Makefile.am.no_undefined libatomic_ops-7.4.2/src/Makefile.am ---- libatomic_ops-7.4.2/src/Makefile.am.no_undefined 2014-05-02 10:52:15.000000000 -0500 -+++ libatomic_ops-7.4.2/src/Makefile.am 2014-05-13 18:51:29.620033510 -0500 -@@ -12,6 +12,7 @@ libatomic_ops_la_LDFLAGS = -version-info - - libatomic_ops_gpl_la_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c - libatomic_ops_gpl_la_LDFLAGS = -version-info 1:3:0 -no-undefined -+libatomic_ops_gpl_la_LIBADD = libatomic_ops.la - - EXTRA_DIST = Makefile.msft atomic_ops/sysdeps/README \ - atomic_ops/generalize-arithm.template \ -diff -up libatomic_ops-7.4.2/src/Makefile.in.no_undefined libatomic_ops-7.4.2/src/Makefile.in ---- libatomic_ops-7.4.2/src/Makefile.in.no_undefined 2014-05-02 10:56:32.000000000 -0500 -+++ libatomic_ops-7.4.2/src/Makefile.in 2014-05-13 18:51:55.352602385 -0500 -@@ -139,7 +139,7 @@ libatomic_ops_la_LINK = $(LIBTOOL) $(AM_ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(AM_CFLAGS) $(CFLAGS) $(libatomic_ops_la_LDFLAGS) $(LDFLAGS) \ - -o $@ --libatomic_ops_gpl_la_LIBADD = -+libatomic_ops_gpl_la_LIBADD = libatomic_ops.la - am_libatomic_ops_gpl_la_OBJECTS = atomic_ops_stack.lo \ - atomic_ops_malloc.lo - libatomic_ops_gpl_la_OBJECTS = $(am_libatomic_ops_gpl_la_OBJECTS) diff --git a/libatomic_ops.spec b/libatomic_ops.spec index ece5b4b..8d864f3 100644 --- a/libatomic_ops.spec +++ b/libatomic_ops.spec @@ -1,7 +1,7 @@ Name: libatomic_ops Summary: Atomic memory update operations Version: 7.4.2 -Release: 7%{?dist} +Release: 8%{?dist} # libatomic_ops MIT, libatomic_ops_gpl GPLv2 License: GPLv2 and MIT @@ -11,11 +11,23 @@ Source0: http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-%{version}.tar.g # updated GPLv2 license text Source1: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt -## upstreamable patches -# link libatomic_ops_gpl against libatomic_ops for missing symbol(s) -Patch50: libatomic_ops-7.4.2-no_undefined.patch - -# re-autofoo for patch50 +## upstream patches +# 7.4 branch +Patch2: 0002-Fix-makefile-preventing-AO_pause-undefined-in-libato.patch +Patch5: 0005-Fix-missing-casts-to-match-printf-format-specifier-i.patch +Patch6: 0006-Eliminate-variable-set-but-not-used-Cppcheck-warning.patch +Patch7: 0007-Fix-missing-output-folder-on-making-auto-generated-h.patch +Patch9: 0009-Fix-missing-output-folder-on-making-auto-generated-t.patch +Patch15: 0015-Eliminate-signed-to-unsigned-value-extension-compile.patch +Patch17: 0017-Fix-GCC-5.x-compatibility-for-AArch64-double-wide-pr.patch + +# master branch +Patch116: 0016-Use-LLD-and-SCD-instructions-on-mips64.patch +Patch117: 0017-Remove-inclusion-of-acquire_release_volatile.h-on-mi.patch +Patch118: 0018-Minor-fix-of-code-alignment-in-mips-AO_compare_and_s.patch +Patch132: 0032-Add-initial-nios2-architecture-support.patch + +# re-autofoo for patch2 (and others) BuildRequires: automake libtool %description @@ -39,9 +51,7 @@ Files for developing with %{name} and linking statically. %prep -%setup -q - -%patch50 -p1 -b .no_undefined +%autosetup -p1 # patch50 introduces rpath (probably due to older libtool), refresh stuff here autoreconf -fi @@ -77,7 +87,8 @@ make check %{?arch_ignore} %postun -p /sbin/ldconfig %files -%doc COPYING doc/LICENSING.txt +%license COPYING +%doc doc/LICENSING.txt %doc AUTHORS ChangeLog README.md %{_libdir}/libatomic_ops.so.1* %{_libdir}/libatomic_ops_gpl.so.1* @@ -98,6 +109,11 @@ make check %{?arch_ignore} %changelog +* Mon Mar 28 2016 Rex Dieter - 7.4.2-8 +- pull in upstream (7.4 branch) fixes +- Add support for 64-bit MIPS (#1317509) +- use %%license + * Thu Feb 04 2016 Fedora Release Engineering - 7.4.2-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild