Tuesday, November 27, 2018

Re: lang/gcc/6: Install missing stdatomic.h header

On Tue, 27 Nov 2018 16:12:08 -0500
George Koehler <kernigh@gmail.com> wrote:

> NetBSD's packages of gcc5 and gcc7 do contain the headers from float.h
> to stdatomic.h (or most of them). I haven't found the reason why
> NetBSD keeps those headers and OpenBSD doesn't.

Found it!

$ cat gcc-6.4.0/gcc/config/t-openbsd
# We don't need GCC's own include files.
USER_H = $(EXTRA_HEADERS)

This t-openbsd gets enabled by gcc-6.4.0/gcc/config.gcc and then
included by build-powerpc/{prev-gcc,gcc}/Makefile so it overrides
USER_H. The effect is to remove gcc's float.h, iso646.h, stdarg.h,
stdbool.h, stddef.h, varargs.h, stdfix.h, stdnoreturn.h, stdalign.h,
stdatomic.h from the compiler.

The obvious fix (though I haven't tried it) is to remove this USER_H
override, either by commenting it or by patching config.gcc to ignore
t-openbsd. Most platforms don't override USER_H. (The only other
platform to override USER_H is config/mips/t-sdemtk, but its
override looks outdated to me.)

Another option is to keep the USER_H override and add only the 4
headers stdfix.h, stdnoreturn.h, stdalign.h, stdatomic.h. This may
become outdated if a future version of gcc adds more headers.

Another option is to add the 4 headers to base OpenBSD. If there
is some reason why /usr/include has its own float.h, iso646.h, and so
on, then the same reason might be why to add the 4 headers.

gcc also has its own stdint.h, but doesn't use it on OpenBSD, because
config.gcc defaults to use_gcc_stdint=none and has no code to enable
it on OpenBSD.

For comparison, ports-clang (pkg_info -L llvm) seems to package its
own float.h, iso646.h, and so on, and its own stdint.h; while
base-clang seems to omit headers that exist in /usr/include.

--
George Koehler <kernigh@gmail.com>

No comments:

Post a Comment