On Tue, Apr 27, 2021 at 5:34 PM Alexandre Oliva <ol...@adacore.com> 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?
i386.h is actually the default $tm_file for i386 and x86_64. It is not possible to use x86-64.h without i386.h, so you can simply delete the definition in x86-64.h. Regarding _PAD variant, please remove it and substitute #ifdef ASM_OUTPUT_MAX_SKIP_PAD with #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN. On a related note, while looking at gcc/config.gcc, I noticed that there are two identical code blocks under ${target} i[34567]86-*-* and x86-64-*-*. As much as I have eyeballed the code, I can't find the difference, so perhaps these two blocks should have been merged? Uros. > > 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 > +#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