It fails to build for linux with the current compiler flags:
- static builds:
gdraw.c: In function `grDrawTriangle':
gdraw.c:757: error: bp cannot be used in asm here
- shared lib (-fPIC) builds:
gdraw.c: In function `grDrawTriangle':
gdraw.c:731: error: PIC register `ebx' clobbered in `asm'
Only if I use '-DBIG_OPT -fomit-frame-pointer', _then_ it builds into:
00000a20 <grDrawTriangle>:
a20: a1 2c 00 00 00 mov 0x2c,%eax
a25: ff a0 50 03 00 00 jmp *0x350(%eax)
a2b: c3 ret
a2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
... which is good but only for static builds. The PIC build still
fails with the above message with my gcc3.4 or gcc4.x.
So, I moved the x86 dispatch code to a new xdrawtri.asm, for linux,
and even for MSVC without any prologue/epilogue like the following:
movl (_GlideRoot + curGC),%eax
jmp *kTriProcOffset(%eax)
Let's see how this goes.
this makes it more like the glide3x version, and fixes windows build
and linkage. only Watcom build is special-cased: don't know the reason
why it was adjusted that way in gdraw.c but I kept it that way for now.
Defining certain keywords in nasm makes it go haywire.
See, https://bugzilla.nasm.us/show_bug.cgi?id=3392505
$ cat 1.asm
%define TEXT _TEXT align=1 public use32 class=CODE FLAT
%define DATA _DATA align=4 public use32 class=DATA FLAT
%define CONST CONST2 align=4 public use32 class=DATA FLAT
segment TEXT
segment DATA
segment CONST
$ nasm -E 1.asm
%line 4+1 1.asm
[segment _TEXT align=1 public use32 class=CODE FLAT]
[segment _DATA align=4 public use32 class=_DATA align=4 public use32 class=DATA FLAT FLAT]
[segment CONST2 align=4 public use32 class=_DATA align=4 public use32 class=_DATA align=4 public use32 class=DATA FLAT FLAT FLAT]
Either this (with nasm-2.0..nasm-2.09.xx), or it errors out with:
1.asm:6: error: interminable macro recursion
1.asm:7: error: interminable macro recursion
... which happens with nasm-2.10.xx-nasm-2.13.01
The glide3 tree uses this for Watcom builds / obj output format,
and the result is not what is intended. After the renaming, it
works as expected:
$ cat 1.asm
%define SEG_TEXT _TEXT align=1 public use32 class=CODE FLAT
%define SEG_DATA _DATA align=4 public use32 class=DATA FLAT
%define SEG_CONST CONST2 align=4 public use32 class=DATA FLAT
segment SEG_TEXT
segment SEG_DATA
segment SEG_CONST
$ nasm -E 1.asm
%line 4+1 1.asm
[segment _TEXT align=1 public use32 class=CODE FLAT]
[segment _DATA align=4 public use32 class=DATA FLAT]
[segment CONST2 align=4 public use32 class=DATA FLAT]