summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/acpica
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-02-23 18:48:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-28 11:26:31 +0000
commitd656298e1438c9c5a2979a1c76f5cdb804a267fb (patch)
treea4746e4d6a5568a8eb1db0f14512d641a5b683ae /meta/recipes-extended/acpica
parent8f2ace5e1b396ad97b8e9cc88e7bb773d18acd21 (diff)
downloadopenembedded-core-contrib-d656298e1438c9c5a2979a1c76f5cdb804a267fb.tar.gz
acpica: fix compilation with musl
Manipulating stderr after freopen() fails as done by upstream does not work with musl. The replacement is Unix specific and uses open()/dup2(). Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/acpica')
-rw-r--r--meta/recipes-extended/acpica/acpica_20150515.bb1
-rw-r--r--meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch71
2 files changed, 72 insertions, 0 deletions
diff --git a/meta/recipes-extended/acpica/acpica_20150515.bb b/meta/recipes-extended/acpica/acpica_20150515.bb
index c23b4910d2..b55f353241 100644
--- a/meta/recipes-extended/acpica/acpica_20150515.bb
+++ b/meta/recipes-extended/acpica/acpica_20150515.bb
@@ -19,6 +19,7 @@ DEPENDS = "bison flex"
SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix2-${PV}.tar.gz \
file://no-werror.patch \
file://rename-yy_scan_string-manually.patch \
+ file://manipulate-fds-instead-of-FILE.patch \
"
SRC_URI[md5sum] = "2bc4a7ccc82de9df9fa964f784ecb29c"
SRC_URI[sha256sum] = "61204ec56d71bc9bfa2ee2ade4c66f7e8541772ac72ef8ccc20b3f339cc96374"
diff --git a/meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch b/meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch
new file mode 100644
index 0000000000..6944bb7aa0
--- /dev/null
+++ b/meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch
@@ -0,0 +1,71 @@
+From 33a57979738e5ab13950ec1c0e7298e41ef50929 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Thu, 23 Feb 2017 18:10:47 +0100
+Subject: [PATCH] aslfiles.c: manipulate fds instead of FILE
+
+Copying what stdout/stderr point to is not portable and fails with
+musl because FILE is an undefined struct.
+
+Instead, use lower-level Unix functions to modify the file that stderr
+writes into. This works on the platforms that Yocto targets.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ source/compiler/aslfiles.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
+index 947e465..7a352b4 100644
+--- a/source/compiler/aslfiles.c
++++ b/source/compiler/aslfiles.c
+@@ -44,6 +44,11 @@
+ #include "aslcompiler.h"
+ #include "acapps.h"
+
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <unistd.h>
++
+ #define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslfiles")
+
+@@ -569,6 +574,8 @@ FlOpenMiscOutputFiles (
+
+ if (Gbl_DebugFlag)
+ {
++ int fd;
++
+ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
+ if (!Filename)
+ {
+@@ -582,20 +589,15 @@ FlOpenMiscOutputFiles (
+ /* TBD: hide this behind a FlReopenFile function */
+
+ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
+- Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
+- freopen (Filename, "w+t", stderr);
+-
+- if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle)
++ fd = open(Filename, O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
++ if (fd < 0 ||
++ dup2(fd, fileno(stderr)))
+ {
+- /*
+- * A problem with freopen is that on error,
+- * we no longer have stderr.
+- */
+ Gbl_DebugFlag = FALSE;
+- memcpy (stderr, stdout, sizeof (FILE));
+ FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME);
+ AslAbort ();
+ }
++ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = stderr;
+
+ AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
+ AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
+--
+2.1.4
+