Skip to content
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

__wasilibc_init_preopen not getting called at startup #73

Closed
OhadRau opened this issue Jun 4, 2019 · 2 comments
Closed

__wasilibc_init_preopen not getting called at startup #73

OhadRau opened this issue Jun 4, 2019 · 2 comments

Comments

@OhadRau
Copy link

OhadRau commented Jun 4, 2019

Was encountering an assertion failure in fopen() and managed to trace it down to get_shared_map() where assert(global_map) would always fail. It seems like __wasilibc_init_preopen never initializes the global_map here causing get_shared_map (and by extension fopen) to always fail. As a quick fix, simply calling the init procedure when the global_map is NULL will work.

@sbc100
Copy link
Member

sbc100 commented Jun 4, 2019

__wasilibc_init_preopen is called unconditionally during _start which is defined in libc-bottom-half/crt/crt1.c.

Are you somehow not using (or not calling) the normal crt1.c start function?

@OhadRau
Copy link
Author

OhadRau commented Jun 4, 2019

Interesting, looks like _start was indeed not being called based on how I linked the file unless I explicitly added --entry=main to the wasm-ld flags. Thanks!

@OhadRau OhadRau closed this as completed Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants