On Fri, Oct 30, 2015 at 7:48 PM,  <tbsaunde+...@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+...@tbsaunde.org>
>
> Given the layering violation that using ROUND_TYPE_ALIGN in target libs
> is, and the hacks needed to make it work just coppying the relevant code
> into encoding.c seems to make sense as an incremental improvement.  The
> epiphany version of this macro called a function that doesn't exist in
> target libs, so libobjc must not build on that target and not coppying
> that macro definition doesn't make anything worse.  We already
> explicitly prefered the default version to the macro for sparc so we
> don't need to copy that version either.  On ppc linux64 and freebsd64
> after constant folding values of other target macros used for libobjc
> the macro turned out to be the same as the default version so we can
> just use the default for them.  Which means the only version of the
> macro we actually need to copy are for ppc-darwin and AIX.
>
> libobjc/ChangeLog:
>
> 2015-10-30  Trevor Saunders  <tbsaunde+...@tbsaunde.org>
>
>         PR libobjc/24775
>         * encoding.c (objc_layout_finish_structure): Remove usage of
>         ROUND_TYPE_ALIGN.
> ---
>  libobjc/encoding.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/libobjc/encoding.c b/libobjc/encoding.c
> index 7de768f..867372d 100644
> --- a/libobjc/encoding.c
> +++ b/libobjc/encoding.c
> @@ -1237,10 +1237,22 @@ void objc_layout_finish_structure (struct 
> objc_struct_layout *layout,
>        /* Work out the alignment of the record as one expression and store
>           in the record type.  Round it up to a multiple of the record's
>           alignment. */
> -#if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__)
> -      layout->record_align = ROUND_TYPE_ALIGN (layout->original_type-1,
> -                                               1,
> -                                               layout->record_align);
> +#if _AIX
> +      char type = layout->original_type[-1];
> +      if (type == '{' || type == '(')
> +       layout->record_align =
> +         rs6000_special_round_type_align (layout->original_type-1, 1,
> +                                          layout->record_align);
> +      else
> +       layout->record_align = MAX (1, layout->record_align);
> +#elif __POWERPC__ && __APPLE__
> +      char type = layout->original_type[-1];
> +      if (type == '{' || type == '(')
> +       layout->record_align
> +         = darwin_rs6000_special_round_type_align (layout->original_type - 1,
> +                                                   1, layout->record_align);
> +      else
> +       layout->record_align = MAX (1, layout->record_align);
>  #else
>        layout->record_align = MAX (1, layout->record_align);
>  #endif

I rather not have a special defines in the source but rather a header
that gets included for these special cases instead.

Thanks,
Andrew


> --
> 2.6.2
>

Reply via email to