Oh dear. I regret to inform you that commit 0e65dfbaf3a0299e4837216a103c28625d4b4f1d might be unfortunate

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Wed May 29 13:38:00 GMT 2019


Nix <nix@esperi.org.uk> writes:

> On 29 May 2019, Rainer Orth outgrape:
>
>>> In case you have trouble spotting the error, I believe it is
>>>
>>> ../../binutils-gdb/libctf/ctf-archive.c:24:10: fatal error: endian.h: No such file or directory
>>>  #include <endian.h>
>>>           ^~~~~~~~~~
>>>
>>> which you can find if you follow one of the "Full build" URLs in the other messages.
>>
>> Unfortunately, it's way worse than that:
>>
>> * <endian.h> isn't even needed at all: gdb master still compiles with
>>   that include removed.
>
> Uh... the ctf-archive.c warnings below are 90% down to the removal of
> this header. So I'd say it doesn't compile *well*. :)
>
> Does Solaris seriously not have this header? It's in Illumos, but I
> guess it's a later addition...

As even the Linux htole64(3) man page notes, this stuff is highly
unportable:

CONFORMING TO
       These  functions are nonstandard.  Similar functions are present on the
       BSDs, where the required  header  file  is  <sys/endian.h>  instead  of
       <endian.h>.  Unfortunately, NetBSD, FreeBSD, and glibc haven't followed
       the original OpenBSD naming convention for these functions, whereby the
       nn  component always appears at the end of the function name (thus, for
       example, in NetBSD, FreeBSD, and  glibc,  the  equivalent  of  OpenBSDs
       "betoh32" is "be32toh").

>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-archive.c:172:3: warning:
>> implicit declaration of function 'qsort_r'; did you mean 'qsort'?
>> [-Wimplicit-function-declaration]
>>   172 |   qsort_r ((ctf_archive_modent_t *) ((char *) archdr
>
> OK, I'll have to reimplement it (using qsort() would massively uglify
> the code).

The gnulib docs for qsort_r gives

Portability problems fixed by Gnulib:
@itemize
@item
This function has an incompatible API on some platforms:
FreeBSD 10.
@item
This function is missing on some platforms:
glibc 2.7, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5,
 OSF/1 5.1, Solaris 11.4, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0

>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-archive.c: In function
>> 'ctf_arc_open_by_offset':
>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-archive.c:514:3: warning:
>> implicit declaration of function 'bzero'
>> [-Wimplicit-function-declaration]
>>   514 |   bzero (&ctfsect, sizeof (ctf_sect_t));
>>       |   ^~~~~
>
> I stripped almost all of these out, but it looks like one single one
> survived. It is gone now.

Thanks.

>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-create.c: In function
>> 'ctf_add_member_offset':
>> configure: loading cache ./config.cache
>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-create.c:1351:10: warning:
>> implicit declaration of function 'roundup'
>> [-Wimplicit-function-declaration]
>>  1351 |    off = roundup (off, NBBY) / NBBY;
>>       |          ^~~~~~~
>> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-create.c:1352:24: warning:
>> implicit declaration of function 'MAX' [-Wimplicit-function-declaration]
>>  1352 |    off = roundup (off, MAX (malign, 1));
>>       |                        ^~~
>
> Augh, roundup() is a glibc-specific extension? (But this is as old as
> the import from Solaris, so it was clearly a Solaris extension once,
> too.)

On Solaris, it lives in <sys/sysmacros.h>, but even in /usr/include it's
almost exclusively used in lowlevel system headers (<nfs/*.h>, <vm/*.h>,
<sys/*.h>).

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



More information about the Gdb-patches mailing list