summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-05-26 12:43:56 +0200
committerErich Eckner <git@eckner.net>2021-05-26 12:43:56 +0200
commit9f822cabe7af7c4b0cc7cdcfbac21bd8a5b3b9c1 (patch)
tree492a897b248879ad7613e949867541411a7c734e
parent2f46e4c89a8bb61bb7b95fc179934a93860654b2 (diff)
downloadpackages-9f822cabe7af7c4b0cc7cdcfbac21bd8a5b3b9c1.tar.xz
core/pacman: add patch for different sse2 detection - this should now also work on via processors
-rw-r--r--core/pacman/PKGBUILD2
-rw-r--r--core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch46
2 files changed, 33 insertions, 15 deletions
diff --git a/core/pacman/PKGBUILD b/core/pacman/PKGBUILD
index 7429bd4b..7706a130 100644
--- a/core/pacman/PKGBUILD
+++ b/core/pacman/PKGBUILD
@@ -24,7 +24,7 @@ if [ ! "${CARCH}" = "i686" ]; then
fi
source+=('replace-i686-by-pentium4-when-architecture-is-auto.patch')
-sha256sums+=('e8d5f8979c4dfab49e7ac058846f2454b865c1da451e086c23e61034fd820c19')
+sha256sums+=('e5d371dd890ba7916a7f363eea46da363a6b5b8794640f387945458d15323136')
eval "$(
{
diff --git a/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch b/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch
index 32030586..6c073a4a 100644
--- a/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch
+++ b/core/pacman/replace-i686-by-pentium4-when-architecture-is-auto.patch
@@ -1,24 +1,41 @@
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
-index 2d8518c4..2e7fac88 100644
+index 0f0c2cfb..87873891 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
-@@ -308,6 +308,11 @@ int config_set_arch(const char *arch)
- struct utsname un;
+@@ -18,6 +18,7 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
++#include <cpuid.h>
+ #include <errno.h>
+ #include <limits.h>
+ #include <locale.h> /* setlocale */
+@@ -401,6 +402,12 @@ int config_add_architecture(char *arch)
+ char *newarch;
uname(&un);
- config->arch = strdup(un.machine);
-+ if(strcmp(config->arch, "i686") == 0) {
-+ __builtin_cpu_init();
-+ if (__builtin_cpu_supports("sse2"))
-+ config->arch = strdup("pentium4");
+ newarch = strdup(un.machine);
++ if(strcmp(newarch, "i686") == 0) {
++ unsigned int eax, ebx, ecx, edx;
++ __get_cpuid(0, &eax, &ebx, &ecx, &edx);
++ if (ecx & bit_SSE2)
++ newarch = strdup("pentium4");
+ }
- } else {
- config->arch = strdup(arch);
+ free(arch);
+ arch = newarch;
}
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
-index 3bb622e6..34aace6c 100644
+index 7e810127..255c6269 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
-@@ -274,8 +274,18 @@ static void setuseragent(void)
+@@ -26,6 +26,7 @@
+
+ #include <stdlib.h> /* atoi */
+ #include <stdio.h>
++#include <cpuid.h>
+ #include <ctype.h> /* isspace */
+ #include <limits.h>
+ #include <getopt.h>
+@@ -274,8 +275,19 @@ static void setuseragent(void)
int len;
uname(&un);
@@ -26,8 +43,9 @@ index 3bb622e6..34aace6c 100644
+ strncpy(machine, un.machine, sizeof machine);
+ machine[sizeof machine-1] = '\0';
+ if(strcmp(machine, "i686") == 0) {
-+ __builtin_cpu_init();
-+ if (__builtin_cpu_supports("sse2")) {
++ int eax, ebx, ecx, edx;
++ __cpuid(0, &eax, &ebx, &ecx, %edx);
++ if (ecx & bit_SSE2) {
+ strncpy(machine, "pentium4", sizeof machine);
+ machine[sizeof machine-1] = '\0';
+ }