relocator oddity?

From: Kimura Fuyuki <fuyuki_at_nigredo.org>
Date: Thu, 12 Feb 2004 19:53:09 +0900
Someone please run the test below and tell me why dltest[12] show the
different results on my 5.2.1-RC2 box. At least NetBSD 1.5.2 and some
sort of Linux pass the test.

#!/bin/sh

cat <<[EOF] >shared.c
double sin(double d) {return 9;}
double faked_sin(double d) {return sin(d);}
[EOF]

cat <<[EOF] >dltest.c
#include <stdio.h>
#include <dlfcn.h>

int main(void)
{
	void *h;
	double (*faked_sin)(double);

	h = dlopen("./shared.so", RTLD_LAZY);
        faked_sin = dlsym(h, "faked_sin");
	printf("%f\n", faked_sin(0));
}
[EOF]

cc -shared -o shared.so shared.c

cc dltest.c -o dltest1
./dltest1 >result1

cc dltest.c -o dltest2 -lm
./dltest2 >result2

if diff result1 result2 >/dev/null; then
        echo "You are very talented."
else
	echo "Please tell me what's happening!"
fi

-- fuyuki
Received on Thu Feb 12 2004 - 01:53:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:42 UTC