https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95712
--- Comment #24 from Alexander Egorenkov <egorenar at linux dot ibm.com> --- I finally figured it out and fixed buildroot. This info is for posterity, in case somebody will have the same issue. If i understood it correctly, then the problem was that buildroot wrongly tried to build a native compiler on s390x host for s390 target instead of a cross-compiler due to a problem is config.sub which is fixed by this path: @@ -1138,14 +1138,6 @@ case $cpu-$vendor in cpu=nsx vendor=tandem ;; - s390-*) - cpu=s390 - vendor=ibm - ;; - s390x-*) - cpu=s390x - vendor=ibm - ;; tile*-*) os=${os:-linux-gnu} ;; @@ -1229,6 +1221,7 @@ case $cpu-$vendor in | pyramid \ | riscv | riscv32 | riscv64 \ | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ | score \ | sh | shl \ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ After fixing config.sub everything builds just fine and works great :) I'm going to try to submit this fix to the config mailing list. Best regard & thank you