diff options
author | Khem Raj <raj.khem@gmail.com> | 2018-12-09 16:53:16 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2018-12-09 16:53:16 -0800 |
commit | 2a3c90d2ab095b5181de7066963c3b63e990f2a3 (patch) | |
tree | c5959c4b6497c3b016ab947baa9030948378bee5 | |
parent | 8a44578984db2bdd05182ce7e6bcedd9c6d9c66b (diff) | |
download | meta-openembedded-2a3c90d2ab095b5181de7066963c3b63e990f2a3.tar.gz |
klibc: Fix build with clang
Newer versions of clang optimize the calls to use unlocked variants of
these functions
Fixes
| capabilities.c:(.text+0xb4): undefined reference to `fread_unlocked'
| arm-yoe-linux-gnueabi-ld.bfd: capabilities.c:(.text+0x11a): undefined
reference to `fwrite_unlocked'
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andrea Adami <andrea.adami@gmail.com>
-rw-r--r-- | meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch | 49 | ||||
-rw-r--r-- | meta-initramfs/recipes-devtools/klibc/klibc.inc | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch new file mode 100644 index 000000000..eee144dc4 --- /dev/null +++ b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From 241f423a015279cb29b7ad1a34386ef1c32007fc Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 9 Dec 2018 16:47:16 -0800 | ||
4 | Subject: [PATCH] Define ulocked_{fgets|fread|fwrite} aliases | ||
5 | |||
6 | latest clang converts the normal calls to the unlocked variant | ||
7 | equivalents | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | Cc: Andrea Adami <andrea.adami@gmail.com> | ||
11 | --- | ||
12 | usr/klibc/fgets.c | 2 ++ | ||
13 | usr/klibc/fread2.c | 2 ++ | ||
14 | usr/klibc/fwrite2.c | 2 ++ | ||
15 | 3 files changed, 6 insertions(+) | ||
16 | |||
17 | diff --git a/usr/klibc/fgets.c b/usr/klibc/fgets.c | ||
18 | index dbf742c6..2e9fcb65 100644 | ||
19 | --- a/usr/klibc/fgets.c | ||
20 | +++ b/usr/klibc/fgets.c | ||
21 | @@ -25,3 +25,5 @@ char *fgets(char *s, int n, FILE *f) | ||
22 | |||
23 | return s; | ||
24 | } | ||
25 | +char *fgets_unlocked(char *s, int n, FILE *f) | ||
26 | + __alias("fgets"); | ||
27 | diff --git a/usr/klibc/fread2.c b/usr/klibc/fread2.c | ||
28 | index 7dca56b1..5c234766 100644 | ||
29 | --- a/usr/klibc/fread2.c | ||
30 | +++ b/usr/klibc/fread2.c | ||
31 | @@ -11,3 +11,5 @@ size_t fread(void *ptr, size_t size, size_t nmemb, FILE * f) | ||
32 | { | ||
33 | return _fread(ptr, size * nmemb, f) / size; | ||
34 | } | ||
35 | +size_t fread_unlocked(void *ptr, size_t size, size_t nmemb, FILE *f) | ||
36 | + __alias("fread"); | ||
37 | diff --git a/usr/klibc/fwrite2.c b/usr/klibc/fwrite2.c | ||
38 | index cebc017c..3e0bb57d 100644 | ||
39 | --- a/usr/klibc/fwrite2.c | ||
40 | +++ b/usr/klibc/fwrite2.c | ||
41 | @@ -11,3 +11,5 @@ size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE * f) | ||
42 | { | ||
43 | return _fwrite(ptr, size * nmemb, f) / size; | ||
44 | } | ||
45 | +size_t fwrite_unlocked(void *ptr, size_t size, size_t nmemb, FILE *f) | ||
46 | + __alias("fwrite"); | ||
47 | -- | ||
48 | 2.19.2 | ||
49 | |||
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc b/meta-initramfs/recipes-devtools/klibc/klibc.inc index 398dfd1cf..ec52e9734 100644 --- a/meta-initramfs/recipes-devtools/klibc/klibc.inc +++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc | |||
@@ -24,6 +24,7 @@ SRC_URI = "git://git.kernel.org/pub/scm/libs/klibc/klibc.git \ | |||
24 | file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \ | 24 | file://0001-klibc_2.0.4-add-kexec_file_load-syscall.patch \ |
25 | file://0001-klibc-add-getrandom-syscall.patch \ | 25 | file://0001-klibc-add-getrandom-syscall.patch \ |
26 | file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \ | 26 | file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \ |
27 | file://0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch \ | ||
27 | " | 28 | " |
28 | 29 | ||
29 | ARMPATCHES ?= "" | 30 | ARMPATCHES ?= "" |