diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2017-02-23 18:48:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-01 11:17:44 +0000 |
commit | 76a4a4e8a48b5917113be1caf8e298a637ae047b (patch) | |
tree | 103cf6f5747905449f28700c6c1799fd568e874f /meta | |
parent | 7a309065c169cead5563701ef8e9298bcff44d1d (diff) | |
download | poky-76a4a4e8a48b5917113be1caf8e298a637ae047b.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().
(From OE-Core rev: d656298e1438c9c5a2979a1c76f5cdb804a267fb)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-extended/acpica/acpica_20150515.bb | 1 | ||||
-rw-r--r-- | meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch | 71 |
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" | |||
19 | SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix2-${PV}.tar.gz \ | 19 | SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix2-${PV}.tar.gz \ |
20 | file://no-werror.patch \ | 20 | file://no-werror.patch \ |
21 | file://rename-yy_scan_string-manually.patch \ | 21 | file://rename-yy_scan_string-manually.patch \ |
22 | file://manipulate-fds-instead-of-FILE.patch \ | ||
22 | " | 23 | " |
23 | SRC_URI[md5sum] = "2bc4a7ccc82de9df9fa964f784ecb29c" | 24 | SRC_URI[md5sum] = "2bc4a7ccc82de9df9fa964f784ecb29c" |
24 | SRC_URI[sha256sum] = "61204ec56d71bc9bfa2ee2ade4c66f7e8541772ac72ef8ccc20b3f339cc96374" | 25 | 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 @@ | |||
1 | From 33a57979738e5ab13950ec1c0e7298e41ef50929 Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Ohly <patrick.ohly@intel.com> | ||
3 | Date: Thu, 23 Feb 2017 18:10:47 +0100 | ||
4 | Subject: [PATCH] aslfiles.c: manipulate fds instead of FILE | ||
5 | |||
6 | Copying what stdout/stderr point to is not portable and fails with | ||
7 | musl because FILE is an undefined struct. | ||
8 | |||
9 | Instead, use lower-level Unix functions to modify the file that stderr | ||
10 | writes into. This works on the platforms that Yocto targets. | ||
11 | |||
12 | Upstream-Status: Inappropriate [embedded specific] | ||
13 | |||
14 | Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> | ||
15 | --- | ||
16 | source/compiler/aslfiles.c | 20 +++++++++++--------- | ||
17 | 1 file changed, 11 insertions(+), 9 deletions(-) | ||
18 | |||
19 | diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c | ||
20 | index 947e465..7a352b4 100644 | ||
21 | --- a/source/compiler/aslfiles.c | ||
22 | +++ b/source/compiler/aslfiles.c | ||
23 | @@ -44,6 +44,11 @@ | ||
24 | #include "aslcompiler.h" | ||
25 | #include "acapps.h" | ||
26 | |||
27 | +#include <sys/types.h> | ||
28 | +#include <sys/stat.h> | ||
29 | +#include <fcntl.h> | ||
30 | +#include <unistd.h> | ||
31 | + | ||
32 | #define _COMPONENT ACPI_COMPILER | ||
33 | ACPI_MODULE_NAME ("aslfiles") | ||
34 | |||
35 | @@ -569,6 +574,8 @@ FlOpenMiscOutputFiles ( | ||
36 | |||
37 | if (Gbl_DebugFlag) | ||
38 | { | ||
39 | + int fd; | ||
40 | + | ||
41 | Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG); | ||
42 | if (!Filename) | ||
43 | { | ||
44 | @@ -582,20 +589,15 @@ FlOpenMiscOutputFiles ( | ||
45 | /* TBD: hide this behind a FlReopenFile function */ | ||
46 | |||
47 | Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; | ||
48 | - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = | ||
49 | - freopen (Filename, "w+t", stderr); | ||
50 | - | ||
51 | - if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) | ||
52 | + fd = open(Filename, O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); | ||
53 | + if (fd < 0 || | ||
54 | + dup2(fd, fileno(stderr))) | ||
55 | { | ||
56 | - /* | ||
57 | - * A problem with freopen is that on error, | ||
58 | - * we no longer have stderr. | ||
59 | - */ | ||
60 | Gbl_DebugFlag = FALSE; | ||
61 | - memcpy (stderr, stdout, sizeof (FILE)); | ||
62 | FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME); | ||
63 | AslAbort (); | ||
64 | } | ||
65 | + Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = stderr; | ||
66 | |||
67 | AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); | ||
68 | AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); | ||
69 | -- | ||
70 | 2.1.4 | ||
71 | |||