You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/01/24 03:48:58 UTC

[GitHub] [incubator-nuttx] patacongo edited a comment on issue #131: Improve config

patacongo edited a comment on issue #131: Improve config
URL: https://github.com/apache/incubator-nuttx/pull/131#issuecomment-577979384
 
 
   _But it isn't consistent from your explanation:
   1.If size_t definition is provided by toolchain(either tool self or c library) and NuttX use that definition directly, it is impossible that what compiler want is different from NuttX provided._
   
   No,you are mistaken.  If you used the binaries inside the toolchain, they may use a differnt definition of size_t.  They do not include the NuttX sys/type.h.  That is built with some unknown, incompatible sys/type.h that is not accessible to NuttX.
   
   Those binararies were pre-built into the toolchain months before.
   
   Some C++ code is generated by the compiler that expects size_t to be unsigned int.
   
   _2.Only when size_t is provided by NuttX, it is possible that compiler internal prototype is different from NuttX provided. CONFIG_CXX_NEWLONG can help resolve this mismatch here._
   
   No, the definitions of the and delete operator in libs/libxx do not use size_t.  They use either unsigned int or unsigned long as determined by CONFIG_CXX_NEWLONG.
   
   Look, for example, in libs/libxx/libxx_delete_sized.cxx:
   
       #ifdef CONFIG_CXX_NEWLONG
       void operator delete(FAR void *ptr, unsigned long size)
       #else
       void operator delete(FAR void *ptr, unsigned int size)
       #endif
   
   So the definition of size_t is totally irrelevant and does not belong in this discussion.  The only factors are:
   
   - The setting of CONFIG_CXX_NEWLONG
   - The form of the delete operator call generated by the pre-built binary logic in the toolchain.
   
   For the case of pre-built binaries, the definition of size_t is irrelevant to this problem.  The ONLY solution is to use CONFIG_CXX_NEWLONG to force the operators in libs/libcxx to match the operators required by the generated C++ binaries.  Those must be made to match and can change for different compilers and for different architectures.
   
   We are not communicating and you apparently do not understand the problem properly.  It must be fixed for build testing by controlling CONFIG_CXX_NEWLONG so the the new and delete operations in libs/libxx match the mangled operators needed by the toolchain binaries.
   
   This fails because the configuration stm3240g-eval:knxwm has CONFIG_CXX_NEWLONG=y.  Therefore, libs/libxx_delete_sized.cxx generates this operator:
   
       void operator delete(FAR void *ptr, unsigned long size);
   
   But the code generated by the C++ compiler binary expects:
   
       void operator delete(FAR void *ptr, unsigned int size)
   
   That can ONLY be fixed for all cases by controlling the state of CONFIG_CXX_NEWLONG in testbuild.sh.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services