Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for arm64 on freebsd #66

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ every change, see the Git log.

Latest
------
* tbd
* Patch: Fixed compilation error on ARM64 FreeBSD.

9.0.1
-----
Expand Down
32 changes: 32 additions & 0 deletions lock_version_resolve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"cli11": {
"commit_id": "b1003a44f018255c409c43d5f35e71ab8f7eef62",
"resolver_info": "2.0.1",
"sha1": "fdd606a277e537302216420bd3e9070c6f0df861"
},
"cli11-source": {
"commit_id": "f862849488557eeee0397814a47449ecfdae0383",
"resolver_info": "f862849488557eeee0397814a47449ecfdae0383",
"sha1": "c907ae8559530944e520e22d1382be32d290ca77"
},
"gtest": {
"commit_id": "da24468d2c5deb601d0f67196abe83d78a00f972",
"resolver_info": "5.0.0",
"sha1": "11e35e3559b3844fbe2fa6f045854cd2dcdf0f86"
},
"gtest-source": {
"commit_id": "e2239ee6043f73722e7aa812a459f54a28552929",
"resolver_info": "release-1.11.0",
"sha1": "ca969a1500e88a09de1cbfb8d8d3307a7773abfd"
},
"platform": {
"commit_id": "c2543dd5e613fb86d8dee530c0f1c142a310e1f0",
"resolver_info": "5.1.1",
"sha1": "f6bc772cf920c024726ebd12a5a38f123d057adb"
},
"waf-tools": {
"commit_id": "6379b83992885dcb148e2c8bf3677f315d623e8f",
"resolver_info": "5.4.0",
"sha1": "9dd4ab1d52c916572f45237d4e7450abc7c19a14"
}
}
20 changes: 17 additions & 3 deletions src/cpuid/detail/init_linux_gcc_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@

#include <elf.h>
#include <fcntl.h>
#include <linux/auxvec.h>
#include <unistd.h>

// The following includes are needed for the runtime detection of NEON
#ifdef PLATFORM_FREEBSD
// FreeBSD uses sys/auxv.h
#include <sys/auxv.h>
#else
// Linux uses linux/auxvec.h
#include <linux/auxvec.h>
#endif

#include "cpuinfo_impl.hpp"

namespace cpuid
Expand All @@ -30,11 +38,16 @@ void init_cpuinfo(cpuinfo::impl& info)
info.m_has_neon = true;
#else
// Runtime detection of NEON is necessary on 32-bit ARM CPUs
//

#ifdef PLATFORM_FREEBSD
// On FreeBSD we use the elf_aux_info function to get the HWCAP
long hwcap = 0;
elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
info.m_has_neon = hwcap & HWCAP_NEON;
#else
// Follow recommendation from Cortex-A Series Programmer's guide
// in Section 20.1.7 Detecting NEON. The guide is available at
// Steinwurf's Google drive: steinwurf/technical/experimental/cpuid

auto cpufile = open("/proc/self/auxv", O_RDONLY);
assert(cpufile);

Expand All @@ -59,6 +72,7 @@ void init_cpuinfo(cpuinfo::impl& info)
info.m_has_neon = false;
}
#endif
#endif
}
}
}
Loading