commit:     f08e87dd650304c365a439efbb3f52197392d01a
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 14 22:25:23 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jul 14 22:25:32 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f08e87dd

sys-fs/mac-fdisk: workaround link failure on gcc-7

Reported-by: hotaronohanako
Package-Manager: Portage-2.3.42, Repoman-2.3.9

 .../files/mac-fdisk-0.1_p16-ppc-inline.patch        | 21 +++++++++++++++++++++
 sys-fs/mac-fdisk/mac-fdisk-0.1_p16.ebuild           |  4 +++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/sys-fs/mac-fdisk/files/mac-fdisk-0.1_p16-ppc-inline.patch 
b/sys-fs/mac-fdisk/files/mac-fdisk-0.1_p16-ppc-inline.patch
new file mode 100644
index 00000000000..032c68d9637
--- /dev/null
+++ b/sys-fs/mac-fdisk/files/mac-fdisk-0.1_p16-ppc-inline.patch
@@ -0,0 +1,21 @@
+on gcc-7.3.0 build failed as:
+    # CFLAGS="-mcpu=powerpc -Os -pipe" emerge -v1 sys-fs/mac-fdisk
+    cc   fdisk.o fdisklabel.o   -o fdisk
+    fdisk.o: In function `check_consistency':
+    fdisk.c:(.text+0x64): undefined reference to `__swap32'
+    fdisk.c:(.text+0x70): undefined reference to `__swap32'
+
+Avoid exporting inline symbols and workaround build failure.
+--- a/fdisk.c
++++ b/fdisk.c
+@@ -247,8 +247,8 @@ char read_char(char *mesg);
+ jmp_buf listingbuf;
+ 
+-inline unsigned short __swap16(unsigned short x) {
++static inline unsigned short __swap16(unsigned short x) {
+       return (((__u16)(x) & 0xFF) << 8) | (((__u16)(x) & 0xFF00) >> 8);
+ }
+-inline __u32 __swap32(__u32 x) {
++static inline __u32 __swap32(__u32 x) {
+       return (((__u32)(x) & 0xFF) << 24) | (((__u32)(x) & 0xFF00) << 8) | 
(((__u32)(x) & 0xFF0000) >> 8) | (((__u32)(x) & 0xFF000000) >> 24);
+ }

diff --git a/sys-fs/mac-fdisk/mac-fdisk-0.1_p16.ebuild 
b/sys-fs/mac-fdisk/mac-fdisk-0.1_p16.ebuild
index 19b9fff8a39..32ae45a5601 100644
--- a/sys-fs/mac-fdisk/mac-fdisk-0.1_p16.ebuild
+++ b/sys-fs/mac-fdisk/mac-fdisk-0.1_p16.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=5
@@ -34,6 +34,8 @@ src_prepare() {
        ### Note that >=2TB disks may not work due to limitations of the Mac
        ### Partition Table structure, this needs to be investigated
        epatch "${FILESDIR}"/big_pt.patch
+
+       epatch "${FILESDIR}"/${PN}-0.1_p16-ppc-inline.patch
 }
 
 src_compile() {

Reply via email to