public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gdcproject.org>
To: ro@cebitec.uni-bielefeld.de
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: Fix D compilation on Solaris
Date: Sun, 04 Nov 2018 18:31:00 -0000	[thread overview]
Message-ID: <CABOHX+cXHnay0vq9K=x=FCwyNY3Ue4DBPTPddB9E5Q0_Kx0YzA@mail.gmail.com> (raw)
In-Reply-To: <yddr2g0hjnn.fsf@CeBiTec.Uni-Bielefeld.DE>

On Sun, 4 Nov 2018 at 17:50, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Hi Iain,
>
> > On Sat, 3 Nov 2018 at 23:23, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
> >>
> >> On Wed, 31 Oct 2018 at 10:40, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> >> >
> >> > Hi Iain,
> >> >
> >> > > My first suspect here would be 'struct UnionExp', see d/dmd/expression.h
> >> > >
> >> > > Upstream dmd use a poor man's alignment, from what I recall to be
> >> > > compatible with the dmc compiler.
> >> > >
> >> > >         // Ensure that the union is suitably aligned.
> >> > >         real_t for_alignment_only;
> >> > >
> >> > > What happens if you were to replace that with marking the type as
> >> > > __attribute__ ((aligned (8))) ?
> >> >
> >> > thanks for the suggestion: this worked just fine.  After a couple more
> >> > libphobos adjustments (described below), I was able to finish the build
> >> > on both sparc-sun-solaris2.11 and i386-pc-solaris2.11.
> >> >
> >> > The link tests still all fail as before, but sparc and x86 are now on
> >> > par here :-)
> >> >
> >>
> >> Hi Rainer,
> >>
> >> On making the relevant change to dmd, this header probably should
> >> remain compatible with dmc++, which unfortunately doesn't implement
> >> any __attribute__ extensions.  Does s/real_t/long double/ also prevent
> >> the alignment error from occurring?
> >>
> >
> > Actually, turns out I'm wrong and was grepping for the wrong name.
> >
> > It is supported in the form of #pragma pack(8)
> >
> > https://www.digitalmars.com/ctg/pragmas.html#pack
>
> I tried wrapping union u in #pragma pack(8)/#pragma pack().
> Unfortunately, this doesn't seem to work as I got the same SIGBUS errors
> during a sparc-sun-solaris2.11 bootstrap.  Seems we have to stay with
> the long double version instead.
>

That's alright.  I meant that #pragma pack is for DMC compatibility.

I've the changes have been made upstream:

https://github.com/dlang/dmd/pull/8907
https://github.com/dlang/dmd/pull/8914  (Backport to C++)


> I'm including the current patch here.
>
>         Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>
> 2018-10-29  Iain Buclaw  <ibuclaw@gdcproject.org>
>
>         gcc/d:
>         * dmd/expression.h (UnionExp.u): Change for_alignment_only to long
>         double.
>
> 2018-10-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
>         gcc:
>         * config/default-d.c: Include memmodel.h.
>
>         * config/sol2-d.c: New file.
>         * config/t-sol2 (sol2-d.o): New rule.
>         * config.gcc <*-*-solaris2*>: Set d_target_objs,
>         target_has_targetdm.
>
>         libphobos:
>         * libdruntime/core/stdc/fenv.d [SPARC, SPARC64]: Set SPARC_Any.
>         [X86, X86_64]: Set X86_Any.
>         [Solaris]: Provide FE_* constants.
>         * libdruntime/core/sys/posix/aio.d [Solaris] (struct aio_result,
>         struct aiocb): New types.
>         * libdruntime/core/sys/posix/ucontext.d [SPARC64, SPARC] (_NGREG,
>         greg_t): Define.
>         [SPARC64, SPARC] (struct _fpq, struct fq, struct fpregset_t): New
>         types.
>         * libdruntime/core/thread.d (Class Thread) [Solaris]
>         (m_isRTClass): Don't declare immutable.
>         * libdruntime/rt/sections_solaris.d (SectionGroup.moduleGroup):
>         Declare nothrow @nogc.
>         (pinLoadedLibraries, unpinLoadedLibraries, inheritLoadedLibraries)
>         (cleanupLoadedLibraries): New functions.
>         * src/std/datetime/systime.d (class Clock) [Solaris]
>         (clock_gettime): Import.
>         * src/std/math.d [SPARC, SPARC64]: Set SPARC_Any.
>         (struct FloatingPointControl): Use SPARC_Any for ExceptionMask,
>         ControlState.
>

The gcc changes look OK.  I will commit the front-end and library
changes though in a merge later today, as I've been sending them
upstream first.

-- 
Iain

  reply	other threads:[~2018-11-04 18:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 12:18 Rainer Orth
2018-10-30 14:49 ` Rainer Orth
2018-10-30 19:00   ` Iain Buclaw
2018-10-31 10:02     ` Rainer Orth
2018-10-31 10:03       ` Rainer Orth
2018-10-31 17:51         ` Iain Buclaw
2018-11-04 16:47           ` Rainer Orth
2018-10-31 17:33       ` Iain Buclaw
2018-11-04 16:47         ` Rainer Orth
2018-11-03 22:23       ` Iain Buclaw
2018-11-04  0:08         ` Iain Buclaw
2018-11-04 16:50           ` Rainer Orth
2018-11-04 18:31             ` Iain Buclaw [this message]
2018-11-04 16:47         ` Rainer Orth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABOHX+cXHnay0vq9K=x=FCwyNY3Ue4DBPTPddB9E5Q0_Kx0YzA@mail.gmail.com' \
    --to=ibuclaw@gdcproject.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).