[PATCH libctf] Fix a number of build problems found on Solaris and NetBSD

John Marshall John.W.Marshall@glasgow.ac.uk
Mon Jun 3 12:09:00 GMT 2019


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


More information about the Binutils mailing list