Re: [PATCH] MIPS: tools: fix build on macOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ryan,
what happened to that patch? I haven't found a discussion or that it was merged.

I have used it and it seems solve a cross-compilation issue (have to cross-chek if it is still the case with 5.13-rc7).

Maybe the maintainers did not become aware of?

BR and thanks,
Nikolaus Schaller

https://patchwork.kernel.org/project/linux-mips/patch/z_0h2JVlIGgyiySXEyOmFhJ5_rl_EmuXR7beRMunMZRivpcO0H7LqsGa6ePHdSTkF521jUnXMM9TZb5N9mM4fduiHAxpshUkCBd7Owo43tM=@protonmail.com/


> Am 14.02.2021 um 06:01 schrieb Ryan Burns <rtburns@xxxxxxxxxxxxxx>:
> 
> macOS does not have byteswap.h, but we can use Apple's libkern/OSByteOrder.h instead.
> 
> This issue is encountered during cross-compilation from macOS to MIPS in nixpkgs.
> You can view a log of the build failure here:
> https://hydra.nixos.org/build/136015790/nixlog/1
>    
> Signed-off-by: Ryan Burns <rtburns@xxxxxxxxxxxxxx>
> ---
> arch/mips/boot/tools/relocs.h      | 11 +++++++++--
> arch/mips/boot/tools/relocs_main.c |  1 -
> arch/mips/tools/elf-entry.c        | 11 +++++++++--
> 3 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/boot/tools/relocs.h b/arch/mips/boot/tools/relocs.h
> index 607ff0103064..5de9bb7a7e09 100644
> --- a/arch/mips/boot/tools/relocs.h
> +++ b/arch/mips/boot/tools/relocs.h
> @@ -11,9 +11,16 @@
> #include <errno.h>
> #include <unistd.h>
> #include <elf.h>
> -#include <byteswap.h>
> #define USE_BSD
> -#include <endian.h>
> +#if defined(__APPLE__)
> +# include <libkern/OSByteOrder.h>
> +# define bswap_16 OSSwapInt16
> +# define bswap_32 OSSwapInt32
> +# define bswap_64 OSSwapInt64
> +#else
> +# include <byteswap.h>
> +# include <endian.h>
> +#endif
> #include <regex.h>
> 
> void die(char *fmt, ...);
> diff --git a/arch/mips/boot/tools/relocs_main.c b/arch/mips/boot/tools/relocs_main.c
> index e2453a564b11..4ef51d1e6d0d 100644
> --- a/arch/mips/boot/tools/relocs_main.c
> +++ b/arch/mips/boot/tools/relocs_main.c
> @@ -6,7 +6,6 @@
> #include <stdlib.h>
> #include <string.h>
> #include <errno.h>
> -#include <endian.h>
> #include <elf.h>
> 
> #include "relocs.h"
> diff --git a/arch/mips/tools/elf-entry.c b/arch/mips/tools/elf-entry.c
> index dbd14ff05b4c..5d2e2ab4b3b0 100644
> --- a/arch/mips/tools/elf-entry.c
> +++ b/arch/mips/tools/elf-entry.c
> @@ -1,7 +1,14 @@
> // SPDX-License-Identifier: GPL-2.0
> -#include <byteswap.h>
> +#if defined(__APPLE__)
> +# include <libkern/OSByteOrder.h>
> +# define bswap_16 OSSwapInt16
> +# define bswap_32 OSSwapInt32
> +# define bswap_64 OSSwapInt64
> +#else
> +# include <byteswap.h>
> +# include <endian.h>
> +#endif
> #include <elf.h>
> -#include <endian.h>
> #include <inttypes.h>
> #include <stdint.h>
> #include <stdio.h>





[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux