Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
add support for LLVM=1
Browse files Browse the repository at this point in the history
Issue #300
  • Loading branch information
nickdesaulniers committed Aug 20, 2020
1 parent c36a087 commit b319a1e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ script:
docker run \
--env ARCH=${ARCH} \
--env LD=${LD} \
--env LLVM=${LLVM} \
--env LLVM_IAS=${LLVM_IAS} \
--env REPO=${REPO} \
--env BOOT=${BOOT} \
Expand Down
54 changes: 33 additions & 21 deletions driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
setup_variables() {
while [[ ${#} -ge 1 ]]; do
case ${1} in
"AR="* | "ARCH="* | "CC="* | "LD="* | "LLVM_IAS="* | "NM"=* | "OBJCOPY"=* | "OBJDUMP"=* | "OBJSIZE"=* | "REPO="* | "STRIP"=*) export "${1?}" ;;
"AR="* | "ARCH="* | "CC="* | "LD="* | "LLVM="* | "LLVM_IAS="* | "NM"=* | "OBJCOPY"=* | "OBJDUMP"=* | "OBJSIZE"=* | "REPO="* | "STRIP"=*) export "${1?}" ;;
"-c" | "--clean") cleanup=true ;;
"-j" | "--jobs")
shift
Expand Down Expand Up @@ -339,26 +339,38 @@ check_objcopy_strip_version() {
done
}
mako_reactor() {
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/kbuild.txt
time \
KBUILD_BUILD_TIMESTAMP="Thu Jan 1 00:00:00 UTC 1970" \
KBUILD_BUILD_USER=driver \
KBUILD_BUILD_HOST=clangbuiltlinux \
make -j"${jobs:-$(nproc)}" \
AR="${AR}" \
CC="${CC}" \
HOSTCC="${CC}" \
HOSTLD="${HOSTLD:-ld}" \
KCFLAGS="-Wno-implicit-fallthrough" \
LD="${LD}" \
LLVM_IAS="${LLVM_IAS}" \
NM="${NM}" \
OBJCOPY="${OBJCOPY}" \
OBJDUMP="${OBJDUMP}" \
OBJSIZE="${OBJSIZE}" \
READELF="${READELF}" \
STRIP="${STRIP}" \
"${@}"
if [[ ${LLVM:-0} -eq "1" ]]; then
echo "LLVM set to 1"
time \
KBUILD_BUILD_TIMESTAMP="Thu Jan 1 00:00:00 UTC 1970" \
KBUILD_BUILD_USER=driver \
KBUILD_BUILD_HOST=clangbuiltlinux \
make -j"${jobs:-$(nproc)}" \
LLVM=1 \
LLVM_IAS="${LLVM_IAS}" \
"${@}"
else
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/kbuild.txt
time \
KBUILD_BUILD_TIMESTAMP="Thu Jan 1 00:00:00 UTC 1970" \
KBUILD_BUILD_USER=driver \
KBUILD_BUILD_HOST=clangbuiltlinux \
make -j"${jobs:-$(nproc)}" \
AR="${AR}" \
CC="${CC}" \
HOSTCC="${CC}" \
HOSTLD="${HOSTLD:-ld}" \
KCFLAGS="-Wno-implicit-fallthrough" \
LD="${LD}" \
LLVM_IAS="${LLVM_IAS}" \
NM="${NM}" \
OBJCOPY="${OBJCOPY}" \
OBJDUMP="${OBJDUMP}" \
OBJSIZE="${OBJSIZE}" \
READELF="${READELF}" \
STRIP="${STRIP}" \
"${@}"
fi
}

apply_patches() {
Expand Down
3 changes: 3 additions & 0 deletions usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Environment variables:
If no CC value is specified, clang is used.
LD:
If no LD value is specified, ${CROSS_COMPILE}ld is used.
LLVM:
If this is set to 1, all LLVM utilities are used, except for the
integrated assembler. Use LLVM_IAS=1 to enable that.
LLVM_IAS:
If this is set to 1, the integrated assembler is used. No value means
${CROSS_COMPILE}as is used for assembling.
Expand Down

0 comments on commit b319a1e

Please sign in to comment.