Skip to content

Commit 121ff07

Browse files
committed
tools: Add LoongArch build infrastructure
We will add tools support for LoongArch (bpf, perf, objtool, etc.), add build infrastructure and common headers for preparation. Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent a6484ba commit 121ff07

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef __ASM_LOONGARCH_BITSPERLONG_H
3+
#define __ASM_LOONGARCH_BITSPERLONG_H
4+
5+
#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
6+
7+
#include <asm-generic/bitsperlong.h>
8+
9+
#endif /* __ASM_LOONGARCH_BITSPERLONG_H */

tools/scripts/Makefile.arch

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
55
-e s/s390x/s390/ -e s/parisc64/parisc/ \
66
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
77
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
8-
-e s/riscv.*/riscv/)
8+
-e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
99

1010
ifndef ARCH
1111
ARCH := $(HOSTARCH)
@@ -34,6 +34,15 @@ ifeq ($(ARCH),sh64)
3434
SRCARCH := sh
3535
endif
3636

37+
# Additional ARCH settings for loongarch
38+
ifeq ($(ARCH),loongarch32)
39+
SRCARCH := loongarch
40+
endif
41+
42+
ifeq ($(ARCH),loongarch64)
43+
SRCARCH := loongarch
44+
endif
45+
3746
LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
3847
ifeq ($(LP64), 1)
3948
IS_64_BIT := 1

0 commit comments

Comments
 (0)