Skip to content

Commit 683a1f0

Browse files
committed
arch/lkl: use a common helper to determine OUTPUT_FORMAT
The existing scripts work for GCC but restrict LLVM builds to elf64-x86-64 only. The new cc-objdump-file-format.sh helper script works with both gcc/clang and objdump/llvm-objdump for CC and OBJDUMP respectively. Signed-off-by: David Disseldorp <ddiss@suse.de>
1 parent 03de3b3 commit 683a1f0

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

arch/lkl/Kconfig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ config LKL_LINE_COV
3838

3939
config OUTPUT_FORMAT
4040
string "Output format"
41-
default $(shell,$(LD) -r -print-output-format) if LD_IS_BFD
42-
default $(shell,test "$(CROSS_COMPILE)" = "x86_64-linux-gnu" && echo "elf64-x86-64" || echo "unsupported-llvm") if LD_IS_LLD
41+
default $(shell,$(srctree)/arch/lkl/tools/cc-objdump-file-format.sh)
4342

4443
config ARCH_DMA_ADDR_T_64BIT
4544
def_bool 64BIT
@@ -49,8 +48,8 @@ config PHYS_ADDR_T_64BIT
4948

5049
config 64BIT
5150
bool "64bit kernel"
52-
default y if OUTPUT_FORMAT = "pe-x86-64" || OUTPUT_FORMAT = "elf64-x86-64"
53-
default $(success,$(LD) -r -print-output-format|grep -q '^elf64-') if LD_IS_BFD && OUTPUT_FORMAT != "pe-x86-64" && OUTPUT_FORMAT != "elf64-x86-64"
51+
default y if OUTPUT_FORMAT = "pe-x86-64"
52+
default $(success,$(srctree)/arch/lkl/tools/cc-objdump-file-format.sh|grep -q '^elf64-') if OUTPUT_FORMAT != "pe-x86-64"
5453

5554
config MMU
5655
bool "LKL MMU implementation"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
#
4+
# Print the C compiler output file format, as determined by objdump.
5+
t=`mktemp` || exit 1
6+
echo 'void foo(void) {}' | $CC -x c - -c -o "$t" \
7+
&& $OBJDUMP -p "$t" | awk '/file format/ {print $4}'
8+
rm "$t"

0 commit comments

Comments
 (0)