Skip to content

Latest commit

 

History

History
40 lines (36 loc) · 1.22 KB

0003-flac.git-5db58209.patch

File metadata and controls

40 lines (36 loc) · 1.22 KB
 
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
From: pkubaj <pkubaj@users.noreply.github.com>
Date: Thu, 15 Aug 2019 10:27:19 +0000 (+0000)
Subject: Fix build on FreeBSD PowerPC
X-Git-Url: http://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=5db58209329b722529ec74f9b4f36bf367145835
Fix build on FreeBSD PowerPC
Used the elf_aux_info function on FreeBSD and clarify that users of other
systems need to implement reading from AT_HWCAP2.
---
diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c
index 64da9cbc..c90b8999 100644
--- a/src/libFLAC/cpu.c
+++ b/src/libFLAC/cpu.c
@@ -245,11 +245,24 @@ ppc_cpu_info (FLAC__CPUInfo *info)
#define PPC_FEATURE2_ARCH_2_07 0x80000000
#endif
+#ifdef __linux__
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00) {
info->ppc.arch_3_00 = true;
} else if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) {
info->ppc.arch_2_07 = true;
}
+#elif defined(__FreeBSD__)
+ long hwcaps;
+ elf_aux_info(AT_HWCAP2, &hwcaps, sizeof(hwcaps));
+#else
+#error Unsupported platform! Please add support for reading ppc hwcaps.
+#endif
+
+ if (hwcaps & PPC_FEATURE2_ARCH_3_00) {
+ info->ppc.arch_3_00 = true;
+ } else if (hwcaps & PPC_FEATURE2_ARCH_2_07) {
+ info->ppc.arch_2_07 = true;
+ }
#else
info->ppc.arch_2_07 = false;
info->ppc.arch_3_00 = false;