xiaoxiang781216 commented on code in PR #20530:
URL: https://github.com/apache/nuttx/pull/20530#discussion_r4469561791
##########
tools/mkexport.sh:
##########
@@ -597,6 +597,16 @@ if [ "${NUTTX_BUILD}" = "kernel" ]; then
CCLIBS="${CCLIBS} m"
fi
CCLIBS="${CCLIBS} gcc"
+
+ # libc has the POSIX threads, real-time and dynamic loading functions.
+ # Empty libraries let programs link with -lpthread, -lrt and -ldl, as
Review Comment:
if so, why do we need remove pthread from command line in the second patch
##########
tools/mkexport.sh:
##########
@@ -539,6 +539,89 @@ cp -f "${TOPDIR}/tools/link.sh" "${EXPORTDIR}/tools/"
cp -f "${TOPDIR}/tools/unlink.bat" "${EXPORTDIR}/tools/"
cp -f "${TOPDIR}/tools/unlink.sh" "${EXPORTDIR}/tools/"
+# Install the compiler wrapper for programs built outside the tree, and the
+# flags it needs. Warning options are left out: they are this tree's policy
+# (-Werror), not part of the ABI. -Wa, -Wl and -Wp pass options on and stay.
+# Paths into this tree (some boards put crt0.o in LDELFFLAGS) are left out:
+# they do not exist where the package is used, and the wrapper adds the
+# exported crt0.o itself.
+
+noWarnings() {
+ for flag in $1; do
+ case ${flag} in
+ -Wa,* | -Wl,* | -Wp,*) printf '%s ' "${flag}" ;;
+ -W*) ;;
+ *) printf '%s ' "${flag}" ;;
+ esac
+ done
+}
+
+noTreePaths() {
+ for flag in $1; do
+ case ${flag} in
+ "${TOPDIR}"/*) ;;
+ *) printf '%s ' "${flag}" ;;
+ esac
+ done
+}
+
+isSet() {
+ grep -q "^$1=y" "${TOPDIR}/.config"
+}
+
+CCDEFINES="-D__NuttX__"
+if isSet CONFIG_NDEBUG; then
+ CCDEFINES="${CCDEFINES} -DNDEBUG"
+fi
+
+CCXXINCDIRS=
+if isSet CONFIG_LIBCXX; then
+ CCXXINCDIRS="libcxx"
+elif isSet CONFIG_UCLIBCXX; then
+ CCXXINCDIRS="uClibc++"
+fi
+CCXXINCDIRS="${CCXXINCDIRS} cxx"
+
+CCLIBS=
+CCNOUNDEF=n
+if [ "${NUTTX_BUILD}" = "kernel" ]; then
+ CCNOUNDEF=y
+ if isSet CONFIG_NX; then
+ CCLIBS="nx"
+ fi
+ CCLIBS="${CCLIBS} mm c proxies"
+ if isSet CONFIG_HAVE_CXX; then
+ CCLIBS="${CCLIBS} xx"
+ fi
+ if [ -f "${EXPORTDIR}/libs/libm${LIBEXT}" ]; then
+ CCLIBS="${CCLIBS} m"
+ fi
+ CCLIBS="${CCLIBS} gcc"
+fi
+
+CCLDSCRIPT=
+if [ -f "${EXPORTDIR}/scripts/${APPLD}" ]; then
+ CCLDSCRIPT=${APPLD}
+fi
+
+{
+ echo "NUTTXCC_CC='${CC}'"
+ echo "NUTTXCC_CXX='${CXX}'"
Review Comment:
why not change NUTTXCC_ to NUTTX_
##########
tools/mkexport.sh:
##########
@@ -539,6 +539,89 @@ cp -f "${TOPDIR}/tools/link.sh" "${EXPORTDIR}/tools/"
cp -f "${TOPDIR}/tools/unlink.bat" "${EXPORTDIR}/tools/"
cp -f "${TOPDIR}/tools/unlink.sh" "${EXPORTDIR}/tools/"
+# Install the compiler wrapper for programs built outside the tree, and the
+# flags it needs. Warning options are left out: they are this tree's policy
+# (-Werror), not part of the ABI. -Wa, -Wl and -Wp pass options on and stay.
+# Paths into this tree (some boards put crt0.o in LDELFFLAGS) are left out:
+# they do not exist where the package is used, and the wrapper adds the
+# exported crt0.o itself.
+
+noWarnings() {
+ for flag in $1; do
+ case ${flag} in
+ -Wa,* | -Wl,* | -Wp,*) printf '%s ' "${flag}" ;;
+ -W*) ;;
+ *) printf '%s ' "${flag}" ;;
+ esac
+ done
+}
+
+noTreePaths() {
+ for flag in $1; do
+ case ${flag} in
+ "${TOPDIR}"/*) ;;
+ *) printf '%s ' "${flag}" ;;
+ esac
+ done
+}
+
+isSet() {
+ grep -q "^$1=y" "${TOPDIR}/.config"
+}
+
+CCDEFINES="-D__NuttX__"
+if isSet CONFIG_NDEBUG; then
+ CCDEFINES="${CCDEFINES} -DNDEBUG"
+fi
+
+CCXXINCDIRS=
+if isSet CONFIG_LIBCXX; then
+ CCXXINCDIRS="libcxx"
+elif isSet CONFIG_UCLIBCXX; then
+ CCXXINCDIRS="uClibc++"
+fi
+CCXXINCDIRS="${CCXXINCDIRS} cxx"
+
+CCLIBS=
+CCNOUNDEF=n
+if [ "${NUTTX_BUILD}" = "kernel" ]; then
+ CCNOUNDEF=y
+ if isSet CONFIG_NX; then
+ CCLIBS="nx"
+ fi
+ CCLIBS="${CCLIBS} mm c proxies"
+ if isSet CONFIG_HAVE_CXX; then
+ CCLIBS="${CCLIBS} xx"
+ fi
+ if [ -f "${EXPORTDIR}/libs/libm${LIBEXT}" ]; then
+ CCLIBS="${CCLIBS} m"
+ fi
+ CCLIBS="${CCLIBS} gcc"
+fi
+
+CCLDSCRIPT=
+if [ -f "${EXPORTDIR}/scripts/${APPLD}" ]; then
+ CCLDSCRIPT=${APPLD}
+fi
+
+{
+ echo "NUTTXCC_CC='${CC}'"
Review Comment:
` echo "NUTTX_CC?='${CC}'"` and remove the replacement at
https://github.com/apache/nuttx/pull/20530/changes/6b6a677f0093b74f03595bb6cefa9de70dcb469b#diff-b5654b6aeb3d82f372b27a0f62c5e70434bca6a9fc754a8d26fa03120d2c2bf1R60
##########
tools/mkexport.sh:
##########
@@ -539,6 +539,89 @@ cp -f "${TOPDIR}/tools/link.sh" "${EXPORTDIR}/tools/"
cp -f "${TOPDIR}/tools/unlink.bat" "${EXPORTDIR}/tools/"
cp -f "${TOPDIR}/tools/unlink.sh" "${EXPORTDIR}/tools/"
+# Install the compiler wrapper for programs built outside the tree, and the
+# flags it needs. Warning options are left out: they are this tree's policy
+# (-Werror), not part of the ABI. -Wa, -Wl and -Wp pass options on and stay.
+# Paths into this tree (some boards put crt0.o in LDELFFLAGS) are left out:
+# they do not exist where the package is used, and the wrapper adds the
+# exported crt0.o itself.
+
+noWarnings() {
+ for flag in $1; do
+ case ${flag} in
+ -Wa,* | -Wl,* | -Wp,*) printf '%s ' "${flag}" ;;
+ -W*) ;;
+ *) printf '%s ' "${flag}" ;;
+ esac
+ done
+}
+
+noTreePaths() {
+ for flag in $1; do
+ case ${flag} in
+ "${TOPDIR}"/*) ;;
+ *) printf '%s ' "${flag}" ;;
+ esac
+ done
+}
+
+isSet() {
+ grep -q "^$1=y" "${TOPDIR}/.config"
+}
+
+CCDEFINES="-D__NuttX__"
+if isSet CONFIG_NDEBUG; then
+ CCDEFINES="${CCDEFINES} -DNDEBUG"
+fi
+
+CCXXINCDIRS=
+if isSet CONFIG_LIBCXX; then
+ CCXXINCDIRS="libcxx"
+elif isSet CONFIG_UCLIBCXX; then
+ CCXXINCDIRS="uClibc++"
+fi
+CCXXINCDIRS="${CCXXINCDIRS} cxx"
Review Comment:
why add cxx for libcxx/uClibc++ case
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]