Gareth Hughes wrote:
Here's a sample app and library that uses a couple of __thread variables in a manner similar to OpenGL. I'd appreciate it if someone could take a look and explain what I'm doing incorrectly, as I've declared the variables as LE and yet seem to be getting IE. Note that I'm away from home and don't have a system that I can actually run this app on, so it may very well be completely broken. Thanks!
From what I can see, you are actually getting LE model code
(omitting the ebp stuff which you can avoid using -fomit-frame-pointer):
movl %gs:0, %eax movl __foo_dispatch@NTPOFF(%eax), %edx movl (%edx), %ecx jmp *%ecx
Note that NTPOFF is used; for IE, you'd see INDNTPOFF or GOTNTPOFF and an additional indirection.
Your source code says:
* Should be able to be reduced to: * movl %gs:__foo_dispatch@ntpoff, %eax * jmpl *(%eax)
but that's not really a different model, just another way of accessing LE model variables. This is simply not implemented in the current gcc i386 backend (yet?).
If this actually makes any noticable difference in performance, I guess you should ask the i386 gcc folks to implement it. If you are generating the code yourself, that doesn't matter anyway.
Bye, Ulrich