forked from Oink70/CCminer-ARM-optimized
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.sh
executable file
·61 lines (51 loc) · 2.78 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Get CPU information
arch=$(lscpu | awk '/Architecture:/ { print $2 }')
model_name=$(lscpu | awk -F ': +' '/Model name:/ { print $2 }')
# Common compiler flags
common_flags="-O3 -ffinite-loops -ffast-math -D_REENTRANT -finline-functions -falign-functions=16 -fomit-frame-pointer -fpic -pthread -flto -fuse-ld=lld -fno-stack-protector"
# Set architecture-specific flags
if [[ "$arch" == "aarch64" ]]; then
if [[ "$model_name" == *"Cortex-A53"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a53 -mfix-cortex-a53-835769"
elif [[ "$model_name" == *"Cortex-A55"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a55"
elif [[ "$model_name" == *"Cortex-A57"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a57"
elif [[ "$model_name" == *"Cortex-A72"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a72"
elif [[ "$model_name" == *"Cortex-A73"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a73"
elif [[ "$model_name" == *"Cortex-A75"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a75"
elif [[ "$model_name" == *"Cortex-A76"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a76"
elif [[ "$model_name" == *"Cortex-A77"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a77"
elif [[ "$model_name" == *"Cortex-A78c"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a78c"
elif [[ "$model_name" == *"Cortex-A78"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a78"
else
# Default to ARMv8-A architecture (Cortex-A53) if unknown
echo "Unknown or unsupported model: $model_name. Defaulting to ARMv8-A."
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a53"
fi
else
# Default to ARMv8-A architecture (Cortex-A53) if unknown architecture
echo "Unknown or unsupported architecture: $arch. Defaulting to Native Tuning."
cpu_flags="-mtune=native"
fi
# Set vectorization flags
vectorization_flags="-Rpass-missed=loop-vectorize -Rpass-analysis=loop-vectorize -Wl"
# Combine all flags
all_flags="$common_flags $cpu_flags $vectorization_flags"
# Configure and build
./configure --target=aarch64-linux-gnu --host=x86_64-linux-gnu --build=x86_64-linux-gnu \
CXXFLAGS="-Wl,-hugetlbfs-align -funroll-loops -finline-functions $all_flags" \
CFLAGS="-Wl,-hugetlbfs-align -finline-functions $all_flags" \
CXX=clang++ CC=clang LDFLAGS="-v -flto -Wl,-hugetlbfs-align"
# Configure and build with GCC
# ./configure --build x86_64-pc-linux-gnu --host aarch64-linux-gnu --target aarch64-linux-gnu CXXFLAGS="-Wl, -funroll-loops -finline-functions $all_flags" \
# CFLAGS="-finline-functions $all_flags" \
# CXX=g++ CC=gcc"