First post, by TeaRex
The following small patch makes it possible to compile DOSBox under GCC with link-time optimization without hitting compilation errors regarding duplicate labels, caused by including the FPU assembly code several times (for the several cores). It does that by using GCC's local label feature.
Of its own it doesn't enable -flto though, you have to do that yourself. If -flto is not enabled, it changes nothing. If it is enabled though, your DOSBox becomes noticeably faster, at least it does on my Core2Quad Linux system.
--- src/fpu/fpu_instructions_x86.h (revision 3798)
+++ src/fpu/fpu_instructions_x86.h (working copy)
@@ -660,9 +660,9 @@
"fstpt (%2, %%eax) \n" \
"movw %0, %%ax \n" \
"sahf \n" \
- "jp argument_too_large1 \n" \
+ "jp 1f \n" \
"fstpt (%2, %1) \n" \
- "argument_too_large1: " \
+ "1: " \
: "=m" (new_sw) \
: "r" (TOP), "r" (fpu.p_regs) \
: "eax", "cc", "memory" \
@@ -686,9 +686,9 @@
"fstpt (%2, %%eax) \n" \
"movw %0, %%ax \n" \
"sahf \n" \
- "jp argument_too_large2 \n" \
+ "jp 1f \n" \
"fstpt (%2, %1) \n" \
- "argument_too_large2: " \
+ "1: " \
: "=m" (new_sw) \
: "r" (TOP), "r" (fpu.p_regs) \
: "eax", "cc", "memory" \
[/code]
tearex