On Wed, Mar 11, 2026 at 06:30:48PM +0900, Daniel Palmer wrote:
> Most m68k retro/homebrew machines will have limited flash/RAM
> so having LTO working would be nice.
> 
> Not many changes are need really. Most of this is copy/paste
> from the ARM32 version.
> 
> The major change is that the direct register usage of d7 for gd
> needs to be hidden so that when LTO passes over everything it
> doesn't see multiple instances of d7.
> 
> Signed-off-by: Daniel Palmer <[email protected]>
> ---
> 
> This is another patch from my vault that I have been using
> on various classic m68k machines for ages. I haven't tested
> it with coldfire though.
> 
>  arch/Kconfig                        |  1 +
>  arch/m68k/config.mk                 | 11 +++++++++--
>  arch/m68k/cpu/m680x0/cpu.c          |  2 +-
>  arch/m68k/include/asm/global_data.h | 19 +++++++++++++++++++
>  arch/m68k/lib/ashldi3.c             |  1 +
>  arch/m68k/lib/lshrdi3.c             |  1 +
>  arch/m68k/lib/muldi3.c              |  1 +
>  common/board_r.c                    |  4 ++--
>  common/init/board_init.c            |  2 +-
>  9 files changed, 36 insertions(+), 6 deletions(-)

...

> diff --git a/common/init/board_init.c b/common/init/board_init.c
> index 2a6f39f51adb..c56b33e7be7c 100644
> --- a/common/init/board_init.c
> +++ b/common/init/board_init.c
> @@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
>   * Unfortunately x86, ARM and RISC-V can't compile this code as gd is defined
>   * as macro and cannot be assigned.

This comment should probably be updated as well to reflect the code
behavior :)

>   */
> -#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_RISCV)
> +#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_RISCV) 
> && !defined(CONFIG_M68K)
>  __weak void arch_setup_gd(struct global_data *gd_ptr)
>  {
>       gd = gd_ptr;
> -- 
> 2.51.0
> 

Regards,
Yao Zi

Reply via email to