Skip to content

Commit 3d0b3b5

Browse files
authored
Merge pull request #66 from steinwurf/add-support-for-arm64-on-freebsd
Add support for arm64 on freebsd
2 parents 2303975 + 4989504 commit 3d0b3b5

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

NEWS.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ every change, see the Git log.
66

77
Latest
88
------
9-
* tbd
9+
* Patch: Fixed compilation error on ARM64 FreeBSD.
1010

1111
9.0.1
1212
-----

lock_version_resolve.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"cli11": {
3+
"commit_id": "b1003a44f018255c409c43d5f35e71ab8f7eef62",
4+
"resolver_info": "2.0.1",
5+
"sha1": "fdd606a277e537302216420bd3e9070c6f0df861"
6+
},
7+
"cli11-source": {
8+
"commit_id": "f862849488557eeee0397814a47449ecfdae0383",
9+
"resolver_info": "f862849488557eeee0397814a47449ecfdae0383",
10+
"sha1": "c907ae8559530944e520e22d1382be32d290ca77"
11+
},
12+
"gtest": {
13+
"commit_id": "da24468d2c5deb601d0f67196abe83d78a00f972",
14+
"resolver_info": "5.0.0",
15+
"sha1": "11e35e3559b3844fbe2fa6f045854cd2dcdf0f86"
16+
},
17+
"gtest-source": {
18+
"commit_id": "e2239ee6043f73722e7aa812a459f54a28552929",
19+
"resolver_info": "release-1.11.0",
20+
"sha1": "ca969a1500e88a09de1cbfb8d8d3307a7773abfd"
21+
},
22+
"platform": {
23+
"commit_id": "c2543dd5e613fb86d8dee530c0f1c142a310e1f0",
24+
"resolver_info": "5.1.1",
25+
"sha1": "f6bc772cf920c024726ebd12a5a38f123d057adb"
26+
},
27+
"waf-tools": {
28+
"commit_id": "6379b83992885dcb148e2c8bf3677f315d623e8f",
29+
"resolver_info": "5.4.0",
30+
"sha1": "9dd4ab1d52c916572f45237d4e7450abc7c19a14"
31+
}
32+
}

src/cpuid/detail/init_linux_gcc_arm.hpp

+17-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@
1111

1212
#include <elf.h>
1313
#include <fcntl.h>
14-
#include <linux/auxvec.h>
1514
#include <unistd.h>
1615

16+
// The following includes are needed for the runtime detection of NEON
17+
#ifdef PLATFORM_FREEBSD
18+
// FreeBSD uses sys/auxv.h
19+
#include <sys/auxv.h>
20+
#else
21+
// Linux uses linux/auxvec.h
22+
#include <linux/auxvec.h>
23+
#endif
24+
1725
#include "cpuinfo_impl.hpp"
1826

1927
namespace cpuid
@@ -30,11 +38,16 @@ void init_cpuinfo(cpuinfo::impl& info)
3038
info.m_has_neon = true;
3139
#else
3240
// Runtime detection of NEON is necessary on 32-bit ARM CPUs
33-
//
41+
42+
#ifdef PLATFORM_FREEBSD
43+
// On FreeBSD we use the elf_aux_info function to get the HWCAP
44+
long hwcap = 0;
45+
elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
46+
info.m_has_neon = hwcap & HWCAP_NEON;
47+
#else
3448
// Follow recommendation from Cortex-A Series Programmer's guide
3549
// in Section 20.1.7 Detecting NEON. The guide is available at
3650
// Steinwurf's Google drive: steinwurf/technical/experimental/cpuid
37-
3851
auto cpufile = open("/proc/self/auxv", O_RDONLY);
3952
assert(cpufile);
4053

@@ -59,6 +72,7 @@ void init_cpuinfo(cpuinfo::impl& info)
5972
info.m_has_neon = false;
6073
}
6174
#endif
75+
#endif
6276
}
6377
}
6478
}

0 commit comments

Comments
 (0)