On Tue, Apr 27, 2021 at 5:34 PM Alexandre Oliva <[email protected]> wrote:
>
>
> Several i386 align tests expect p2align to be used, but not all
> configurations define ASM_OUTPUT_MAX_SKIP_ALIGN, even when
> HAVE_GAS_MAX_SKIP_P2ALIGN.
>
> i386.h has an equivalent ASM_OUTPUT_MAX_SKIP_PAD that is used in
> i386.c, so I'm adding an _ALIGN variant, as in x86-64.h, and an #undef
> to x86-64.h to avoid warnings over the duplicate def; perhaps I should
> remove them entirely? Should we even keep the x86-specific _PAD?
>
> Regstrapped on x86_64-linux-gnu, also tested with a cross to x86-vx7r2.
> Ok to install?
>
>
> for gcc/ChangeLog
>
> * config/i386/i386.h [HAVE_GAS_MAX_SKIP_P2ALIGN]
> (ASM_OUTPUT_MAX_SKIP_ALIGN): New, copied from...
> * config/i386/x86-64.h: ... here. Add undef before define.
> ---
> gcc/config/i386/i386.h | 10 ++++++++++
> gcc/config/i386/x86-64.h | 1 +
> 2 files changed, 11 insertions(+)
>
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index 96b46bac23858..26b1fda433ea7 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -2068,6 +2068,16 @@ extern int const
> svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
> bytes if it is within MAX_SKIP bytes. */
>
> #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
> +#undef ASM_OUTPUT_MAX_SKIP_ALIGN
No need to #undef here, i386.h is $tm_file and always included first.
By moving the definition to $tm_file, it effectively becomes the
default for the whole target directory, so please just remove now
redundant redefinitions-to-same in other target files.
(You can expect some easy to fix fallout here, you are dealing with 30
year old cruft ;) )
Uros.
> +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
> + do { \
> + if ((LOG) != 0) { \
> + if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1) \
> + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
> + else \
> + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
> + } \
> + } while (0)
> #undef ASM_OUTPUT_MAX_SKIP_PAD
> #define ASM_OUTPUT_MAX_SKIP_PAD(FILE, LOG, MAX_SKIP) \
> if ((LOG) != 0) \
> diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
> index 0cdd980f48105..354bd60005dd1 100644
> --- a/gcc/config/i386/x86-64.h
> +++ b/gcc/config/i386/x86-64.h
> @@ -75,6 +75,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.
> If not, see
> #define SUBALIGN_LOG 3
>
> #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
> +#undef ASM_OUTPUT_MAX_SKIP_ALIGN
> #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
> do { \
> if ((LOG) != 0) { \
>
> --
> Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
> Free Software Activist GNU Toolchain Engineer
> Vim, Vi, Voltei pro Emacs -- GNUlius Caesar