I am porting xv6 from GCC to Clang, and met the following error message:
clang -m32 -gdwarf-2 -Wa,-divide -c -o swtch.o swtch.S
clang-3.8: error: unsupported argument '-divide' to option 'Wa,'
Note that -Wa
is used to pass arguments to the assembler, and I couldn't figure out what is the -divide
option.
As a fix, currently I switched off the integrated assembler by passing the no-integrated-as
option to Clang. But I want to use Clang's integrated assember. Is it safe to ignore this option? Or is there an alternative way to give that option to Clang?
The gas manual documentation for --divide
says:
On SVR4-derived platforms, the character
/
is treated as a comment character, which means that it cannot be used in expressions. The--divide
option turns/
into a normal character. This does not disable/
at the beginning of a line starting a comment, or affect using `#' for starting a comment.
On my Linux desktop, --divide
does nothing: as
assembles mov $(15/2), %eax
just fine with or without --divide
.
So you should be fine to take it out. If it's a problem and clang does treat /
as a comment character on some platforms, it should usually result in build-time failure, not binaries with hidden bugs.
And yes, -divide
apparently does the same thing as --divide
. But you might want to try --divide
in case clang's assembler only supports the more-standard double--
form.