Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Mar 2020 09:26:56 -0800
From:      Ryan Libby <rlibby@freebsd.org>
To:        Guido Falsi <madpilot@freebsd.org>
Cc:        "Alexander V. Chernikov" <melifaro@ipfw.ru>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "src-committers@freebsd.org" <src-committers@freebsd.org>, vbox@freebsd.org
Subject:   Re: svn commit: r358439 - head/sys/amd64/include
Message-ID:  <CAHgpiFw3t3PU4Y2Xs7Tgxn8keKqDYAsSCC%2BtDKnDvZgdjGaZ3A@mail.gmail.com>
In-Reply-To: <3d54ebc3-a511-a239-136d-c0f638a69351@FreeBSD.org>
References:  <202002281832.01SIWaEL071685@repo.freebsd.org> <5767791583138727@sas1-c7aad230fe87.qloud-c.yandex.net> <CAHgpiFzg1Co6KY2twE3Pa7-ozQti4kzMr432R_7w9hukMQU00A@mail.gmail.com> <3d54ebc3-a511-a239-136d-c0f638a69351@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 4, 2020 at 3:27 AM Guido Falsi <madpilot@freebsd.org> wrote:
>
> On 02/03/20 18:13, Ryan Libby wrote:
> > On Mon, Mar 2, 2020 at 12:45 AM Alexander V. Chernikov <melifaro@ipfw.ru> wrote:
> >>
> >> 28.02.2020, 18:32, "Ryan Libby" <rlibby@freebsd.org>:
> >>> Author: rlibby
> >>> Date: Fri Feb 28 18:32:36 2020
> >>> New Revision: 358439
> >>> URL: https://svnweb.freebsd.org/changeset/base/358439
> >>>
> >>> Log:
> >>>   amd64 atomic.h: minor codegen optimization in flag access
> >>>
> >>>   Previously the pattern to extract status flags from inline assembly
> >>>   blocks was to use setcc in the block to write the flag to a register.
> >>>   This was suboptimal in a few ways:
> >>>    - It would lead to code like: sete %cl; test %cl; jne, i.e. a flag
> >>>      would just be loaded into a register and then reloaded to a flag.
> >>>    - The setcc would force the block to use an additional register.
> >>>    - If the client code didn't care for the flag value then the setcc
> >>>      would be entirely pointless but could not be eliminated by the
> >>>      optimizer.
> >>>
> >>>   A more modern inline asm construct (since gcc 6 and clang 9) allows for
> >> This effectively restricts kernel builds by all older compilers.
> >> Is there any chance of making it conditional depending on the compiler version/features?
> >
> > Yes, it is possible to test for __GCC_ASM_FLAG_OUTPUTS__.  It is more
> > maintenance effort going forward.  If building current with an old cross
> > compiler is an important scenario, we can either revert this and the
> > following revision or work up a patch to make it conditional.  I'll see
> > what that might look like.
> >
>
> Actually this causes emulators/virtualbox-ose port to fail to build:
>
> In file included from /usr/src/sys/sys/systm.h:44:
> /usr/include/machine/atomic.h:230:1: error: invalid output constraint
> '=@cce' in asm
> ATOMIC_CMPSET(char);
> ^
> /usr/include/machine/atomic.h:205:4: note: expanded from macro
> 'ATOMIC_CMPSET'
>         : "=@cce" (res),                /* 0 */         \
>           ^
> /usr/include/machine/atomic.h:230:1: error: invalid output constraint
> '=@cce' in asm
>
> (and so on)
>
>
> the virtualbox-ose port is forced to use an older clang version due to
> crashes when compiled with newer ones.
>
> Not sure whose responsibility is to fix this.
>
> Should I file a bug report on bugzilla?
>
> --
> Guido Falsi <madpilot@freebsd.org>

We've discussed whether to provide compatibility code for older compilers here:
https://reviews.freebsd.org/D23937

There's a bug tracking virtualbox-ose being pinned to an old compiler here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236616

I see you have commented on that bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHgpiFw3t3PU4Y2Xs7Tgxn8keKqDYAsSCC%2BtDKnDvZgdjGaZ3A>