Skip to content
  • alpine-mips-patches's avatar
    main/xfsprogs: fix build on mips* and ppc64le · b0c083a3
    alpine-mips-patches authored
    musl-1.1.20 implements support (or lack thereof) for the MAP_SYNC flag by #define'ing
    it uncoditionally in generic <sys/mman.h> then #undef'ining optionally in arch-specific
    <bits/mman.h> (e.g. for mips* and powerpc*). So io/mmap.c fails to compile since it
    includes <sys/mman.h> (which undefines MAP_SYNC on mips* and powerpc*) after "linux.h"
    (which either defines fallback MAP_SYNC values or pulls <asm-generic/mman{-common.h}>).
    
    The proposes patch also fixes the flawed MAP_SYNC detection logic in the configure script
    because io/mmap.c always uses the MAP_SYNC definition (either real one or zero fallback).
    Otherwise xfsprogs wrongly detects the MAP_SYNC presence on mips* and ppc64le and the code
    does not define MAP_SYNC fallback so io/mmap.c still fails to compile.
    
    Note the last (2018-07-11) successful xfsprogs build for ppc64le was against musl-1.1.19
    (without any support for MAP_SYNC).
    
    The problem with MAP_SYNC detection is as follows. The configure script checks only
    <asm-generic/mman{-common}.h> headers for the MAP_SYNC definition instead of using
    the arch-specific <asm/mman.h>. But some architectures (mips, powerpc, parisc) do not
    support the MAP_SYNC feature at all, do not use the <asm-generic/mman{-common.h}> files
    and do not define the flag in the corresponding <asm/mman.h> header.
    b0c083a3