Search code examples
optimizationclangcompiler-flags

Why GCC option -Os is not used during compilation?


Clang warns me,

clang: warning: argument unused during compilation: '-Os'

During compile with make. Why it doesn't accept the optimization flag?


Solution

  • -Os isn't a valid optimization option for (most) clang - it's not completely flag-compatible with GCC.

    The clang man page is authoritative on what options your particular version accepts (specifically, optimizing by size is not yet a primary concern for LLVM). Apple has pushed back patches for -Os and -Oz, but most packages don't include these updates.