diff options
author | Christoph Muellner <christophm30@gmail.com> | 2021-06-28 02:44:46 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-06-29 22:18:56 +0100 |
commit | 1b67bcdfd2e2b329c44e446bbf7aa3a41be25449 (patch) | |
tree | 510aa66f9cd7581a3661cca4d782ff8f4fc3608b /meta/recipes-core | |
parent | a79b5f0f2139bbd77df31704944630c8a5a0b562 (diff) | |
download | poky-1b67bcdfd2e2b329c44e446bbf7aa3a41be25449.tar.gz |
ldconfig-native: Add RISC-V support
The current version of ldconfig does not support RISC-V.
Let's add a patch, that adds the required constant definitions
(from upstream glibc) and the necessary case statements.
(From OE-Core rev: 790a0634838ab44f8f39db647401886667846b59)
Signed-off-by: Christoph Muellner <cmuellner@linux.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch | 79 | ||||
-rw-r--r-- | meta/recipes-core/glibc/ldconfig-native_2.12.1.bb | 1 |
2 files changed, 80 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch new file mode 100644 index 0000000000..fc41aee264 --- /dev/null +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From fd50228cc213d2d87f5e3cf1f123acb3fda9b04e Mon Sep 17 00:00:00 2001 | ||
2 | From: Christoph Muellner <cmuellner@linux.com> | ||
3 | Date: Mon, 28 Jun 2021 00:34:12 +0200 | ||
4 | Subject: [PATCH] ldconfig: Add RISC-V support | ||
5 | |||
6 | ldconfig-native does not support RISC-V at the moment. | ||
7 | Let's pull the reqired constants from upstream and add | ||
8 | the required parsing code. | ||
9 | |||
10 | Upstream-Status: Backport | ||
11 | |||
12 | Signed-off-by: Christoph Muellner <cmuellner@linux.com> | ||
13 | --- | ||
14 | cache.c | 6 ++++++ | ||
15 | ldconfig.h | 2 ++ | ||
16 | readelflib.c | 10 ++++++++++ | ||
17 | 3 files changed, 18 insertions(+) | ||
18 | |||
19 | diff --git a/cache.c b/cache.c | ||
20 | index c4f5411..a3b9e70 100644 | ||
21 | --- a/cache.c | ||
22 | +++ b/cache.c | ||
23 | @@ -125,6 +125,12 @@ print_entry (const char *lib, int flag, unsigned int osversion, | ||
24 | case FLAG_AARCH64_LIB64: | ||
25 | fputs (",AArch64", stdout); | ||
26 | break; | ||
27 | + case FLAG_RISCV_FLOAT_ABI_SOFT: | ||
28 | + fputs (",soft-float", stdout); | ||
29 | + break; | ||
30 | + case FLAG_RISCV_FLOAT_ABI_DOUBLE: | ||
31 | + fputs (",double-float", stdout); | ||
32 | + break; | ||
33 | case 0: | ||
34 | break; | ||
35 | default: | ||
36 | diff --git a/ldconfig.h b/ldconfig.h | ||
37 | index 6a8a750..2e5e379 100644 | ||
38 | --- a/ldconfig.h | ||
39 | +++ b/ldconfig.h | ||
40 | @@ -38,6 +38,8 @@ | ||
41 | #define FLAG_ARM_LIBHF 0x0900 | ||
42 | #define FLAG_AARCH64_LIB64 0x0a00 | ||
43 | #define FLAG_ARM_LIBSF 0x0b00 | ||
44 | +#define FLAG_RISCV_FLOAT_ABI_SOFT 0x0f00 | ||
45 | +#define FLAG_RISCV_FLOAT_ABI_DOUBLE 0x1000 | ||
46 | |||
47 | /* Name of auxiliary cache. */ | ||
48 | #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache" | ||
49 | diff --git a/readelflib.c b/readelflib.c | ||
50 | index 9ec0a54..a01e1ce 100644 | ||
51 | --- a/readelflib.c | ||
52 | +++ b/readelflib.c | ||
53 | @@ -33,6 +33,10 @@ | ||
54 | #define EM_AARCH64 183 /* ARM AARCH64 */ | ||
55 | #endif | ||
56 | |||
57 | +#ifndef EM_RISCV | ||
58 | +#define EM_RISCV 243 /* RISC-V */ | ||
59 | +#endif | ||
60 | + | ||
61 | #undef check_ptr | ||
62 | #define check_ptr(ptr) \ | ||
63 | do \ | ||
64 | @@ -331,6 +335,12 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
65 | /* see sysdeps/unix/sysv/linux/arm/readelflib.c */ | ||
66 | *flag |= FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6; | ||
67 | break; | ||
68 | + case EM_RISCV: | ||
69 | + /* RISC-V libraries are always libc.so.6+. */ | ||
70 | + /* NOTE: This does not correctly handle soft-float binaries */ | ||
71 | + /* see sysdeps/unix/sysv/linux/riscv/readelflib.c */ | ||
72 | + *flag |= FLAG_RISCV_FLOAT_ABI_DOUBLE|FLAG_ELF_LIBC6; | ||
73 | + break; | ||
74 | default: | ||
75 | error(0, 0, "%s is a 64-bit ELF for unknown machine %lx\n", | ||
76 | file_name, (long)elf_header->e_machine); | ||
77 | -- | ||
78 | 2.25.1 | ||
79 | |||
diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb index 919d11417d..fd1630b73b 100644 --- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb +++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb | |||
@@ -15,6 +15,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \ | |||
15 | file://endian-ness_handling_fix.patch \ | 15 | file://endian-ness_handling_fix.patch \ |
16 | file://add-64-bit-flag-for-ELF64-entries.patch \ | 16 | file://add-64-bit-flag-for-ELF64-entries.patch \ |
17 | file://no-aux-cache.patch \ | 17 | file://no-aux-cache.patch \ |
18 | file://add-riscv-support.patch \ | ||
18 | " | 19 | " |
19 | 20 | ||
20 | PR = "r2" | 21 | PR = "r2" |