-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From 07cb730bf3dc49170f0c387d9edcf5537a4e26b6 Mon Sep 17 00:00:00 2001 | ||
From: kxxt <rsworktech@outlook.com> | ||
Date: Wed, 21 Jun 2023 00:06:04 +0800 | ||
Subject: [PATCH] Disable LTO when checking for fsin/fcos/fldln2/... | ||
|
||
LTO might interfere with the instruction detection and produce false positives. | ||
(The conftest.c compiles with `-flto=auto` but fails without it) | ||
|
||
The build for riscv64 arch linux fails because of this: | ||
https://archriscv.felixc.at/.status/log.htm?url=logs/libcaca/libcaca-0.99.beta20-2.log | ||
|
||
This PR fixes it. | ||
--- | ||
configure.ac | 5 +++++ | ||
1 file changed, 5 insertions(+) | ||
|
||
diff --git a/configure.ac b/configure.ac | ||
index 27b8d5b4..ee38ead3 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -145,6 +145,9 @@ AC_COMPILE_IFELSE( | ||
AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the ‘Sleep’ function.])], | ||
[AC_MSG_RESULT(no)]) | ||
|
||
+# Disable LTO when checking for the instructions | ||
+CFLAGS="${CFLAGS} -fno-lto" | ||
+ | ||
AC_MSG_CHECKING(for fsin/fcos) | ||
AC_COMPILE_IFELSE( | ||
[AC_LANG_PROGRAM( | ||
@@ -163,6 +166,8 @@ AC_COMPILE_IFELSE( | ||
AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the ‘fldln2’ and other floating point instructions.])], | ||
[AC_MSG_RESULT(no)]) | ||
|
||
+CFLAGS="${CFLAGS%$' -fno-lto'}" | ||
+ | ||
AC_CHECK_HEADERS(zlib.h) | ||
AC_CHECK_LIB(z, gzopen, [ZLIB_LIBS="${ZLIB_LIBS} -lz"]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
diff --git PKGBUILD PKGBUILD | ||
index 5b00085..dc7c30f 100644 | ||
--- PKGBUILD | ||
+++ PKGBUILD | ||
@@ -41,3 +41,11 @@ package() { | ||
@@ -44,6 +44,9 @@ prepare() { | ||
# https://github.com/cacalabs/libcaca/pull/66 | ||
git apply -3 ../libcaca-0.99.beta20-CVE-2022-0856.patch | ||
|
||
+ # Disable LTO when checking for fsin/fcos/fldln2/... | ||
+ git apply -3 ../libcaca-fix-instruction-detection.patch | ||
+ | ||
autoreconf -fi | ||
} | ||
|
||
@@ -67,3 +70,6 @@ package() { | ||
make DESTDIR="$pkgdir" install | ||
install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING" | ||
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" COPYING | ||
} | ||
+ | ||
+source+=("$pkgname-fix-instruction-detection.patch::https://github.com/cacalabs/libcaca/pull/76.patch") | ||
+sha256sums+=('2d40a2c2654369e0583f9c26653b56d6b4306d76ad12c78478de489a8f91160b') | ||
+prepare() { | ||
+ cd $pkgname-$pkgver | ||
+ patch -Np1 -i ../$pkgname-fix-instruction-detection.patch | ||
+ autoreconf -fi | ||
+} | ||
+source+=("libcaca-fix-instruction-detection.patch") | ||
+b2sums+=("1cfd28a3777cec6cb8f2bab8ae2f6d9496452e40dd7f0f7a7cf67ebef1a4ac48390e63ce464b1283207545fe8fe050f9789cf39202b513d3d22291dc84521f10") |