if ab_match_arch loongson3; then
    abinfo "Tweaking Loongson3 flags ..."
    export CFLAGS="${CFLAGS} -mabi=64 -mrelax-pic-calls"
    export CXXFLAGS="${CXXFLAGS} -mabi=64 -mrelax-pic-calls"
fi

if ab_match_arch ppc64el; then
    abinfo "Dropping -mpower8-vector flag (some components specify -mno-vsx) ..."
    export CFLAGS="${CFLAGS/-mpower8-vector/}"
    export CXXFLAGS="${CXXFLAGS/-mpower8-vector/}"
fi

abinfo "Dropping -ffunction-sections, -fdata-sections, --gc-sections flags to fix build ..."
export CFLAGS="${CFLAGS/-ffunction-sections -fdata-sections/}"
export LDFLAGS="${LDFLAGS/-Wl,--gc-sections/}"

if ab_match_arch m68k; then
    abinfo "FIXME: Some flags breaks build, using minimal flag set ..."
    export CFLAGS="-O2 -ggdb"
    export LDFLAGS="-Wl,-build-id=sha1"
fi

if ab_match_archgroup 32bit; then
    abinfo "Unsetting _FILE_OFFSET_BITS and _TIME_BITS to fix build ..."
    export CPPFLAGS="${CPPFLAGS/-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64/}"
fi
