Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get native CFLAGS for your host device. This will list the flags that are enabled on your hardware that are not enabled on the parent arch.
#!/usr/bin/env bash
# License: AGPLv3
export arch="${1:-skylake}"
diff \
<(gcc -march=native -mtune=native -Q --help=target) \
<(gcc -march=$arch -Q --help=target) \
| grep "<" \
| grep "enabled" \
| col2 \
| while read flag; do
echo -n "$flag "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment