All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] libffi: add patch to fix MIPS support
@ 2017-10-22 13:56 Thomas Petazzoni
  2017-10-22 22:50 ` Peter Korsgaard
  2017-10-25  7:42 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2017-10-22 13:56 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=4852f05907cd365825f37c283a415a77ba1fcba9
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Building Python 3.x on MIPS with musl fails because the libffi code
uses a "#ifdef linux" test to decide if we're building on Linux or
not. When building with -std=c99, "linux" is not defined, so instead
of including <asm/sgidefs.h>, libffi's code tries to include
<sgidefs.h>, which doesn't exist on musl.

The right fix is to use __linux__, which is POSIX compliant, and
therefore defined even when -std=c99 is used.

Note that glibc and uClibc were not affected because they do provide a
<sgidefs.h> header in addition to the <asm/sgidefs.h> one.

Signed-off-by: Mauro Condarelli <mc5686@mclink.it>
[Thomas: reformat patch with Git, add a better commit log and description.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../0005-mips-use-__linux__-and-not-linux.patch    | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/package/libffi/0005-mips-use-__linux__-and-not-linux.patch b/package/libffi/0005-mips-use-__linux__-and-not-linux.patch
new file mode 100644
index 0000000..a48f3d3
--- /dev/null
+++ b/package/libffi/0005-mips-use-__linux__-and-not-linux.patch
@@ -0,0 +1,37 @@
+From 1f43e5edfd91bee80e518432b80db01f1bf226e3 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sun, 22 Oct 2017 15:02:11 +0200
+Subject: [PATCH] mips: use __linux__ and not linux
+
+The "linux" symbol is not POSIX compliant [1], and therefore not
+defined when building with -std=c99. Due to this, the linux
+conditional block doesn't get used on Linux when building Python 3.x
+(which is built with -std=c99). To fix this, we use the POSIX
+compliant __linux__ symbol, which is defined when -std=c99 is used.
+
+This fixes the build of Python 3.x on MIPS/musl configuration, as it
+makes sures that <asm/sgidefs.h> gets included and not <sgidefs.h>.
+
+[1] https://sourceforge.net/p/predef/wiki/OperatingSystems/
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ src/mips/ffitarget.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/mips/ffitarget.h b/src/mips/ffitarget.h
+index 717d659..6faa358 100644
+--- a/src/mips/ffitarget.h
++++ b/src/mips/ffitarget.h
+@@ -32,7 +32,7 @@
+ #error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."
+ #endif
+ 
+-#ifdef linux
++#ifdef __linux__
+ # include <asm/sgidefs.h>
+ #elif defined(__rtems__)
+ /*
+-- 
+2.13.6
+

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [git commit] libffi: add patch to fix MIPS support
  2017-10-22 13:56 [Buildroot] [git commit] libffi: add patch to fix MIPS support Thomas Petazzoni
@ 2017-10-22 22:50 ` Peter Korsgaard
  2017-10-25  7:42 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2017-10-22 22:50 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=4852f05907cd365825f37c283a415a77ba1fcba9
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > Building Python 3.x on MIPS with musl fails because the libffi code
 > uses a "#ifdef linux" test to decide if we're building on Linux or
 > not. When building with -std=c99, "linux" is not defined, so instead
 > of including <asm/sgidefs.h>, libffi's code tries to include
 > <sgidefs.h>, which doesn't exist on musl.

 > The right fix is to use __linux__, which is POSIX compliant, and
 > therefore defined even when -std=c99 is used.

 > Note that glibc and uClibc were not affected because they do provide a
 > <sgidefs.h> header in addition to the <asm/sgidefs.h> one.

 > Signed-off-by: Mauro Condarelli <mc5686@mclink.it>
 > [Thomas: reformat patch with Git, add a better commit log and description.]
 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Committed to 2017.08.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [git commit] libffi: add patch to fix MIPS support
  2017-10-22 13:56 [Buildroot] [git commit] libffi: add patch to fix MIPS support Thomas Petazzoni
  2017-10-22 22:50 ` Peter Korsgaard
@ 2017-10-25  7:42 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2017-10-25  7:42 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=4852f05907cd365825f37c283a415a77ba1fcba9
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > Building Python 3.x on MIPS with musl fails because the libffi code
 > uses a "#ifdef linux" test to decide if we're building on Linux or
 > not. When building with -std=c99, "linux" is not defined, so instead
 > of including <asm/sgidefs.h>, libffi's code tries to include
 > <sgidefs.h>, which doesn't exist on musl.

 > The right fix is to use __linux__, which is POSIX compliant, and
 > therefore defined even when -std=c99 is used.

 > Note that glibc and uClibc were not affected because they do provide a
 > <sgidefs.h> header in addition to the <asm/sgidefs.h> one.

 > Signed-off-by: Mauro Condarelli <mc5686@mclink.it>
 > [Thomas: reformat patch with Git, add a better commit log and description.]
 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Committed to 2017.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-25  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-22 13:56 [Buildroot] [git commit] libffi: add patch to fix MIPS support Thomas Petazzoni
2017-10-22 22:50 ` Peter Korsgaard
2017-10-25  7:42 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.