Hi all,
I’m trying to determine if some code in DynamicLoaderPOSIXDYLD is correct and I could use some confirmation:
The code in question reads the module id of a module as part of finding the TLS block associated with that module, by determining its location and then reading with a hardcoded 32-bit unsigned read. (The code in question is source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp, in DynamicLoaderPOSIXDYLD::GetThreadLocalData).
I’ve read http://dev.gentoo.org/~dberkholz/articles/toolchain/tls.pdf , which describes a number of architectures and in all cases the value seems to be either size_t or “unsigned long int”. Thus the code appears to be wrong in at least some cases, in that it should be reading 64 bits when debugging 64-bit runtimes. The code presumably works today for 64-bit LSB (little-endian) systems (which is most of the 64-bit Linuxes) because it’s reading the right 32-bits out of the 64-bit location.
But I’m not 100% sure, because
- I’m not sure that the referenced pdf is definitive
- I don’t have an MSB 64-bit system to test on to verify that it’s a bug.
Can anyone with any familiarity with this issue comment on this?
Thanks,
Steve