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

Vanessa McHale v@mch@|e @end|ng |rom gm@||@com
Wed Feb 22 23:05:59 CET 2023


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!|
|
Thanks!
Vanessa McHale|
|

	[[alternative HTML version deleted]]



More information about the R-devel mailing list