[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#876186: freebsd-glue: fix ctfutils FTBFS on ppc64el



Package: src:freebsd-glue
Version: 0.2.22
Tags: patch pending
User: debian-powerpc@lists.debian.org
Usertags: ppc64el 

--

Dear maintainer,

I see that the package ctfutils fails to build on ppc64/ppc64el :
https://buildd.debian.org/status/logs.php?pkg=ctfutils&ver=10.3%7Esvn297264-2&suite=sid
On those architectures, the macro in ./ctfutils-10.3~svn297264/sys/cddl/compat/opensolaris/sys/elf.h
#define __sElfN(x) typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x

does not have __ELF_WORD_SIZE defined.
This normally comes from freebsd-glue in /usr/include/freebsd/machine/elf.h where
we have :
#ifndef ELF_ARCH
#include <machine/__get_elf_arch.h>    /* ELF_ARCH */
#endif

and in machine/__get_elf_arch.h :
#define ELF_ARCH 21
#define __ELF_WORD_SIZE 64

On ppc64[el]; ELF_ARCH is already defined by linux-libc-dev in
/usr/include/powerpc64le-linux-gnu/asm/elf.h but I couldn't find any
reference to __ELF_WORD_SIZE. As ELF_ARCH is already define we just
skip inclusion of machine/__get_elf_arch.h and __ELF_WORD_SIZE.

Not sure if that is the good approach to solve that issue, but in the
attached patched, I ifndef-ed ELF_ARCH within get_elf_arch.c to always
include machine/__get_elf_arch.h but skip ELF_ARCH definition (will come
from signal.h that at some point includes asm/elf.h) if not needed while
still defining __ELF_WORD_SIZE.
It looks like letting ctfutils compile properly on ppc64[el] ; other
architecture shouldn't be impacted.

Regards.
F.
diff -Nru freebsd-glue-0.2.22/debian/changelog freebsd-glue-0.2.22+nmu1/debian/changelog
--- freebsd-glue-0.2.22/debian/changelog	2016-03-05 15:44:54.000000000 +0000
+++ freebsd-glue-0.2.22+nmu1/debian/changelog	2017-09-19 07:32:25.000000000 +0000
@@ -1,3 +1,12 @@
+freebsd-glue (0.2.22+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * fix ctfutils package FTBFS on ppc64[el] : selectively export
+    __ELF_WORD_SIZE and ELF_ARCH : on those archs ELF_ARCH is already defined
+    in asm/elf.h but not __ELF_WORD_SIZE
+
+ -- Frédéric Bonnard <frediz@linux.vnet.ibm.com>  Tue, 19 Sep 2017 07:32:25 +0000
+
 freebsd-glue (0.2.22) unstable; urgency=medium
 
   * Actually use the proper build architecture compiler
diff -Nru freebsd-glue-0.2.22/include/machine/elf.h freebsd-glue-0.2.22+nmu1/include/machine/elf.h
--- freebsd-glue-0.2.22/include/machine/elf.h	2014-08-25 19:40:16.000000000 +0000
+++ freebsd-glue-0.2.22+nmu1/include/machine/elf.h	2017-09-18 15:52:44.000000000 +0000
@@ -8,9 +8,7 @@
 #include <sys/elf32.h>
 #include <sys/elf64.h>
 
-#ifndef ELF_ARCH
-#include <machine/__get_elf_arch.h>	/* ELF_ARCH */
-#endif
+#include <machine/__get_elf_arch.h>	/* possible ELF_ARCH and __ELF_WORD_SIZE */
 
 #ifndef ELF_TARG_DATA
 #include <endian.h>
diff -Nru freebsd-glue-0.2.22/src/get_elf_arch.c freebsd-glue-0.2.22+nmu1/src/get_elf_arch.c
--- freebsd-glue-0.2.22/src/get_elf_arch.c	2016-03-02 14:19:59.000000000 +0000
+++ freebsd-glue-0.2.22+nmu1/src/get_elf_arch.c	2017-09-19 07:32:25.000000000 +0000
@@ -2,6 +2,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <elf.h>
+#include <signal.h>
 
 int
 main (int argc, char **argv)
@@ -16,7 +17,9 @@
   if (read (fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
     perror ("read");
 
+#ifndef ELF_ARCH
   printf ("#define ELF_ARCH %u\n", ehdr.e_machine);
+#endif
   printf ("#define __ELF_WORD_SIZE %u\n", ehdr.e_ident[EI_CLASS] == ELFCLASS64 ? 64 : 32);
 
   close (fd);

Attachment: pgpmDexw9VoNN.pgp
Description: PGP signature


Reply to: