commit:     69fee45923a0a9b2734f3bb150a1f576499904b0
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Wed Jan 15 10:15:37 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 18 17:34:27 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69fee459

sys-block/mbuffer: fix build failure w/ clang

use "-O0" to compile the feature test code

Closes: https://bugs.gentoo.org/938689
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40141
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../mbuffer-20240107-O0-for-libc-name-find.patch   | 38 ++++++++++++++++++++++
 sys-block/mbuffer/mbuffer-20240107.ebuild          |  1 +
 sys-block/mbuffer/mbuffer-20240707.ebuild          |  1 +
 sys-block/mbuffer/mbuffer-20241007.ebuild          |  1 +
 4 files changed, 41 insertions(+)

diff --git 
a/sys-block/mbuffer/files/mbuffer-20240107-O0-for-libc-name-find.patch 
b/sys-block/mbuffer/files/mbuffer-20240107-O0-for-libc-name-find.patch
new file mode 100644
index 000000000000..b176c3dfe907
--- /dev/null
+++ b/sys-block/mbuffer/files/mbuffer-20240107-O0-for-libc-name-find.patch
@@ -0,0 +1,38 @@
+https://bugs.gentoo.org/938689
+
+mbuffer use macro LIBC_(OPEN|READ|WRITE|FSTAT) whic are determined by
+'objdump -T ... | awk ...', but in the case of clag (at least for now),
+depend on the optimization levels, open|read will be optimized to other
+methods which cause LIBC_(OPEN|READ) become "", then error bellow:
+
+expected identifier or '('
+   55 | int LIBC_OPEN(const char *path, int oflag, ...)
+
+I don't know the reason to find the name of open|read|write|fstat by this
+test, so use -O0 for the feature test code.
+
+Upstream Replied:
+> this concept is needed for the tapedrive emulator that replicates the
+> behavior of specific devices.
+
+diff --git a/configure.in b/configure.in
+index 95d6772..081625a 100644
+--- a/configure.in
++++ b/configure.in
+@@ -155,6 +155,8 @@ AC_LANG(C)
+ if test -z "$OBJDUMP"; then
+       AC_MSG_WARN([unable to find objdump, which is needed to run tests])
+ else
++      m4_pushdef([ORIGINAL_CFLAGS], [$CFLAGS])
++      CFLAGS="-O0"
+       AC_MSG_CHECKING([linking open() and write() to detect libc names])
+       AC_LINK_IFELSE([
+       AC_LANG_SOURCE([[
+@@ -191,6 +193,7 @@ else
+       ],
+       [AC_MSG_FAILURE([failed to link open/write test])]
+       )
++      CFLAGS="${ORIGINAL_CFLAGS}"
+ fi
+ 
+ 

diff --git a/sys-block/mbuffer/mbuffer-20240107.ebuild 
b/sys-block/mbuffer/mbuffer-20240107.ebuild
index 6d8e6e093eed..78a686f45510 100644
--- a/sys-block/mbuffer/mbuffer-20240107.ebuild
+++ b/sys-block/mbuffer/mbuffer-20240107.ebuild
@@ -27,6 +27,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-20180410-sysconfdir.patch"
        "${FILESDIR}/${PN}-20200929-find-OBJDUMP.patch"
        "${FILESDIR}/${PN}-20231216-autoconf-warning.patch"
+       "${FILESDIR}/${PN}-20240107-O0-for-libc-name-find.patch"
 )
 
 src_prepare() {

diff --git a/sys-block/mbuffer/mbuffer-20240707.ebuild 
b/sys-block/mbuffer/mbuffer-20240707.ebuild
index c1354afd7ec1..bf0550b4c7fc 100644
--- a/sys-block/mbuffer/mbuffer-20240707.ebuild
+++ b/sys-block/mbuffer/mbuffer-20240707.ebuild
@@ -28,6 +28,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-20180410-sysconfdir.patch"
        "${FILESDIR}/${PN}-20200929-find-OBJDUMP.patch"
        "${FILESDIR}/${PN}-20231216-autoconf-warning.patch"
+       "${FILESDIR}/${PN}-20240107-O0-for-libc-name-find.patch"
 )
 
 src_prepare() {

diff --git a/sys-block/mbuffer/mbuffer-20241007.ebuild 
b/sys-block/mbuffer/mbuffer-20241007.ebuild
index 975b6a812092..b8d79941c431 100644
--- a/sys-block/mbuffer/mbuffer-20241007.ebuild
+++ b/sys-block/mbuffer/mbuffer-20241007.ebuild
@@ -27,6 +27,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-20180410-sysconfdir.patch"
        "${FILESDIR}/${PN}-20200929-find-OBJDUMP.patch"
        "${FILESDIR}/${PN}-20231216-autoconf-warning.patch"
+       "${FILESDIR}/${PN}-20240107-O0-for-libc-name-find.patch"
 )
 
 src_prepare() {

Reply via email to