# Authors:
# Ian Romanick <idr@us.ibm.com>
-import gl_XML, license
+import license
+import gl_XML, glX_XML
import sys, getopt, copy
def should_use_push(registers):
print "/* If we build with gcc's -fvisibility=hidden flag, we'll need to change"
print " * the symbol visibility mode to 'default'."
print ' */'
+ print ''
+ print '#include "../x86/assyntax.h"'
+ print ''
print '#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303'
print '# pragma GCC visibility push(default)'
print '# define HIDDEN(x) .hidden x'
print '# define HIDDEN(x)'
print '#endif'
print ''
+ print '# if defined(USE_MGL_NAMESPACE)'
+ print '# define GL_PREFIX(n) GLNAME(CONCAT(mgl,n))'
+ print '# define _glapi_Dispatch _mglapi_Dispatch'
+ print '# else'
+ print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
+ print '# endif'
+ print ''
print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
print '# define THREADS'
print '#endif'
print ''
print '\t.p2align\t4,,15'
print '_x86_64_get_dispatch:'
- print '\tmovq\t_glapi_tls_Disaptch@GOTTPOFF(%rip), %rax'
+ print '\tmovq\t_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax'
print '\tmovq\t%fs:(%rax), %rax'
print '\tret'
print '\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch'
print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
print '3: .p2align 2 /* pad out section */'
print '#endif /* GLX_USE_TLS */'
+ print ''
+ print '#if defined (__ELF__) && defined (__linux__)'
+ print ' .section .note.GNU-stack,"",%progbits'
+ print '#endif'
return
registers.append( ["%rbp", 0] )
+ name = f.dispatch_name()
+
print '\t.p2align\t4,,15'
- print '\t.globl\tgl%s' % (f.name)
- print '\t.type\tgl%s, @function' % (f.name)
- print 'gl%s:' % (f.name)
+ print '\t.globl\tGL_PREFIX(%s)' % (name)
+ print '\t.type\tGL_PREFIX(%s), @function' % (name)
+ if not f.is_static_entry_point(f.name):
+ print '\tHIDDEN(GL_PREFIX(%s))' % (name)
+ print 'GL_PREFIX(%s):' % (name)
print '#if defined(GLX_USE_TLS)'
print '\tcall\t_x86_64_get_dispatch@PLT'
print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
print '\tjmp\t*%r11'
print '#else'
- print '\tmovq\t_glapi_DispatchTSD(%rip), %rax'
+ print '\tmovq\t_glapi_Dispatch(%rip), %rax'
print '\ttestq\t%rax, %rax'
print '\tje\t1f'
print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
print '\tjmp\t*%r11'
print '#endif /* defined(GLX_USE_TLS) */'
- print '\t.size\tgl%s, .-gl%s' % (f.name, f.name)
+ print '\t.size\tGL_PREFIX(%s), .-GL_PREFIX(%s)' % (name, name)
print ''
return
for f in api.functionIterateByOffset():
+ dispatch = f.dispatch_name()
for n in f.entry_points:
if n != f.name:
- print '\t.globl gl%s ; .set gl%s, gl%s' % (n, n, f.name)
+ if f.is_static_entry_point(n):
+ text = '\t.globl GL_PREFIX(%s) ; .set GL_PREFIX(%s), GL_PREFIX(%s)' % (n, n, dispatch)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
return
print "ERROR: Invalid mode \"%s\" specified." % mode
show_usage()
- api = gl_XML.parse_GL_API( file_name )
-
- printer.Print( api )
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer.Print(api)