[Rd] dyn.load loads libraries/symbols at high addresses.

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Feb 23 09:48:21 CET 2023


On 2/22/23 23:05, Vanessa McHale wrote:
> Hello all,
>
> I am trying to write an interface for BQN
> <https://mlochbaum.github.io/BQN/> and R
>
> However, even
> |
> dyn.load("/usr/local/lib/libcbqn.so"); .Call("bqn_init")|
>
> immediately fails on the BQN side, viz.
>
> |Failed to allocate memory for JIT 200 times; stopping trying||
> ||CBQN interpreter entered unexpected state, exiting.
>
> |This is because BQN tries to allocate memory for a JIT near itself and
> also in the lower 32 bits.|
>
> u64 near = (u64)&bqn_exec;
> u64 MAX_DIST = 1ULL<<30;
> mmap(NULL, sz, PROT_READ|PROT_WRITE|PROT_EXEC,
> MAP_NORESERVE|MAP_PRIVATE|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
>
> |However, |&bqn_exec| seems to be 0x7...||i.e. libcbqn.so is being
> loaded to a high address. Why is this? Is there some way to request that
> it and its symbols be loaded to lower addresses? I have never had this
> happen when using dlopen and dlsym!|

R doesn't do anything special here, it uses also dlopen() and dlsym() on 
Unix systems. I am not aware of a portable way to influence where the 
library gets loaded at OS level, and certainly there is no such way in R.

Best
Tomas

> |
> Thanks!
> Vanessa McHale|
> |
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list