Skip to content

Commit d231a54

Browse files
committed
Use clang compiler when configured as such
1 parent be62ebc commit d231a54

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

configure.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ fi
109109

110110
PLATFORM=`sed -n '/^PLATFORM\b/p' Makefile.config | sed 's:[^=]*= ::'`
111111
MACHINE=`sed -n '/^MACHINE\b/p' Makefile.config | sed 's:[^=]*= ::'`
112+
COMPILER=`sed -n '/^COMPILER\b/p' Makefile.config | sed 's:[^=]*= ::'`
112113

113114
cross_target="$PLATFORM"
114115
if [ "$PLATFORM" = 'abs32le' ]; then
@@ -118,10 +119,18 @@ if [ "$MACHINE" = 'bmalta' ]; then
118119
cross_target='mips32eb'
119120
fi
120121

122+
if [ "$COMPILER" = 'clang' ]; then
123+
cross_target="${cross_target}_clang"
124+
fi
125+
121126
cross_def="${SOURCE_DIR}/meson/cross/${cross_target}"
122127
cc_arch=`sed -n "s:cc_arch = '\(.*\)':\1:p" "$cross_def"`
123128

124-
compname="$cc_arch-helenos-gcc"
129+
if [ "$COMPILER" = 'clang' ]; then
130+
compname="$cc_arch-helenos-clang"
131+
else
132+
compname="$cc_arch-helenos-gcc"
133+
fi
125134
unset compprefix
126135

127136
if which "$compname" >/dev/null 2>/dev/null; then

kernel/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ kernel_c_args = arch_kernel_c_args + kernel_defs + [
116116

117117
if not CONFIG_LINE_DEBUG
118118
# Keep the debug info needed to get file names for kernel stack traces.
119-
kernel_c_args += [ '-gdwarf-5', '-g1', '-gno-statement-frontiers' ]
119+
kernel_c_args += cc.get_supported_arguments([ '-gdwarf-5', '-g1', '-gno-statement-frontiers' ])
120120
endif
121121

122122
if CONFIG_LTO

tools/toolchain.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,11 @@ install_pkg() {
511511
link_clang() {
512512
# Symlink clang and lld to the install path.
513513
CLANG="`which clang 2> /dev/null || echo "/usr/bin/clang"`"
514+
CLANGPP="`which clang++ 2> /dev/null || echo "/usr/bin/clang++"`"
514515
LLD="`which ld.lld 2> /dev/null || echo "/usr/bin/ld.lld"`"
515516

516517
ln -s $CLANG "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-clang"
518+
ln -s $CLANGPP "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-clang++"
517519
ln -s $LLD "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-ld.lld"
518520
}
519521

0 commit comments

Comments
 (0)