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

Nix
2019-05-29T12:46:30Z

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...

I'll have to add local implementations.

> * Once this is fixed, the Solaris build still fails with several
> instances of
>
> /vol/src/gnu/gdb/hg/master/dist/libctf/ctf-hash.c: In function 'ctf_hashtab_insert':
> /vol/src/gnu/gdb/hg/master/dist/libctf/ctf-hash.c:141:7: error: 'errno' undeclared (first use in this function)
> 141 | errno = -ENOMEM;
> | ^~~~~
>
> It turns out that ctf-impl.h (for reasons that completely escape me)
> includes <sys/errno.h> instead of <errno.h>. Once that is fixed, the
> amd64-pc-solaris2.11 libctf build at least finishes.

Historical madness. I really thought I removed this in an earlier review
round, but it must have crept back in :(

Will re-fix.

> * There are still quite a number of warnings that I didn't bother look
> into (all seen with gdb 9.1.0 on Solaris 11.5/x86):
>
> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-archive.c: In function 'ctf_arc_write':
> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-archive.c:110:24: warning: implicit declaration of function 'htole64' [-Wimplicit-function-declaration]
> 110 | archdr->ctfa_magic = htole64 (CTFA_MAGIC);
> | ^~~~~~~
> /vol/src/gnu/gdb/hg/master/local/libctf/ctf-archive.c:132:31: warning: implicit declaration of function 'le64toh' [-Wimplicit-function-declaration]
> 132 | for (i = 0, namesz = 0; i < le64toh (archdr->ctfa_nfiles); i++)

Will adjust, as noted above.

> /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).

> /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.

> /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.)

I'll fix that, too. :/

Working on a fix for all of these now.