-
Notifications
You must be signed in to change notification settings - Fork 949
IOS invalid memory access when calling _mi_process_init #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ouch :-( ah, the testing I have done on macOS has been limited to OSX on a macbook. Thanks for reporting this and I hope we can make it work well on iOS as well.
(a) Perhaps accessing a (dummy) thread local as the first thing in static mi_decl_thread uintptr_t dummy;
// Called once by the process loader
static void mi_process_load(void) {
mi_heap_main_init();
dummy = 1; // hopefully causes tcb to be initialized
#if defined(MI_TLS_RECURSE_GUARD)
... (b) If the above does not work, perhaps we need to just guard against res = (tcb==NULL ? NULL : tcb[slot]); and line 727 to if (tcb != NULL) tcb[slot] = value; (that last change may not be quite right but let's first find out if this is the root cause or not) Apologies if this is too much trouble, but I have no easy way myself to develop on iOS. Let me know how it goes if you are able to try it out. Thanks, Daan |
I saw your advice on #263
But both 3.1 and 3.2 do not work :( I also test But |
I close this issue to consolidate porting to iOS in #263 |
Uh oh!
There was an error while loading. Please reload this page.
I build an test app static link with the .a library. But the app crashes when calling _mi_process_init.
The backtrace is as below:
`(lldb) bt
_mi_process_init + 28 frame #1: 0x0000000100164a34 dyld
ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 468frame Return usable allocation size on allocation #2: 0x0000000100164e44 dyld
ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 56 frame #3: 0x000000010015f198 dyld
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 580frame WebAssembly support? #4: 0x000000010015d3c4 dyld
ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 192 frame #5: 0x000000010015d490 dyld
ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 96frame Windows CMake+Ninja build warning due to duplicate basename #6: 0x000000010014e744 dyld
dyld::initializeMainExecutable() + 220 frame #7: 0x00000001001531ec dyld
dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4588frame Readme contains invisible \u200b ZERO WIDTH SPACE, breaking URLs #8: 0x000000010014d22c dyld
dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 432 frame #9: 0x000000010014d038 dyld
_dyld_start + 56(lldb) `
I think mi_tls_slot does not work properly on IOS (arm64)
void** tcb; UNUSED(ofs); asm volatile ("mrs %0, tpidr_el0" : "=r" (tcb)); res = tcb[slot];
tcb equals NULL and this is the reason why it crashes.
Any idea how to fix it?
The text was updated successfully, but these errors were encountered: