Skip to content

Commit

Permalink
tools: Export LLVM flags for kernel build
Browse files Browse the repository at this point in the history
Summary:
- Added LLVM_ARCHTYPE, LLVM_CPUTYPE, and LLVM_ABITYPE to the exported build configuration in both `Export.mk` and `mkexport.sh`
- These flags are now included in the generated `makeinfo.sh`, `Make.defs`, and `target.cmake` files during the export process

Impact:
- Enables LLVM-specific build configurations to be properly exported and used in kernel builds
- Improves compatibility with LLVM-based toolchains by ensuring necessary architecture, CPU, and ABI information is available during the build process
- No functional changes for non-LLVM builds, as these flags are only used when LLVM toolchains are specified

Signed-off-by: Huang Qi <[email protected]>
  • Loading branch information
no1wudi authored and xiaoxiang781216 committed Jan 26, 2025
1 parent 6ba5955 commit 49dd1e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/Export.mk
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ ifdef CONFIG_LIBCXX
else
@echo "NUTTX_CXX=\"cxx\"" >> $(EXPORTDIR)/makeinfo.sh
endif
@echo "LLVM_ARCHTYPE=\"$(LLVM_ARCHTYPE)\"" >> $(EXPORTDIR)/makeinfo.sh
@echo "LLVM_CPUTYPE=\"$(LLVM_CPUTYPE)\"" >> $(EXPORTDIR)/makeinfo.sh
@echo "LLVM_ABITYPE=\"$(LLVM_ABITYPE)\"" >> $(EXPORTDIR)/makeinfo.sh
$(Q) chmod 755 $(EXPORTDIR)/makeinfo.sh

clean:
Expand Down
6 changes: 6 additions & 0 deletions tools/mkexport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ echo "NUTTX_ARCH_CHIP = ${NUTTX_ARCH_CHIP}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "NUTTX_BOARD = ${NUTTX_BOARD}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "NUTTX_BUILD = ${NUTTX_BUILD}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "NUTTX_CXX = ${NUTTX_CXX}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "LLVM_ARCHTYPE = ${LLVM_ARCHTYPE}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "LLVM_CPUTYPE = ${LLVM_CPUTYPE}" >>"${EXPORTDIR}/scripts/Make.defs"
echo "LLVM_ABITYPE = ${LLVM_ABITYPE}" >>"${EXPORTDIR}/scripts/Make.defs"

echo "set(ARCHCFLAGS \"${ARCHCFLAGS}\")" > "${EXPORTDIR}/scripts/target.cmake"
echo "set(ARCHCPUFLAGS \"${ARCHCPUFLAGS}\")" >>"${EXPORTDIR}/scripts/target.cmake"
Expand Down Expand Up @@ -304,6 +307,9 @@ echo "set(NUTTX_ARCH_CHIP \"${NUTTX_ARCH_CHIP}\")" >>"${EXPORTDIR}/scripts/
echo "set(NUTTX_BOARD \"${NUTTX_BOARD}\")" >>"${EXPORTDIR}/scripts/target.cmake"
echo "set(NUTTX_BUILD \"${NUTTX_BUILD}\")" >>"${EXPORTDIR}/scripts/target.cmake"
echo "set(NUTTX_CXX \"${NUTTX_CXX}\")" >>"${EXPORTDIR}/scripts/target.cmake"
echo "set(LLVM_ARCHTYPE \"${LLVM_ARCHTYPE}\")" >>"${EXPORTDIR}/scripts/target.cmake"
echo "set(LLVM_CPUTYPE \"${LLVM_CPUTYPE}\")" >>"${EXPORTDIR}/scripts/target.cmake"
echo "set(LLVM_ABITYPE \"${LLVM_ABITYPE}\")" >>"${EXPORTDIR}/scripts/target.cmake"


# Additional compilation options when the kernel is built
Expand Down

0 comments on commit 49dd1e0

Please sign in to comment.