File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,12 +27,14 @@ while [[ $# -gt 0 ]]; do
2727 -march=* |-mcpu=* )
2828 OPT_NAME=" ${1%% =* } "
2929 OPT_VALUE=" ${1#* =} "
30- # Skip armv8- flags entirely as Zig doesn't support them
31- if [[ " $OPT_VALUE " == armv8-* ]]; then
32- shift
33- continue
30+ # zig rejects -march=armv8-a but accepts -mcpu=generic+v8a; rewrite
31+ # armv<X>[.<Y>]-a[+feat] -> generic+v<X>[_<Y>]a[+feat] so it goes through.
32+ if [[ " $OPT_VALUE " =~ ^armv([89])(\. ([0-9]+))? -a(\+ .* )? $ ]]; then
33+ arch_feat=" v${BASH_REMATCH[1]} "
34+ [[ -n " ${BASH_REMATCH[3]} " ]] && arch_feat=" ${arch_feat} _${BASH_REMATCH[3]} "
35+ OPT_VALUE=" generic+${arch_feat} a${BASH_REMATCH[4]} "
3436 fi
35- # replace -march= x86-64 with -march= x86_64
37+ # zig uses snake_case in CPU/feature names ( x86-64 -> x86_64).
3638 OPT_VALUE=" ${OPT_VALUE// -/ _} "
3739 PARSED_ARGS+=(" ${OPT_NAME} =${OPT_VALUE} " )
3840 shift
You can’t perform that action at this time.
0 commit comments