casaroli commented on code in PR #20530:
URL: https://github.com/apache/nuttx/pull/20530#discussion_r4470808981
##########
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:
Done.
##########
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:
Done.
##########
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:
Done.
##########
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:
-pthread and -lpthread differ. aarch64-none-elf-gcc, arm-none-eabi-gcc and
riscv-none-elf-gcc all fail on -pthread with `unrecognized command-line
option`, so the wrapper must drop it; the empty library is for -lpthread.
--
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]