All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] valgrind: Make local functions static to avoid assembler error
@ 2018-10-22  4:21 Randy MacLeod
  0 siblings, 0 replies; only message in thread
From: Randy MacLeod @ 2018-10-22  4:21 UTC (permalink / raw)
  To: openembedded-core

Avoid mips32 x-compiler warnings such as:

| ../../../valgrind-3.14.0/helgrind/tests/annotate_hbefore.c:360:6: warning: no previous prototype for 'do_signal' [-Wmissing-prototypes]
|  void do_signal ( UWord* w )
|       ^~~~~~~~~

by making functions and global variables that are file scope be static
and more importantly also avoid an assembler error:

/tmp/cce22iiw.s: Assembler messages:
/tmp/cce22iiw.s:446: Error: symbol `exit_0' is already defined
/tmp/cce22iiw.s:448: Error: symbol `exit' is already defined
/tmp/cce22iiw.s:915: Error: symbol `exit_0' is already defined
/tmp/cce22iiw.s:917: Error: symbol `exit' is already defined

Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
---
 ...ions-static-to-avoid-assembler-error.patch | 182 ++++++++++++++++++
 .../valgrind/valgrind_3.14.0.bb               |   1 +
 2 files changed, 183 insertions(+)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch b/meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch
new file mode 100644
index 0000000000..45e5ea3e74
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch
@@ -0,0 +1,182 @@
+From 2155c1b2cf00e744e280c493eb74bf457dfcc3b1 Mon Sep 17 00:00:00 2001
+From: Randy MacLeod <Randy.MacLeod@windriver.com>
+Date: Sun, 21 Oct 2018 15:09:31 -0400
+Subject: [PATCH] Make local functions static to avoid assembler error
+
+Avoid mips32 x-compiler warnings such as:
+
+| ../../../valgrind-3.14.0/helgrind/tests/annotate_hbefore.c:360:6: warning: no previous prototype for 'do_signal' [-Wmissing-prototypes]
+|  void do_signal ( UWord* w )
+|       ^~~~~~~~~
+
+by making functions and global variables that are file scope be static
+and more importantly also avoid an assembler error:
+
+/tmp/cce22iiw.s: Assembler messages:
+/tmp/cce22iiw.s:446: Error: symbol `exit_0' is already defined
+/tmp/cce22iiw.s:448: Error: symbol `exit' is already defined
+/tmp/cce22iiw.s:915: Error: symbol `exit_0' is already defined
+/tmp/cce22iiw.s:917: Error: symbol `exit' is already defined
+
+Upstream-Status: Pending
+
+Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
+---
+ helgrind/tests/annotate_hbefore.c | 34 +++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/helgrind/tests/annotate_hbefore.c b/helgrind/tests/annotate_hbefore.c
+index e311714f7..f55514e45 100644
+--- a/helgrind/tests/annotate_hbefore.c
++++ b/helgrind/tests/annotate_hbefore.c
+@@ -24,7 +24,7 @@ typedef  unsigned long int  UWord;
+ 
+ // ppc64
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+   UWord old, success;
+ 
+@@ -57,7 +57,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // ppc32
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+   UWord old, success;
+ 
+@@ -90,7 +90,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // amd64
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+    UWord block[4] = { (UWord)addr, expected, nyu, 2 };
+    __asm__ __volatile__(
+@@ -113,7 +113,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // x86
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+    UWord block[4] = { (UWord)addr, expected, nyu, 2 };
+    __asm__ __volatile__(
+@@ -138,7 +138,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // arm
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+   UWord old, success;
+   UWord block[2] = { (UWord)addr, nyu };
+@@ -171,7 +171,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // arm64
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+   UWord old, success;
+   UWord block[2] = { (UWord)addr, nyu };
+@@ -204,7 +204,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // s390x
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW(UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW(UWord* addr, UWord expected, UWord nyu )
+ {
+    int cc;
+ 
+@@ -223,7 +223,7 @@ UWord do_acasW(UWord* addr, UWord expected, UWord nyu )
+ 
+ // mips32
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+   UWord success;
+   UWord block[3] = { (UWord)addr, nyu, expected};
+@@ -256,7 +256,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ // mips64
+ /* return 1 if success, 0 if failure */
+-UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
++static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ {
+   UWord success;
+   UWord block[3] = { (UWord)addr, nyu, expected};
+@@ -287,7 +287,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+ 
+ #endif
+ 
+-void atomic_incW ( UWord* w )
++static void atomic_incW ( UWord* w )
+ {
+    while (1) {
+       UWord old = *w;
+@@ -301,7 +301,7 @@ void atomic_incW ( UWord* w )
+ 
+ #define NNN 1000000
+ 
+-void* thread_fn ( void* arg )
++static void* thread_fn ( void* arg )
+ {
+   UWord* w = (UWord*)arg;
+   int i;
+@@ -331,10 +331,10 @@ int main ( void )
+ 
+ #endif
+ 
+-int shared_var = 0;  // is not raced upon
++static int shared_var = 0;  // is not raced upon
+ 
+ 
+-void delayXms ( int i )
++static void delayXms ( int i )
+ {
+    struct timespec ts = { 0, 1 * 1000 * 1000 };
+    // We do the sleep in small pieces to have scheduling
+@@ -348,7 +348,7 @@ void delayXms ( int i )
+    }
+ }
+ 
+-void do_wait ( UWord* w )
++static void do_wait ( UWord* w )
+ {
+   UWord w0 = *w;
+   UWord volatile * wV = w;
+@@ -357,7 +357,7 @@ void do_wait ( UWord* w )
+   ANNOTATE_HAPPENS_AFTER(w);
+ }
+ 
+-void do_signal ( UWord* w )
++static void do_signal ( UWord* w )
+ {
+   ANNOTATE_HAPPENS_BEFORE(w);
+   atomic_incW(w);
+@@ -365,7 +365,7 @@ void do_signal ( UWord* w )
+ 
+ 
+ 
+-void* thread_fn1 ( void* arg )
++static void* thread_fn1 ( void* arg )
+ {
+   UWord* w = (UWord*)arg;
+   delayXms(500);    // ensure t2 gets to its wait first
+@@ -376,7 +376,7 @@ void* thread_fn1 ( void* arg )
+   return NULL;
+ }
+ 
+-void* thread_fn2 ( void* arg )
++static void* thread_fn2 ( void* arg )
+ {
+   UWord* w = (UWord*)arg;
+   do_wait(w);      // wait for h-b edge from first thread
+-- 
+2.17.0
+
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.14.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.14.0.bb
index 2fa529516b..7f0a93f6f8 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.14.0.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.14.0.bb
@@ -35,6 +35,7 @@ SRC_URI = "http://www.valgrind.org/downloads/valgrind-${PV}.tar.bz2 \
            file://0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch \
            file://0001-fix-opcode-not-supported-on-mips32-linux.patch \
            file://0001-Guard-against-__GLIBC_PREREQ-for-musl-libc.patch \
+           file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \
            "
 SRC_URI[md5sum] = "74175426afa280184b62591b58c671b3"
 SRC_URI[sha256sum] = "037c11bfefd477cc6e9ebe8f193bb237fe397f7ce791b4a4ce3fa1c6a520baa5"
-- 
2.17.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-22  4:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22  4:21 [PATCH] valgrind: Make local functions static to avoid assembler error Randy MacLeod

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.