Package: elfutils Version: 0.165-3 Severity: important Tags: patch Hi,
elfutils will FTBFS on kfreebsd (and I suspect on hurd) with gcc-6, because there is an unused const and several unused, unexported stub functions in linux-pid-attach.c inside a code block guarded by #ifndef __linux__ A patch is attached that removes the unused code. I tested this on kfreebsd-amd64, where all tests pass except for the skipped ones, and dwfl-proc-attach correctly states "dwfl_linux_proc_attach unsupported" as before. Thank you! -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: kfreebsd-amd64 (x86_64) Kernel: kFreeBSD 10.1-0-amd64 Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Subject: libdwfl: clean up unused code for non-Linux GNU platforms From: Steven Chamberlain <ste...@pyro.eu.org> Date: Tue, 01 Mar 2016 13:32:37 +0000 For non-Linux GNU platforms (like kFreeBSD, Hurd), linux-pid-attach.c had some stub functions that are not used or exported. Since gcc-6, having these caused compiler errors due to -Wall -Werror: linux-pid-attach.c:479:36: error: 'pid_thread_callbacks' defined but not used [-Werror=unused-const-variable=] linux-pid-attach.c:474:1: error: 'pid_thread_detach' defined but not used [-Werror=unused-function] linux-pid-attach.c:461:1: error: 'pid_detach' defined but not used [-Werror=unused-function] linux-pid-attach.c:452:1: error: 'pid_set_initial_registers' defined but not used [-Werror=unused-function] linux-pid-attach.c:441:1: error: 'pid_memory_read' defined but not used [-Werror=unused-function] linux-pid-attach.c:420:1: error: 'pid_getthread' defined but not used [-Werror=unused-function] linux-pid-attach.c:410:1: error: 'pid_next_thread' defined but not used [-Werror=unused-function] This part of the source file is guarded by #ifndef __linux__ --- a/libdwfl/linux-pid-attach.c +++ b/libdwfl/linux-pid-attach.c @@ -406,27 +406,6 @@ #else /* __linux__ */ -static pid_t -pid_next_thread (Dwfl *dwfl __attribute__ ((unused)), - void *dwfl_arg __attribute__ ((unused)), - void **thread_argp __attribute__ ((unused))) -{ - errno = ENOSYS; - __libdwfl_seterrno (DWFL_E_ERRNO); - return -1; -} - -static bool -pid_getthread (Dwfl *dwfl __attribute__ ((unused)), - pid_t tid __attribute__ ((unused)), - void *dwfl_arg __attribute__ ((unused)), - void **thread_argp __attribute__ ((unused))) -{ - errno = ENOSYS; - __libdwfl_seterrno (DWFL_E_ERRNO); - return false; -} - bool internal_function __libdwfl_ptrace_attach (pid_t tid __attribute__ ((unused)), @@ -437,32 +416,6 @@ return false; } -static bool -pid_memory_read (Dwfl *dwfl __attribute__ ((unused)), - Dwarf_Addr addr __attribute__ ((unused)), - Dwarf_Word *result __attribute__ ((unused)), - void *arg __attribute__ ((unused))) -{ - errno = ENOSYS; - __libdwfl_seterrno (DWFL_E_ERRNO); - return false; -} - -static bool -pid_set_initial_registers (Dwfl_Thread *thread __attribute__ ((unused)), - void *thread_arg __attribute__ ((unused))) -{ - errno = ENOSYS; - __libdwfl_seterrno (DWFL_E_ERRNO); - return false; -} - -static void -pid_detach (Dwfl *dwfl __attribute__ ((unused)), - void *dwfl_arg __attribute__ ((unused))) -{ -} - void internal_function __libdwfl_ptrace_detach (pid_t tid __attribute__ ((unused)), @@ -470,22 +423,6 @@ { } -static void -pid_thread_detach (Dwfl_Thread *thread __attribute__ ((unused)), - void *thread_arg __attribute__ ((unused))) -{ -} - -static const Dwfl_Thread_Callbacks pid_thread_callbacks = -{ - pid_next_thread, - pid_getthread, - pid_memory_read, - pid_set_initial_registers, - pid_detach, - pid_thread_detach, -}; - int dwfl_linux_proc_attach (Dwfl *dwfl __attribute__ ((unused)), pid_t pid __attribute__ ((unused)),