From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11438 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Issues building gdbserver with musl Date: Sat, 10 Jun 2017 22:46:16 -0400 Message-ID: <20170611024616.GW1627@brightrain.aerifal.cx> References: <20170603161400.3f8d3e20@free-electrons.com> <20170605113127.270f0473@free-electrons.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1497149191 12669 195.159.176.226 (11 Jun 2017 02:46:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 11 Jun 2017 02:46:31 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11451-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jun 11 04:46:27 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dJstX-00033d-9C for gllmg-musl@m.gmane.org; Sun, 11 Jun 2017 04:46:27 +0200 Original-Received: (qmail 13594 invoked by uid 550); 11 Jun 2017 02:46:30 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13576 invoked from network); 11 Jun 2017 02:46:29 -0000 Content-Disposition: inline In-Reply-To: <20170605113127.270f0473@free-electrons.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11438 Archived-At: On Mon, Jun 05, 2017 at 11:31:27AM +0200, Thomas Petazzoni wrote: > Hello, > > On Sat, 3 Jun 2017 18:50:59 -0400, mzpqnxow wrote: > > FWIW, the following is the patch I came up with for PPC- it was very, very > > short: > > > > diff -Naur gdb-7.12/gdb/gdbserver/linux-ppc-low.c > > gdb-7.12-ppc-patched/gdb/gdbserver/linux-ppc-low.c > > --- gdb-7.12/gdb/gdbserver/linux-ppc-low.c 2016-08-01 11:50:20.000000000 > > -0400 > > +++ gdb-7.12-ppc-patched/gdb/gdbserver/linux-ppc-low.c 2017-05-15 > > 13:40:22.073884258 -0400 > > @@ -21,7 +21,9 @@ > > #include "linux-low.h" > > > > #include > > +#define __ASSEMBLY__ > > #include > > +#undef __ASSEMBLY__ > > Can we upstream something like this? What is the explanation why musl > needs such a patch and not glibc/uclibc? Sorry for the delayed response. The reason is a historical mess. The original intent of glibc was not to use kernel headers to define things the libc headers need to provide, but to do their own definitions for everything (like musl always does). But some poorly maintained archs (that were originally maintained out-of-tree) ignored this rule/intent and did things the old (libc5) way, using the kernel headers. In order to provide an API matching what glibc exposes, musl defines pt_regs etc. in the powerpc sys/user.h. (Compare this to something like the arm version, which has non-overlapping names.) But this breaks if you also include the kernel header that defines pt_regs. I'm not sure what the right solution is; there really is no good one. Ideally musl and glibc would agree the problem needs to be fixed and change user.h to provide definitions with new names that don't clash with the kernel, and fix glibc's use of kernel headers. But then applications (basically just gdb) would need to be fixed to use the new names. Another possible solution would be removing sys/user.h and other "just for gdb cruft" from musl and providing it in a separate package that depends (for some archs) on kernel headers. Or we could do something really nasty and just say "on broken archs X, Y, and Z, sys/user.h and other cruft headers depend on kernel headers, just like on glibc". I'm not really sure what's best to do; that's why there's been no progress on this issue, despite it being known and longstanding. Rich