On Sun, 4 Nov 2018 at 17:50, Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote:
>
> Hi Iain,
>
> > On Sat, 3 Nov 2018 at 23:23, Iain Buclaw <ibuc...@gdcproject.org> wrote:
> >>
> >> On Wed, 31 Oct 2018 at 10:40, Rainer Orth <r...@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  <ibuc...@gdcproject.org>
>
>         gcc/d:
>         * dmd/expression.h (UnionExp.u): Change for_alignment_only to long
>         double.
>
> 2018-10-29  Rainer Orth  <r...@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 via email to