diff mbox series

[v2,21/22] Use __ASSEMBLY__ as the assembly macros

Message ID 20200409201506.133129-6-sjg@chromium.org
State Superseded
Headers show
Series common: Further reduce the size of common.h | expand

Commit Message

Simon Glass April 9, 2020, 8:15 p.m. UTC
Some places use __ASSEMBLER__ instead which does not work since the
Makefile does not define it. Fix them.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Add new patch to fix occurances of __ASSEMBLER__

 arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h     | 2 +-
 arch/arm/include/asm/arch-mx27/regs-rtc.h                  | 2 +-
 arch/arm/include/asm/arch-mx5/imx-regs.h                   | 2 +-
 arch/arm/include/asm/arch-mx6/imx-regs.h                   | 2 +-
 arch/arm/include/asm/arch-mx7/imx-regs.h                   | 2 +-
 arch/arm/include/asm/arch-s32v234/imx-regs.h               | 2 +-
 arch/arm/include/asm/arch-vf610/imx-regs.h                 | 2 +-
 arch/arm/mach-socfpga/include/mach/clock_manager.h         | 2 +-
 arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h | 4 ++--
 arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h    | 4 ++--
 arch/arm/mach-socfpga/include/mach/sdram_arria10.h         | 2 +-
 arch/arm/mach-stm32mp/include/mach/stm32.h                 | 2 +-
 arch/x86/include/asm/mtrr.h                                | 2 +-
 arch/x86/include/asm/sipi.h                                | 4 ++--
 include/atf_common.h                                       | 2 +-
 include/elf.h                                              | 4 ++--
 16 files changed, 20 insertions(+), 20 deletions(-)

Comments

Masahiro Yamada April 13, 2020, 5:09 p.m. UTC | #1
On Fri, Apr 10, 2020 at 5:18 AM Simon Glass <sjg at chromium.org> wrote:
>
> Some places use __ASSEMBLER__ instead which does not work since the
> Makefile does not define it. Fix them.


In my understanding,
__ASSEMBLER__ is passed by the compiler
while building *.S files.

On which compiler didn't this work for you?




>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2:
> - Add new patch to fix occurances of __ASSEMBLER__
>
>  arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h     | 2 +-
>  arch/arm/include/asm/arch-mx27/regs-rtc.h                  | 2 +-
>  arch/arm/include/asm/arch-mx5/imx-regs.h                   | 2 +-
>  arch/arm/include/asm/arch-mx6/imx-regs.h                   | 2 +-
>  arch/arm/include/asm/arch-mx7/imx-regs.h                   | 2 +-
>  arch/arm/include/asm/arch-s32v234/imx-regs.h               | 2 +-
>  arch/arm/include/asm/arch-vf610/imx-regs.h                 | 2 +-
>  arch/arm/mach-socfpga/include/mach/clock_manager.h         | 2 +-
>  arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h | 4 ++--
>  arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h    | 4 ++--
>  arch/arm/mach-socfpga/include/mach/sdram_arria10.h         | 2 +-
>  arch/arm/mach-stm32mp/include/mach/stm32.h                 | 2 +-
>  arch/x86/include/asm/mtrr.h                                | 2 +-
>  arch/x86/include/asm/sipi.h                                | 4 ++--
>  include/atf_common.h                                       | 2 +-
>  include/elf.h                                              | 4 ++--
>  16 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
> index 299201b1570..5d8a2d49a1d 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
> @@ -584,5 +584,5 @@ struct ccsr_serdes {
>         u8 res5[0x19fc - 0xa00];
>  };
>
> -#endif /*__ASSEMBLY__*/
> +#endif /*__ASSEMBLY__ */
>  #endif /* __ARCH_FSL_LSCH3_IMMAP_H_ */
> diff --git a/arch/arm/include/asm/arch-mx27/regs-rtc.h b/arch/arm/include/asm/arch-mx27/regs-rtc.h
> index d373ab15839..8434f4c1cb1 100644
> --- a/arch/arm/include/asm/arch-mx27/regs-rtc.h
> +++ b/arch/arm/include/asm/arch-mx27/regs-rtc.h
> @@ -21,6 +21,6 @@ struct rtc_regs {
>         u32 dayr;
>         u32 dayalarm;
>  };
> -#endif /* __ASSEMBLY__*/
> +#endif /* __ASSEMBLY__ */
>
>  #endif /* __MX28_REGS_RTC_H__ */
> diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h b/arch/arm/include/asm/arch-mx5/imx-regs.h
> index fbb6e599b6d..3d1cc683228 100644
> --- a/arch/arm/include/asm/arch-mx5/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
> @@ -557,6 +557,6 @@ struct pwm_regs {
>         u32     cnr;
>  };
>
> -#endif /* __ASSEMBLER__*/
> +#endif /* __ASSEMBLY__ */
>
>  #endif                         /* __ASM_ARCH_MX5_IMX_REGS_H__ */
> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
> index 4f01b20aedf..5b41a7a4b8b 100644
> --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
> @@ -1003,5 +1003,5 @@ struct pwm_regs {
>   */
>  #define        is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
>
> -#endif /* __ASSEMBLER__*/
> +#endif /* __ASSEMBLY__ */
>  #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
> diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h b/arch/arm/include/asm/arch-mx7/imx-regs.h
> index 63365140072..7b23abbc7eb 100644
> --- a/arch/arm/include/asm/arch-mx7/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
> @@ -1223,5 +1223,5 @@ struct bootrom_sw_info {
>         u32 reserved_3[3];
>  };
>
> -#endif /* __ASSEMBLER__*/
> +#endif /* __ASSEMBLY__ */
>  #endif /* __ASM_ARCH_MX7_IMX_REGS_H__ */
> diff --git a/arch/arm/include/asm/arch-s32v234/imx-regs.h b/arch/arm/include/asm/arch-s32v234/imx-regs.h
> index 9a779cce965..1472a43f1bc 100644
> --- a/arch/arm/include/asm/arch-s32v234/imx-regs.h
> +++ b/arch/arm/include/asm/arch-s32v234/imx-regs.h
> @@ -323,6 +323,6 @@ struct mscm_ir {
>         u32 ipcie[4];           /* Interconnect Parity Checking Injection Enable Register       */
>  };
>
> -#endif /* __ASSEMBLER__ */
> +#endif /* __ASSEMBLY__ */
>
>  #endif /* __ASM_ARCH_IMX_REGS_H__ */
> diff --git a/arch/arm/include/asm/arch-vf610/imx-regs.h b/arch/arm/include/asm/arch-vf610/imx-regs.h
> index ae0a187c4db..03def8e3c54 100644
> --- a/arch/arm/include/asm/arch-vf610/imx-regs.h
> +++ b/arch/arm/include/asm/arch-vf610/imx-regs.h
> @@ -474,6 +474,6 @@ struct mscm {
>         u32 cpxcfg3;
>  };
>
> -#endif /* __ASSEMBLER__*/
> +#endif /* __ASSEMBLY__ */
>
>  #endif /* __ASM_ARCH_IMX_REGS_H__ */
> diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager.h b/arch/arm/mach-socfpga/include/mach/clock_manager.h
> index c6830582a5a..1f734bcd65e 100644
> --- a/arch/arm/mach-socfpga/include/mach/clock_manager.h
> +++ b/arch/arm/mach-socfpga/include/mach/clock_manager.h
> @@ -8,7 +8,7 @@
>
>  phys_addr_t socfpga_get_clkmgr_addr(void);
>
> -#ifndef __ASSEMBLER__
> +#ifndef __ASSEMBLY__
>  void cm_wait_for_lock(u32 mask);
>  int cm_wait_for_fsm(void);
>  void cm_print_clock_quick_summary(void);
> diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
> index 23f280df1b9..8d62d75432b 100644
> --- a/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
> +++ b/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
> @@ -6,7 +6,7 @@
>  #ifndef CLOCK_MANAGER_ARRIA10
>  #define CLOCK_MANAGER_ARRIA10
>
> -#ifndef __ASSEMBLER__
> +#ifndef __ASSEMBLY__
>
>  /* Clock manager group */
>  #define CLKMGR_A10_CTRL                                0x00
> @@ -69,7 +69,7 @@ unsigned long cm_get_mpu_clk_hz(void);
>
>  unsigned int cm_get_qspi_controller_clk_hz(void);
>
> -#endif /* __ASSEMBLER__ */
> +#endif /* __ASSEMBLY__ */
>
>  #define LOCKED_MASK    (CLKMGR_CLKMGR_STAT_MAINPLLLOCKED_SET_MSK | \
>                          CLKMGR_CLKMGR_STAT_PERPLLLOCKED_SET_MSK)
> diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h b/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
> index 08655094ca3..fc6d2301561 100644
> --- a/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
> +++ b/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
> @@ -6,7 +6,7 @@
>  #ifndef _CLOCK_MANAGER_GEN5_H_
>  #define _CLOCK_MANAGER_GEN5_H_
>
> -#ifndef __ASSEMBLER__
> +#ifndef __ASSEMBLY__
>
>  struct cm_config {
>         /* main group */
> @@ -107,7 +107,7 @@ const unsigned int cm_get_f2s_sdr_ref_clk_hz(void);
>  /* Clock configuration accessors */
>  int cm_basic_init(const struct cm_config * const cfg);
>  const struct cm_config * const cm_get_default_config(void);
> -#endif /* __ASSEMBLER__ */
> +#endif /* __ASSEMBLY__ */
>
>  #define LOCKED_MASK \
>         (CLKMGR_INTER_SDRPLLLOCKED_MASK  | \
> diff --git a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
> index 25b82fb2858..f2773883fd1 100644
> --- a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
> +++ b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
> @@ -205,7 +205,7 @@ struct socfpga_io48_mmr {
>         u32 niosreserve2;
>  };
>
> -#endif /*__ASSEMBLY__*/
> +#endif /*__ASSEMBLY__ */
>
>  #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK                0x1F000000
>  #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_SHIFT       24
> diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h
> index 6daf9f71216..b89ce03e09b 100644
> --- a/arch/arm/mach-stm32mp/include/mach/stm32.h
> +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
> @@ -129,5 +129,5 @@ enum forced_boot_mode {
>  #define BSEC_OTP_MAC   57
>  #define BSEC_OTP_BOARD 59
>
> -#endif /* __ASSEMBLY__*/
> +#endif /* __ASSEMBLY__ */
>  #endif /* _MACH_STM32_H_ */
> diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
> index 672617256e9..212a699c1b2 100644
> --- a/arch/x86/include/asm/mtrr.h
> +++ b/arch/x86/include/asm/mtrr.h
> @@ -57,7 +57,7 @@
>
>  #define MTRR_FIX_TYPE(t)       ((t << 24) | (t << 16) | (t << 8) | t)
>
> -#if !defined(__ASSEMBLER__)
> +#if !defined(__ASSEMBLY__)
>
>  /**
>   * Information about the previous MTRR state, set up by mtrr_open()
> diff --git a/arch/x86/include/asm/sipi.h b/arch/x86/include/asm/sipi.h
> index 1ab6c2874a0..24834225287 100644
> --- a/arch/x86/include/asm/sipi.h
> +++ b/arch/x86/include/asm/sipi.h
> @@ -10,7 +10,7 @@
>  #define AP_DEFAULT_BASE 0x30000
>  #define AP_DEFAULT_SIZE 0x10000
>
> -#ifndef __ASSEMBLER__
> +#ifndef __ASSEMBLY__
>
>  /**
>   * struct sipi_params_16bit - 16-bit SIPI entry-point parameters
> @@ -81,6 +81,6 @@ void ap_start(void);
>  extern char sipi_params_16bit[];
>  extern char sipi_params[];
>
> -#endif /* __ASSEMBLER__ */
> +#endif /* __ASSEMBLY__ */
>
>  #endif
> diff --git a/include/atf_common.h b/include/atf_common.h
> index 3a7d40e5f09..fd5454c55b4 100644
> --- a/include/atf_common.h
> +++ b/include/atf_common.h
> @@ -177,6 +177,6 @@ struct bl2_to_bl31_params_mem {
>         struct entry_point_info bl31_ep_info;
>  };
>
> -#endif /*__ASSEMBLY__*/
> +#endif /*__ASSEMBLY__ */
>
>  #endif /* __BL_COMMON_H__ */
> diff --git a/include/elf.h b/include/elf.h
> index e7c51986df8..b04e746d617 100644
> --- a/include/elf.h
> +++ b/include/elf.h
> @@ -9,7 +9,7 @@
>  #ifndef _ELF_H
>  #define _ELF_H
>
> -#ifndef __ASSEMBLER__
> +#ifndef __ASSEMBLY__
>  #include "compiler.h"
>
>  /* This version doesn't work for 64-bit ABIs - Erik */
> @@ -690,7 +690,7 @@ unsigned long elf_hash(const unsigned char *name);
>  #define R_RISCV_64             2
>  #define R_RISCV_RELATIVE       3
>
> -#ifndef __ASSEMBLER__
> +#ifndef __ASSEMBLY__
>  int valid_elf_image(unsigned long addr);
>  unsigned long load_elf64_image_phdr(unsigned long addr);
>  unsigned long load_elf64_image_shdr(unsigned long addr);
> --
> 2.26.0.110.g2183baf09c-goog
>
Simon Glass April 14, 2020, 2:41 p.m. UTC | #2
Hi Masahiro,

On Mon, 13 Apr 2020 at 11:10, Masahiro Yamada <masahiroy at kernel.org> wrote:
>
> On Fri, Apr 10, 2020 at 5:18 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > Some places use __ASSEMBLER__ instead which does not work since the
> > Makefile does not define it. Fix them.
>
>
> In my understanding,
> __ASSEMBLER__ is passed by the compiler
> while building *.S files.
>
> On which compiler didn't this work for you?
>
>
>
>
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v2:
> > - Add new patch to fix occurances of __ASSEMBLER__
> >
> >  arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h     | 2 +-
> >  arch/arm/include/asm/arch-mx27/regs-rtc.h                  | 2 +-
> >  arch/arm/include/asm/arch-mx5/imx-regs.h                   | 2 +-
> >  arch/arm/include/asm/arch-mx6/imx-regs.h                   | 2 +-
> >  arch/arm/include/asm/arch-mx7/imx-regs.h                   | 2 +-
> >  arch/arm/include/asm/arch-s32v234/imx-regs.h               | 2 +-
> >  arch/arm/include/asm/arch-vf610/imx-regs.h                 | 2 +-
> >  arch/arm/mach-socfpga/include/mach/clock_manager.h         | 2 +-
> >  arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h | 4 ++--
> >  arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h    | 4 ++--
> >  arch/arm/mach-socfpga/include/mach/sdram_arria10.h         | 2 +-
> >  arch/arm/mach-stm32mp/include/mach/stm32.h                 | 2 +-
> >  arch/x86/include/asm/mtrr.h                                | 2 +-
> >  arch/x86/include/asm/sipi.h                                | 4 ++--
> >  include/atf_common.h                                       | 2 +-
> >  include/elf.h                                              | 4 ++--
> >  16 files changed, 20 insertions(+), 20 deletions(-)
> >

I think I hit this with device tree, but I would need to go back and
check. Anyway I think we should be consistent.

Regards,
Simon
Masahiro Yamada April 14, 2020, 3:33 p.m. UTC | #3
Hi Simon,

On Tue, Apr 14, 2020 at 11:41 PM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Masahiro,
>
> On Mon, 13 Apr 2020 at 11:10, Masahiro Yamada <masahiroy at kernel.org> wrote:
> >
> > On Fri, Apr 10, 2020 at 5:18 AM Simon Glass <sjg at chromium.org> wrote:
> > >
> > > Some places use __ASSEMBLER__ instead which does not work since the
> > > Makefile does not define it. Fix them.
> >
> >
> > In my understanding,
> > __ASSEMBLER__ is passed by the compiler
> > while building *.S files.
> >
> > On which compiler didn't this work for you?
> >
> >
> >
> >
> > >
> > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > ---
> > >
> > > Changes in v2:
> > > - Add new patch to fix occurances of __ASSEMBLER__
> > >
>
> I think I hit this with device tree, but I would need to go back and
> check. Anyway I think we should be consistent.


DT files are pre-processed with  '-x assembler-with-cpp'.

So, __ASSEMBLER__ is pre-defined by the compiler.

You can easily confirm it by dumping the
compiler's pre-defined macros.



$ gcc -dM -E  - < /dev/null  | grep __ASSEMBLER__
$ gcc -dM -E -x assembler-with-cpp - < /dev/null  | grep __ASSEMBLER__
#define __ASSEMBLER__ 1




Since the following commit, DT started including U-Boot headers.
This project is progressively going strange.  :-/


commit b116aff27c56dbc9132d847f7134eb7e4cc26aa3
Author: Simon Glass <sjg at chromium.org>
Date:   Fri Nov 25 20:15:58 2016 -0700

    binman: Allow configuration options to be used in .dts files





--
Best Regards
Masahiro Yamada
Simon Goldschmidt April 14, 2020, 8:38 p.m. UTC | #4
Masahiro Yamada <masahiroy at kernel.org> schrieb am Di., 14. Apr. 2020, 17:34:

> Hi Simon,
>
> On Tue, Apr 14, 2020 at 11:41 PM Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi Masahiro,
> >
> > On Mon, 13 Apr 2020 at 11:10, Masahiro Yamada <masahiroy at kernel.org>
> wrote:
> > >
> > > On Fri, Apr 10, 2020 at 5:18 AM Simon Glass <sjg at chromium.org> wrote:
> > > >
> > > > Some places use __ASSEMBLER__ instead which does not work since the
> > > > Makefile does not define it. Fix them.
> > >
> > >
> > > In my understanding,
> > > __ASSEMBLER__ is passed by the compiler
> > > while building *.S files.
> > >
> > > On which compiler didn't this work for you?
> > >
> > >
> > >
> > >
> > > >
> > > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > > ---
> > > >
> > > > Changes in v2:
> > > > - Add new patch to fix occurances of __ASSEMBLER__
> > > >
> >
> > I think I hit this with device tree, but I would need to go back and
> > check. Anyway I think we should be consistent.
>
>
> DT files are pre-processed with  '-x assembler-with-cpp'.
>
> So, __ASSEMBLER__ is pre-defined by the compiler.
>

I have just seen this thread now. It touches socfpga headers but we're not
in CC (possibly the maintainers file needs updating).

Anyway, why do we have 2 defines for assembler? If one is predefined by the
compiler, why don't we use that? Can you explain that for someone not too
deeply involved?

Regards,
Simon


> You can easily confirm it by dumping the
> compiler's pre-defined macros.
>
>
>
> $ gcc -dM -E  - < /dev/null  | grep __ASSEMBLER__
> $ gcc -dM -E -x assembler-with-cpp - < /dev/null  | grep __ASSEMBLER__
> #define __ASSEMBLER__ 1
>
>
>
>
> Since the following commit, DT started including U-Boot headers.
> This project is progressively going strange.  :-/
>
>
> commit b116aff27c56dbc9132d847f7134eb7e4cc26aa3
> Author: Simon Glass <sjg at chromium.org>
> Date:   Fri Nov 25 20:15:58 2016 -0700
>
>     binman: Allow configuration options to be used in .dts files
>
>
>
>
>
> --
> Best Regards
> Masahiro Yamada
>
Tom Rini April 14, 2020, 9:04 p.m. UTC | #5
On Tue, Apr 14, 2020 at 10:38:47PM +0200, Simon Goldschmidt wrote:
> Masahiro Yamada <masahiroy at kernel.org> schrieb am Di., 14. Apr. 2020, 17:34:
> 
> > Hi Simon,
> >
> > On Tue, Apr 14, 2020 at 11:41 PM Simon Glass <sjg at chromium.org> wrote:
> > >
> > > Hi Masahiro,
> > >
> > > On Mon, 13 Apr 2020 at 11:10, Masahiro Yamada <masahiroy at kernel.org>
> > wrote:
> > > >
> > > > On Fri, Apr 10, 2020 at 5:18 AM Simon Glass <sjg at chromium.org> wrote:
> > > > >
> > > > > Some places use __ASSEMBLER__ instead which does not work since the
> > > > > Makefile does not define it. Fix them.
> > > >
> > > >
> > > > In my understanding,
> > > > __ASSEMBLER__ is passed by the compiler
> > > > while building *.S files.
> > > >
> > > > On which compiler didn't this work for you?
> > > >
> > > >
> > > >
> > > >
> > > > >
> > > > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > > > ---
> > > > >
> > > > > Changes in v2:
> > > > > - Add new patch to fix occurances of __ASSEMBLER__
> > > > >
> > >
> > > I think I hit this with device tree, but I would need to go back and
> > > check. Anyway I think we should be consistent.
> >
> >
> > DT files are pre-processed with  '-x assembler-with-cpp'.
> >
> > So, __ASSEMBLER__ is pre-defined by the compiler.
> >
> 
> I have just seen this thread now. It touches socfpga headers but we're not
> in CC (possibly the maintainers file needs updating).
> 
> Anyway, why do we have 2 defines for assembler? If one is predefined by the
> compiler, why don't we use that? Can you explain that for someone not too
> deeply involved?

Generally and broadly speaking, the assembler will set __ASSEMBLER__.
That said, the Linux kernel has been setting __ASSEMBLY__ for
practically forever and we've copied that behavior also practically for
forever.  In both trees there are a handful of __ASSEMBLER__ tests and a
vast majority of __ASSEMBLY__ tests.  It doesn't normally matter which
is used as the only non-compiler in the Linux kernel that might care is
handled as shown above.  Under the assumption that the feature
Yamada-san pointed out in binman is used, it should also define
__ASSEMBLER__ I believe, to match other tooling.  Thanks!
Simon Goldschmidt April 15, 2020, 4:48 a.m. UTC | #6
Am 14.04.2020 um 23:04 schrieb Tom Rini:
> On Tue, Apr 14, 2020 at 10:38:47PM +0200, Simon Goldschmidt wrote:
>> Masahiro Yamada <masahiroy at kernel.org> schrieb am Di., 14. Apr. 2020, 17:34:
>>
>>> Hi Simon,
>>>
>>> On Tue, Apr 14, 2020 at 11:41 PM Simon Glass <sjg at chromium.org> wrote:
>>>>
>>>> Hi Masahiro,
>>>>
>>>> On Mon, 13 Apr 2020 at 11:10, Masahiro Yamada <masahiroy at kernel.org>
>>> wrote:
>>>>>
>>>>> On Fri, Apr 10, 2020 at 5:18 AM Simon Glass <sjg at chromium.org> wrote:
>>>>>>
>>>>>> Some places use __ASSEMBLER__ instead which does not work since the
>>>>>> Makefile does not define it. Fix them.
>>>>>
>>>>>
>>>>> In my understanding,
>>>>> __ASSEMBLER__ is passed by the compiler
>>>>> while building *.S files.
>>>>>
>>>>> On which compiler didn't this work for you?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>>>>> ---
>>>>>>
>>>>>> Changes in v2:
>>>>>> - Add new patch to fix occurances of __ASSEMBLER__
>>>>>>
>>>>
>>>> I think I hit this with device tree, but I would need to go back and
>>>> check. Anyway I think we should be consistent.
>>>
>>>
>>> DT files are pre-processed with  '-x assembler-with-cpp'.
>>>
>>> So, __ASSEMBLER__ is pre-defined by the compiler.
>>>
>>
>> I have just seen this thread now. It touches socfpga headers but we're not
>> in CC (possibly the maintainers file needs updating).
>>
>> Anyway, why do we have 2 defines for assembler? If one is predefined by the
>> compiler, why don't we use that? Can you explain that for someone not too
>> deeply involved?
> 
> Generally and broadly speaking, the assembler will set __ASSEMBLER__.
> That said, the Linux kernel has been setting __ASSEMBLY__ for
> practically forever and we've copied that behavior also practically for
> forever.  In both trees there are a handful of __ASSEMBLER__ tests and a
> vast majority of __ASSEMBLY__ tests.  It doesn't normally matter which
> is used as the only non-compiler in the Linux kernel that might care is
> handled as shown above.  Under the assumption that the feature
> Yamada-san pointed out in binman is used, it should also define
> __ASSEMBLER__ I believe, to match other tooling.  Thanks!

Ok, thanks for the explanation.

Regards,
Simon
diff mbox series

Patch

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
index 299201b1570..5d8a2d49a1d 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
@@ -584,5 +584,5 @@  struct ccsr_serdes {
 	u8 res5[0x19fc - 0xa00];
 };
 
-#endif /*__ASSEMBLY__*/
+#endif /*__ASSEMBLY__ */
 #endif /* __ARCH_FSL_LSCH3_IMMAP_H_ */
diff --git a/arch/arm/include/asm/arch-mx27/regs-rtc.h b/arch/arm/include/asm/arch-mx27/regs-rtc.h
index d373ab15839..8434f4c1cb1 100644
--- a/arch/arm/include/asm/arch-mx27/regs-rtc.h
+++ b/arch/arm/include/asm/arch-mx27/regs-rtc.h
@@ -21,6 +21,6 @@  struct rtc_regs {
 	u32 dayr;
 	u32 dayalarm;
 };
-#endif /* __ASSEMBLY__*/
+#endif /* __ASSEMBLY__ */
 
 #endif	/* __MX28_REGS_RTC_H__ */
diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h b/arch/arm/include/asm/arch-mx5/imx-regs.h
index fbb6e599b6d..3d1cc683228 100644
--- a/arch/arm/include/asm/arch-mx5/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
@@ -557,6 +557,6 @@  struct pwm_regs {
 	u32	cnr;
 };
 
-#endif /* __ASSEMBLER__*/
+#endif /* __ASSEMBLY__ */
 
 #endif				/* __ASM_ARCH_MX5_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 4f01b20aedf..5b41a7a4b8b 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -1003,5 +1003,5 @@  struct pwm_regs {
  */
 #define	is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
 
-#endif /* __ASSEMBLER__*/
+#endif /* __ASSEMBLY__ */
 #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h b/arch/arm/include/asm/arch-mx7/imx-regs.h
index 63365140072..7b23abbc7eb 100644
--- a/arch/arm/include/asm/arch-mx7/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
@@ -1223,5 +1223,5 @@  struct bootrom_sw_info {
 	u32 reserved_3[3];
 };
 
-#endif /* __ASSEMBLER__*/
+#endif /* __ASSEMBLY__ */
 #endif /* __ASM_ARCH_MX7_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-s32v234/imx-regs.h b/arch/arm/include/asm/arch-s32v234/imx-regs.h
index 9a779cce965..1472a43f1bc 100644
--- a/arch/arm/include/asm/arch-s32v234/imx-regs.h
+++ b/arch/arm/include/asm/arch-s32v234/imx-regs.h
@@ -323,6 +323,6 @@  struct mscm_ir {
 	u32 ipcie[4];		/* Interconnect Parity Checking Injection Enable Register       */
 };
 
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_ARCH_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-vf610/imx-regs.h b/arch/arm/include/asm/arch-vf610/imx-regs.h
index ae0a187c4db..03def8e3c54 100644
--- a/arch/arm/include/asm/arch-vf610/imx-regs.h
+++ b/arch/arm/include/asm/arch-vf610/imx-regs.h
@@ -474,6 +474,6 @@  struct mscm {
 	u32 cpxcfg3;
 };
 
-#endif	/* __ASSEMBLER__*/
+#endif	/* __ASSEMBLY__ */
 
 #endif	/* __ASM_ARCH_IMX_REGS_H__ */
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager.h b/arch/arm/mach-socfpga/include/mach/clock_manager.h
index c6830582a5a..1f734bcd65e 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager.h
@@ -8,7 +8,7 @@ 
 
 phys_addr_t socfpga_get_clkmgr_addr(void);
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 void cm_wait_for_lock(u32 mask);
 int cm_wait_for_fsm(void);
 void cm_print_clock_quick_summary(void);
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
index 23f280df1b9..8d62d75432b 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
@@ -6,7 +6,7 @@ 
 #ifndef CLOCK_MANAGER_ARRIA10
 #define CLOCK_MANAGER_ARRIA10
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 
 /* Clock manager group */
 #define CLKMGR_A10_CTRL				0x00
@@ -69,7 +69,7 @@  unsigned long cm_get_mpu_clk_hz(void);
 
 unsigned int cm_get_qspi_controller_clk_hz(void);
 
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #define LOCKED_MASK	(CLKMGR_CLKMGR_STAT_MAINPLLLOCKED_SET_MSK | \
 			 CLKMGR_CLKMGR_STAT_PERPLLLOCKED_SET_MSK)
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h b/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
index 08655094ca3..fc6d2301561 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
@@ -6,7 +6,7 @@ 
 #ifndef _CLOCK_MANAGER_GEN5_H_
 #define _CLOCK_MANAGER_GEN5_H_
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 
 struct cm_config {
 	/* main group */
@@ -107,7 +107,7 @@  const unsigned int cm_get_f2s_sdr_ref_clk_hz(void);
 /* Clock configuration accessors */
 int cm_basic_init(const struct cm_config * const cfg);
 const struct cm_config * const cm_get_default_config(void);
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #define LOCKED_MASK \
 	(CLKMGR_INTER_SDRPLLLOCKED_MASK  | \
diff --git a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
index 25b82fb2858..f2773883fd1 100644
--- a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
@@ -205,7 +205,7 @@  struct socfpga_io48_mmr {
 	u32 niosreserve2;
 };
 
-#endif /*__ASSEMBLY__*/
+#endif /*__ASSEMBLY__ */
 
 #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK		0x1F000000
 #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_SHIFT	24
diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h
index 6daf9f71216..b89ce03e09b 100644
--- a/arch/arm/mach-stm32mp/include/mach/stm32.h
+++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
@@ -129,5 +129,5 @@  enum forced_boot_mode {
 #define BSEC_OTP_MAC	57
 #define BSEC_OTP_BOARD	59
 
-#endif /* __ASSEMBLY__*/
+#endif /* __ASSEMBLY__ */
 #endif /* _MACH_STM32_H_ */
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index 672617256e9..212a699c1b2 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -57,7 +57,7 @@ 
 
 #define MTRR_FIX_TYPE(t)	((t << 24) | (t << 16) | (t << 8) | t)
 
-#if !defined(__ASSEMBLER__)
+#if !defined(__ASSEMBLY__)
 
 /**
  * Information about the previous MTRR state, set up by mtrr_open()
diff --git a/arch/x86/include/asm/sipi.h b/arch/x86/include/asm/sipi.h
index 1ab6c2874a0..24834225287 100644
--- a/arch/x86/include/asm/sipi.h
+++ b/arch/x86/include/asm/sipi.h
@@ -10,7 +10,7 @@ 
 #define AP_DEFAULT_BASE 0x30000
 #define AP_DEFAULT_SIZE 0x10000
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 
 /**
  * struct sipi_params_16bit - 16-bit SIPI entry-point parameters
@@ -81,6 +81,6 @@  void ap_start(void);
 extern char sipi_params_16bit[];
 extern char sipi_params[];
 
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #endif
diff --git a/include/atf_common.h b/include/atf_common.h
index 3a7d40e5f09..fd5454c55b4 100644
--- a/include/atf_common.h
+++ b/include/atf_common.h
@@ -177,6 +177,6 @@  struct bl2_to_bl31_params_mem {
 	struct entry_point_info bl31_ep_info;
 };
 
-#endif /*__ASSEMBLY__*/
+#endif /*__ASSEMBLY__ */
 
 #endif /* __BL_COMMON_H__ */
diff --git a/include/elf.h b/include/elf.h
index e7c51986df8..b04e746d617 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -9,7 +9,7 @@ 
 #ifndef _ELF_H
 #define _ELF_H
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 #include "compiler.h"
 
 /* This version doesn't work for 64-bit ABIs - Erik */
@@ -690,7 +690,7 @@  unsigned long elf_hash(const unsigned char *name);
 #define R_RISCV_64		2
 #define R_RISCV_RELATIVE	3
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 int valid_elf_image(unsigned long addr);
 unsigned long load_elf64_image_phdr(unsigned long addr);
 unsigned long load_elf64_image_shdr(unsigned long addr);