I'm trying build tinymembench with clang and am hitting errors on the assembly code. I can fix the easy ones (remove .func/.endfunc's) but the 'ambiguous operand size for instruction' errors on add and sub surpass my minimal assembly skills. I posted an issue on the repo but it's possible it's no longer being maintained.
Using this source file (removes the .func/.endfunc) I get errors like:
$ clang-8 x86-sse2.S /tmp/x86-sse2-dbaa71.s:86:9: error: ambiguous operand size for instruction 'add' add SRC, 64 ^~~ /tmp/x86-sse2-dbaa71.s:87:9: error: ambiguous operand size for instruction 'add' add DST, 64 ^~~ /tmp/x86-sse2-dbaa71.s:88:9: error: ambiguous operand size for instruction 'sub' sub SIZE, 64 ^~~~ ...
I looked at this answer which looks similar, but I wasn't able to translate it into an answer for these instructions.
I can fix the easy ones (remove .func/.endfunc's)
The .func
macro includes a .set SRC, rsi
which defines registers according to the appropriate calling convention (x86-64 System V, Windows x64, or 32-bit with stack args).
Removing it leaves just an undefined SRC
symbol which of course is treated as a memory operand. (And add mem, imm
doesn't have either operand implying an operand-size, so it's ambiguous.)
Your "fix" introduced this bug.
Use clang -no-integrated-as
to use the system assembler instead of clang's built-in assembler. As expected, that builds https://github.com/letrout/tinymembench/blob/master/x86-sse2.S just fine on my Linux desktop with clang7.0.1. (And system assembler = GNU Binutils as
2.31.1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.