blob: 433db133b253429106264116facaf1d929397a54 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001From 2c50fe7068bd6911958c6d851aef88179e73bb21 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <Mingli.Yu@windriver.com>
3Date: Tue, 16 Apr 2019 15:30:38 +0800
4Subject: [PATCH] fix err variable and function conflicts
5
6There comes below build failure with musl when
7ptest enabled.
8| In file included from ../../elfutils-0.176/tests/dwfl-proc-attach.c:33:
9| ../../elfutils-0.176/lib/system.h:63:35: error: called object 'err' is not a function or function pointer
10| #define error(status, errno, ...) err(status, __VA_ARGS__)
11| ^~~
12| ../../elfutils-0.176/tests/dwfl-proc-attach.c:92:5: note: in expansion of macro 'error'
13| error (-1, 0, "dwfl_linux_proc_attach pid %d: %s", pid,
14| ^~~~~
15| ../../elfutils-0.176/tests/dwfl-proc-attach.c:79:7: note: declared here
16| int err;
17| ^~~
18
19It is because there is no error.h in musl and
20the patch 0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
21has updated to use err.h to replace error.h
22and also added macro definiton as below when
23use musl.
24 #define error(status, errno, ...) err(status, __VA_ARGS__)
25
26And in err.h, there is below logic:
27_Noreturn void err(int, const char *, ...);
28
29But when ptest enabled, there comes below error
30as there is both variable and function defined
31to be err in tests/dwfl-proc-attach.c.
32So change the err variable's name to workaround
33the build failure with musl.
34
35Upstream-Status: Inappropriate [workaround in musl]
36
37Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
38---
39 tests/dwfl-proc-attach.c | 6 +++---
40 1 file changed, 3 insertions(+), 3 deletions(-)
41
42Index: elfutils-0.176/tests/dwfl-proc-attach.c
43===================================================================
44--- elfutils-0.176.orig/tests/dwfl-proc-attach.c
45+++ elfutils-0.176/tests/dwfl-proc-attach.c
46@@ -76,10 +76,10 @@ main (int argc __attribute__ ((unused)),
47 char **argv __attribute__ ((unused)))
48 {
49 /* Create two extra threads to iterate through. */
50- int err;
51- if ((err = pthread_create (&thread1, NULL, sleeper, NULL)) != 0)
52+ int err1;
53+ if ((err1 = pthread_create (&thread1, NULL, sleeper, NULL)) != 0)
54 error (-1, err, "Couldn't create thread1");
55- if ((err = pthread_create (&thread2, NULL, sleeper, NULL)) != 0)
56+ if ((err1 = pthread_create (&thread2, NULL, sleeper, NULL)) != 0)
57 error (-1, err, "Couldn't create thread2");
58
59 Dwfl *dwfl = dwfl_begin (&proc_callbacks);
60Index: elfutils-0.176/tests/backtrace.c
61===================================================================
62--- elfutils-0.176.orig/tests/backtrace.c
63+++ elfutils-0.176/tests/backtrace.c
64@@ -219,23 +219,23 @@ dump (Dwfl *dwfl)
65 {
66 ptrdiff_t ptrdiff = dwfl_getmodules (dwfl, dump_modules, NULL, 0);
67 assert (ptrdiff == 0);
68- bool err = false;
69+ bool err1 = false;
70 switch (dwfl_getthreads (dwfl, thread_callback, NULL))
71 {
72 case 0:
73 break;
74 case DWARF_CB_ABORT:
75- err = true;
76+ err1 = true;
77 break;
78 case -1:
79 error (0, 0, "dwfl_getthreads: %s", dwfl_errmsg (-1));
80- err = true;
81+ err1 = true;
82 break;
83 default:
84 abort ();
85 }
86 callback_verify (0, 0, 0, NULL, dwfl);
87- if (err)
88+ if (err1)
89 exit (EXIT_FAILURE);
90 }
91