mp_off_t in dynamic native modules
#17298
Unanswered
dubiousjim
asked this question in
Core Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When building a dynamic native module (natmod, loadable native code in a
.mpyfile), the example make process creates a file${modulename}.config.houtput bympy_ld.py --preprocess; this file is then included inmpconfig.hvia the macroMP_CONFIGFILE.The
mpy_ld.py --preprocesscall always outputs the line:This is dubious for a number of reasons.
First, the system's
off_tis a signed value, and so too when I build my port (ports/unix/variants/standard), thempconfigport.hfile also uses a signed value (eitherlong longorlong). But here an unsigned value is used. This could change the semantics (though in practice it might not matter, I'd rather not blindly trust my compiler to be cooperative here).Second, although my port does check whether it's appropriate to use a
long long, depending on the macro_FILE_OFFSET_BITS,mpy_ld.pydoes not. So it could easily happen, on a 32 bit system, that the port treatsmp_off_tas 64 bits, but the dynamic native module treats it as 32 bits.To fix the
mpy-ld.pyissue, I'm considering adding an argument to this tool that will enable overriding the setting ofmp_off_t. But wanted to ask about what's happening here before making the trouble (for myself and others) of a pull request.Beta Was this translation helpful? Give feedback.
All reactions