This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: new runtime pseudo-reloc in cygwin 1.3.18
- From: Alexander Gottwald <Alexander dot Gottwald at s1999 dot tu-chemnitz dot de>
- To: cygwin-xfree at cygwin dot com
- Date: Tue, 31 Dec 2002 02:18:41 +0100 (MET)
- Subject: Re: new runtime pseudo-reloc in cygwin 1.3.18
- Reply-to: cygwin-xfree at cygwin dot com
Alexander Gottwald wrote:
> So I don't even know where _XtInherit is called and whats different with the
> relocation.
gdb revealed:
Dll1 (libXt) defines void _XtInherit(). Dll2 (libXaw) uses _XtInherit and
passes it to a function in libXt which does
if (x == _XtInherit) { foo() };
Unfortunatly it is not the same if _XtInherit is used in libXt or libXaw.
the statement x = _XtInherit for example resulted in
x = 0xb38478 for libXt and
x = 0x641550 for libXaw. And thats why the if condition failed.
A simple testcase is:
test.h:
typedef void (*f)(void);
extern f _foo(void);
extern void foo(void);
//#define foo _foo()
extern void test(void (*func)(void));
extern void run1(void);
extern void run2(void);
dll1.c:
#include "test.h"
#include <stdio.h>
#undef foo
f _foo(void) {
return foo;
}
void foo(void) {
printf("Error\n");
}
void test(void (*func)(void)) {
if (func != foo)
func();
else
printf("skipped\n");
}
void run1() {
test(foo);
}
dll2.c:
#include "test.h"
void run2(void) {
test(foo);
}
test.c:
#include "test.h"
#include <stdio.h>
int main(int argc, char ** argv) {
printf("run1\n");
run1();
printf("run2\n");
run2();
return 0;
}
build (cygwin):
$ gcc -shared -out-implib=dll1.a -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc -o dll1.dll dll1.c
$ gcc -shared -out-implib=dll2.a -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc -o dll2.dll dll2.c dll1.a
$ gcc test.c dll1.a dll2.a -o test.exe
$ ./test.exe
run1
skipped
run2
Error
build (linux):
$ gcc dll1.c -shared -o dll1.so
$ gcc dll2.c -shared -o dll2.so
$ gcc test.c dll1.so dll2.so -o test
$ LD_LIBRARY_PATH=. ./test
run1
skipped
run2
skipped
Enabling the define in test.h returns to the correct behaviour. I'll try
tomorrow if I can change the XtInheritXXX defines to function calls and
bypass these problems.
bye
ago
NP: VNV Nation - Joy
--
Alexander.Gottwald@informatik.tu-chemnitz.de
http://www.gotti.org ICQ: 126018723