Problem running JITted functions from x86_64 inside a dynamic library?

I found that on my system:
$ uname -a
Linux tintoretto #1 SMP Fri Nov 23 17:07:39 CET 2007 x86_64
Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz GNU/Linux
$ cat /etc/redhat-release
Mandriva Linux release 2008.0 (Official) for x86_64

I can't execute functions Jitted by LLVM that call back functions in
the main program, if the jit is run from a .so library.
I replaced LLVM with an hand made jit, and after tinkering with it, I
found that I had to use special flags (MAP_32BIT) into mmap to get a
segment of memory "near to the code" enough so that calls with 32 bit
displacements jumped to the right address
    cur_segm=mmap (0, segm_size, PROT_READ|PROT_WRITE|PROT_EXEC,

Strangely, this problem happened only when loading the jit as .so and
not if linking it to the main executable (the main executable is
'perl' in my test case, as I'm working on jitting perl opcodes from a