This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH libctf] Fix a number of build problems found on Solaris and NetBSD
- From: John Marshall <John dot W dot Marshall at glasgow dot ac dot uk>
- To: Nick Alcock <nick dot alcock at oracle dot com>
- Cc: "Jose E. Marchesi" <jose dot marchesi at oracle dot com>, Alan Modra <amodra at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>, "Nick Clifton" <nickc at redhat dot com>, Szabolcs Nagy <nsz at port70 dot net>, "christophe dot lyon at linaro dot org" <christophe dot lyon at linaro dot org>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>, Simon Marchi <simark at simark dot ca>, "Kamil Rytarowski" <n54 at gmx dot com>
- Date: Mon, 3 Jun 2019 12:09:26 +0000
- Subject: Re: [PATCH libctf] Fix a number of build problems found on Solaris and NetBSD
- References: <8736kw2h5b.fsf@esperi.org.uk> <87o93k0yje.fsf@esperi.org.uk> <20190531001910.GB6820@bubble.grove.modra.org> <877ea73s2n.fsf@oracle.com> <57CFB55C-19DB-4185-9DBD-0C2DD285630C@glasgow.ac.uk> <87ftotzk4b.fsf@esperi.org.uk>
On 1 Jun 2019, at 11:16, Nick Alcock <nick.alcock@oracle.com> wrote:
> On 31 May 2019, John Marshall outgrape:
>> Changing the identifier (e.g. to qsort_r_bork) in the four libctf/*.[ch] files it appears in leads to a working compilation.
>
> Downside: this can be quite a *large* sort. Doing this would mean
> eschewing the system qsort() at all times. Do we want to do that? (Is it
> actually going to be any faster than gnulib's?)
This comment about qsort_r_bork() was mostly to confirm that once this qsort_r() problem is fixed, there are no further issues on macOS.
I suppose your options would be:
* just use the system qsort() with a global
* code ctf-archive.c etc in terms of a xqsort_r() or so, that is the system qsort_r() if it has the expected signature or qsort_r.c's otherwise
* ...or that also calls the macOS/BSD qsort_r() with a shim around the compare function to rearrange the arguments
* play preprocessor games in ctf-archive.c etc so that compare functions have their parameters in the order the system qsort_r() (if any) expects
>> Incidentally, this warning seems accurate in saying this free() should be further down:
>> ../../../binutils-gdb/libctf/ctf-dump.c:276:13: warning: variable 'bit' is uninitialized when used here
>
> Will fix, of course. (I wonder why I haven't seen this warning with any
> of the GCCs I've compiled it with...
Despite the "gcc" command name, this warning came from Clang. Sometimes you get a useful warning from one compiler, sometimes from the other one... :-)
John