aboutsummaryrefslogtreecommitdiff
path: root/BUILD.bazel
diff options
context:
space:
mode:
authorMykola Hohsadze <koliagogsadze@gmail.com>2023-09-19 12:02:25 +0300
committerGitHub <noreply@github.com>2023-09-19 11:02:25 +0200
commit89a3f0358a32268d1870a2e35e2a13b49ab7f126 (patch)
tree59669536b3d9c642c11d719f9ad2834e448965e9 /BUILD.bazel
parent494d9657ef0435cd267ca0ed55c2d726704da9a4 (diff)
downloadcpu_features-89a3f0358a32268d1870a2e35e2a13b49ab7f126.tar.gz
Add FreeBSD Arm64 support (#295)
* Add FreeBSD Arm64 detection Getting all the features is handled by reading /var/run/dmesg.boot. Feature detections were taken from the freebsd kernel code sys/arm64/arm64/identcpu.c * Add FreeBSD Arm64 tests * Add flagm, flagm2 and rng detection * Add HWCAP FreeBSD AArch64 * Update include to use linux hwcaps for powerpc * Add FreeBSD aarch64 impl * Separate Hwacps to freebsd and linux implementation * Add aarch64 midr_el1 implementation * Add detection hwcap cpuid to hwcaps.h * Add MIDR_EL1 tests
Diffstat (limited to 'BUILD.bazel')
-rw-r--r--BUILD.bazel29
1 files changed, 24 insertions, 5 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index 6925944..031eb63 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -2,7 +2,7 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
load("//:bazel/platforms.bzl", "PLATFORM_CPU_ARM", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_MIPS", "PLATFORM_CPU_PPC", "PLATFORM_CPU_RISCV32", "PLATFORM_CPU_RISCV64", "PLATFORM_CPU_X86_64")
-load("//:bazel/platforms.bzl", "PLATFORM_OS_MACOS")
+load("//:bazel/platforms.bzl", "PLATFORM_OS_MACOS", "PLATFORM_OS_LINUX", "PLATFORM_OS_FREEBSD", "PLATFORM_OS_ANDROID")
package(
default_visibility = ["//visibility:public"],
@@ -169,11 +169,18 @@ cc_library(
cc_library(
name = "hwcaps",
- srcs = ["src/hwcaps.c"],
+ srcs = [
+ "src/hwcaps.c",
+ "src/hwcaps_freebsd.c",
+ "src/hwcaps_linux_or_android.c",
+ ],
copts = C99_FLAGS,
defines = selects.with_or({
PLATFORM_OS_MACOS: ["HAVE_DLFCN_H"],
- "//conditions:default": ["HAVE_STRONG_GETAUXVAL"],
+ PLATFORM_OS_FREEBSD: ["HAVE_STRONG_ELF_AUX_INFO"],
+ PLATFORM_OS_LINUX: ["HAVE_STRONG_GETAUXVAL"],
+ PLATFORM_OS_ANDROID: ["HAVE_STRONG_GETAUXVAL"],
+ "//conditions:default": [],
}),
includes = INCLUDES,
textual_hdrs = ["include/internal/hwcaps.h"],
@@ -189,6 +196,8 @@ cc_library(
testonly = 1,
srcs = [
"src/hwcaps.c",
+ "src/hwcaps_freebsd.c",
+ "src/hwcaps_linux_or_android.c",
"test/hwcaps_for_testing.cc",
],
hdrs = [
@@ -218,9 +227,11 @@ cc_library(
],
PLATFORM_CPU_ARM: ["src/impl_arm_linux_or_android.c"],
PLATFORM_CPU_ARM64: [
+ "src/impl_aarch64_cpuid.c",
"src/impl_aarch64_linux_or_android.c",
"src/impl_aarch64_macos_or_iphone.c",
"src/impl_aarch64_windows.c",
+ "src/impl_aarch64_freebsd.c",
],
PLATFORM_CPU_MIPS: ["src/impl_mips_linux_or_android.c"],
PLATFORM_CPU_PPC: ["src/impl_ppc_linux.c"],
@@ -234,7 +245,10 @@ cc_library(
"include/internal/windows_utils.h",
],
PLATFORM_CPU_ARM: ["include/cpuinfo_arm.h"],
- PLATFORM_CPU_ARM64: ["include/cpuinfo_aarch64.h"],
+ PLATFORM_CPU_ARM64: [
+ "include/cpuinfo_aarch64.h",
+ "include/internal/cpuid_aarch64.h",
+ ],
PLATFORM_CPU_MIPS: ["include/cpuinfo_mips.h"],
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
PLATFORM_CPU_RISCV32: ["include/cpuinfo_riscv.h"],
@@ -278,9 +292,11 @@ cc_library(
],
PLATFORM_CPU_ARM: ["src/impl_arm_linux_or_android.c"],
PLATFORM_CPU_ARM64: [
+ "src/impl_aarch64_cpuid.c",
"src/impl_aarch64_linux_or_android.c",
"src/impl_aarch64_macos_or_iphone.c",
"src/impl_aarch64_windows.c",
+ "src/impl_aarch64_freebsd.c",
],
PLATFORM_CPU_MIPS: ["src/impl_mips_linux_or_android.c"],
PLATFORM_CPU_PPC: ["src/impl_ppc_linux.c"],
@@ -294,7 +310,10 @@ cc_library(
"include/internal/windows_utils.h",
],
PLATFORM_CPU_ARM: ["include/cpuinfo_arm.h"],
- PLATFORM_CPU_ARM64: ["include/cpuinfo_aarch64.h"],
+ PLATFORM_CPU_ARM64: [
+ "include/cpuinfo_aarch64.h",
+ "include/internal/cpuid_aarch64.h"
+ ],
PLATFORM_CPU_MIPS: ["include/cpuinfo_mips.h"],
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
PLATFORM_CPU_RISCV32: ["include/cpuinfo_riscv.h"],