blob: 433db133b253429106264116facaf1d929397a54 [file] [log] [blame]
From 2c50fe7068bd6911958c6d851aef88179e73bb21 Mon Sep 17 00:00:00 2001
From: Mingli Yu <Mingli.Yu@windriver.com>
Date: Tue, 16 Apr 2019 15:30:38 +0800
Subject: [PATCH] fix err variable and function conflicts
There comes below build failure with musl when
ptest enabled.
| In file included from ../../elfutils-0.176/tests/dwfl-proc-attach.c:33:
| ../../elfutils-0.176/lib/system.h:63:35: error: called object 'err' is not a function or function pointer
| #define error(status, errno, ...) err(status, __VA_ARGS__)
| ^~~
| ../../elfutils-0.176/tests/dwfl-proc-attach.c:92:5: note: in expansion of macro 'error'
| error (-1, 0, "dwfl_linux_proc_attach pid %d: %s", pid,
| ^~~~~
| ../../elfutils-0.176/tests/dwfl-proc-attach.c:79:7: note: declared here
| int err;
| ^~~
It is because there is no error.h in musl and
the patch 0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
has updated to use err.h to replace error.h
and also added macro definiton as below when
use musl.
#define error(status, errno, ...) err(status, __VA_ARGS__)
And in err.h, there is below logic:
_Noreturn void err(int, const char *, ...);
But when ptest enabled, there comes below error
as there is both variable and function defined
to be err in tests/dwfl-proc-attach.c.
So change the err variable's name to workaround
the build failure with musl.
Upstream-Status: Inappropriate [workaround in musl]
Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
tests/dwfl-proc-attach.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: elfutils-0.176/tests/dwfl-proc-attach.c
===================================================================
--- elfutils-0.176.orig/tests/dwfl-proc-attach.c
+++ elfutils-0.176/tests/dwfl-proc-attach.c
@@ -76,10 +76,10 @@ main (int argc __attribute__ ((unused)),
char **argv __attribute__ ((unused)))
{
/* Create two extra threads to iterate through. */
- int err;
- if ((err = pthread_create (&thread1, NULL, sleeper, NULL)) != 0)
+ int err1;
+ if ((err1 = pthread_create (&thread1, NULL, sleeper, NULL)) != 0)
error (-1, err, "Couldn't create thread1");
- if ((err = pthread_create (&thread2, NULL, sleeper, NULL)) != 0)
+ if ((err1 = pthread_create (&thread2, NULL, sleeper, NULL)) != 0)
error (-1, err, "Couldn't create thread2");
Dwfl *dwfl = dwfl_begin (&proc_callbacks);
Index: elfutils-0.176/tests/backtrace.c
===================================================================
--- elfutils-0.176.orig/tests/backtrace.c
+++ elfutils-0.176/tests/backtrace.c
@@ -219,23 +219,23 @@ dump (Dwfl *dwfl)
{
ptrdiff_t ptrdiff = dwfl_getmodules (dwfl, dump_modules, NULL, 0);
assert (ptrdiff == 0);
- bool err = false;
+ bool err1 = false;
switch (dwfl_getthreads (dwfl, thread_callback, NULL))
{
case 0:
break;
case DWARF_CB_ABORT:
- err = true;
+ err1 = true;
break;
case -1:
error (0, 0, "dwfl_getthreads: %s", dwfl_errmsg (-1));
- err = true;
+ err1 = true;
break;
default:
abort ();
}
callback_verify (0, 0, 0, NULL, dwfl);
- if (err)
+ if (err1)
exit (EXIT_FAILURE);
}