http://bugs.winehq.org/show_bug.cgi?id=10273
--- Comment #16 from Peter Beutner p.beutner@gmx.net 2007-11-05 13:11:12 --- (In reply to comment #13)
I played a bit with linker flags and it seems -shared always pulls in startup object files first (despite the argument placement) ... the wine object file with PE section header follows as first visible argument, usually <dllname>-<tempname>.spec.o
You can change the order as I found out today. Pass -nostartfiles to gcc and it won't link against those crt*.o files itself and you can specify them on the cmdline in the order you need, i.e. after the *.spec.o file. That seems to work as the pe header now is the first thing in the .text section. But same as AJ's hack it isn't sufficient to please safedisc :(.
(In reply to comment #15)
So the get_pc_thunk.bx() location problem was only one reason.
And the location obviously wasn't even a real problem as that test(c3) did pass before already. And changing the location produces even worse c2 results for gdi32. So it seems it is the fact that there is a call at all in these first 8 instructions that safedisc considers "bad". Or does compiling without -fPIC does change something else that might be tested by safedisc?
Just dropping -fPIC would be really the easiest solution. Crawling through the safedisc code and find out how exactly these tests work isn't exactly fun :(