On 2015-11-08 19:12, bitwise wrote:
So, since binaries will not be mapped to overlapping address spaces, I
can loop over all the binary images and find the range to which the
argument of ___tls_get_addr() belongs, and map the pointer to the
appropriate block of memory.
I am concerned that looping over all binary images for each TLS access
will have performance implications, but for now, this solution is good
enough. Later, ___tls_get_addr() can be amended to pass a pointer to the
image from which the TLS originated, allowing constant time lookup. I
believe Martin has already done this for linux/fbsd, but I had time to
look at this specific issue.
Not sure if this would be too much work for the first version. But would
it be possible to, for each loaded image, register its memory range in
an associative array. Where the key is the range the value is the image?
Hmm, when I think about, it might not help at all.
--
/Jacob Carlborg