-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lkl: add lld support for x86_64/i386
lld, the LLVM linker, can link recent mainline Linux kernel. It provides faster link time compared with GNU linker[1]. This commit adds lld support to lkl for x86_64/i386 Linux host with clang. To build with lld, invoke command like below: make -C tools/lkl CC=clang LD=ld.lld [1] https://lld.llvm.org/ Signed-off-by: Akira Moroo <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,25 @@ | ||
export OUTPUT_FORMAT=$(shell $(LD) -r -print-output-format) | ||
ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),) | ||
ifneq (,$(shell $(CC) --version 2>&1 | grep clang | head -n 1)) | ||
TRIPLE=$(shell $(CC) --version 2>&1 | grep Target | cut -d " " -f2) | ||
else | ||
TRIPLE=$(shell $(CC) -dumpmachine) | ||
endif | ||
TRIPLE_ARCH=$(shell echo $(TRIPLE) | cut -d - -f1) | ||
TRIPLE_VENDOR=$(shell echo $(TRIPLE) | cut -d - -f2) | ||
TRIPLE_OS=$(shell echo $(TRIPLE) | cut -d - -f3) | ||
ifneq (,$(filter linux,$(TRIPLE_VENDOR))) | ||
TRIPLE_OS=$(TRIPLE_VENDOR) | ||
endif | ||
ifneq (,$(filter x86_64,$(TRIPLE_ARCH))) | ||
ifneq (,$(filter linux,$(TRIPLE_OS))) | ||
export OUTPUT_FORMAT=elf64-x86-64 | ||
endif | ||
else ifneq (,$(filter i386 i686,$(TRIPLE_ARCH))) | ||
ifneq (,$(filter linux,$(TRIPLE_OS))) | ||
export OUTPUT_FORMAT=elf32-i386 | ||
endif | ||
endif | ||
else | ||
export OUTPUT_FORMAT=$(shell $(LD) -r -print-output-format) | ||
endif | ||
export EXEC_FORMAT=$(shell echo $(OUTPUT_FORMAT) | cut -d - -f1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters