Closed jg1uaa closed 7 months ago
Reproduced in Clang 17.0.6. Weird. It works just fine in current versions of GCC.
@akumanatt can you help investigate? Do you think it might be a Clang bug?
In the meantime, I'll add a flag to force-disable the inline ASM optimizations so that you can at least compile the code on current Clang.
@jg1uaa Flag added in version v1.2.4: https://github.com/Kagamiin/ESFMu/releases/tag/v1.2.4
To use, compile with -D_ESFMU_DISABLE_ASM_OPTIMIZATIONS
.
Nonetheless, we'll investigate and try to get the issue fixed, as the ASM optimizations reduce the CPU usage of ESFMu by almost 25%, which can help a lot in an emulator like DOSBox-X, especially when running in native mode where it uses the most amount of CPU.
Apparently Clang 15 changed how pointers are resolved into offsets and made both logsinrom
and exprom
require a unique register even though I gave constraints to them as a memory operand that usually resolves to a stack offset. I fixed this by manually storing them as memory address integers before being used by the asm part.
Not sure how it failed in Clang 14 though.
Thanks for quickly support! There is no problem with clang-14.
uaa@emeraude:~/ESFMu$ clang-13 -m32 -c esfm.c -o /dev/null
uaa@emeraude:~/ESFMu$ clang-14 -m32 -c esfm.c -o /dev/null
uaa@emeraude:~/ESFMu$ clang-15 -m32 -c esfm.c -o /dev/null
uaa@emeraude:~/ESFMu$ clang-16 -m32 -c esfm.c -o /dev/null
uaa@emeraude:~/ESFMu$
DOSBox-X 2024.03.01 uses ESFMu v1.2.3 and I received a report about build failure on OpenBSD-current/i386.
I tested building ESFMu with clang-13 to 16, only clang-13 can build ESFMu (Slackware-15.0/i686 have clang-13).
Here is 32bit code build test result on Debian-12/amd64.
I have no idea to fix this, so simply report this as issue.