diff options
Diffstat (limited to 'meta/recipes-core/glibc/ldconfig-native-2.12.1')
3 files changed, 258 insertions, 1 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/ldconfig-handle-.dynstr-located-in-separate-segment.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-handle-.dynstr-located-in-separate-segment.patch new file mode 100644 index 0000000000..36f04adfde --- /dev/null +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-handle-.dynstr-located-in-separate-segment.patch | |||
@@ -0,0 +1,178 @@ | |||
1 | From 864054a6cb971688a181316b8227ae0361b4d69e Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Schwab <schwab@suse.de> | ||
3 | Date: Wed, 9 Oct 2019 17:46:47 +0200 | ||
4 | Subject: [PATCH] ldconfig: handle .dynstr located in separate segment (bug | ||
5 | 25087) | ||
6 | |||
7 | To determine the load offset of the DT_STRTAB section search for the | ||
8 | segment containing it, instead of using the load offset of the first | ||
9 | segment. | ||
10 | |||
11 | Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=58e8f5fd2ba47b6dc47fd4d0a35e4175c7c87aaa] | ||
12 | |||
13 | Backported: ported to support endianness and 32/64 bits. | ||
14 | Signed-off-by: Fabien Mahot <fabien.mahot@external.desouttertools.com> | ||
15 | --- | ||
16 | readelflib.c | 86 +++++++++++++++++++++++++++++++--------------------- | ||
17 | 1 file changed, 52 insertions(+), 34 deletions(-) | ||
18 | |||
19 | diff --git a/readelflib.c b/readelflib.c | ||
20 | index a01e1cede3..380aed563d 100644 | ||
21 | --- a/readelflib.c | ||
22 | +++ b/readelflib.c | ||
23 | @@ -80,7 +80,6 @@ process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
24 | { | ||
25 | int i; | ||
26 | unsigned int j; | ||
27 | - Elf32_Addr loadaddr; | ||
28 | unsigned int dynamic_addr; | ||
29 | size_t dynamic_size; | ||
30 | char *program_interpreter; | ||
31 | @@ -110,7 +109,6 @@ process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
32 | libc5/libc6. */ | ||
33 | *flag = FLAG_ELF; | ||
34 | |||
35 | - loadaddr = -1; | ||
36 | dynamic_addr = 0; | ||
37 | dynamic_size = 0; | ||
38 | program_interpreter = NULL; | ||
39 | @@ -121,11 +119,6 @@ process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
40 | |||
41 | switch (read32(segment->p_type, be)) | ||
42 | { | ||
43 | - case PT_LOAD: | ||
44 | - if (loadaddr == (Elf32_Addr) -1) | ||
45 | - loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be); | ||
46 | - break; | ||
47 | - | ||
48 | case PT_DYNAMIC: | ||
49 | if (dynamic_addr) | ||
50 | error (0, 0, _("more than one dynamic segment\n")); | ||
51 | @@ -188,11 +181,6 @@ process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
52 | } | ||
53 | |||
54 | } | ||
55 | - if (loadaddr == (Elf32_Addr) -1) | ||
56 | - { | ||
57 | - /* Very strange. */ | ||
58 | - loadaddr = 0; | ||
59 | - } | ||
60 | |||
61 | /* Now we can read the dynamic sections. */ | ||
62 | if (dynamic_size == 0) | ||
63 | @@ -208,11 +196,32 @@ process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
64 | { | ||
65 | check_ptr (dyn_entry); | ||
66 | if (read32(dyn_entry->d_tag, be) == DT_STRTAB) | ||
67 | - { | ||
68 | - dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr); | ||
69 | - check_ptr (dynamic_strings); | ||
70 | - break; | ||
71 | - } | ||
72 | + { | ||
73 | + /* Find the file offset of the segment containing the dynamic | ||
74 | + string table. */ | ||
75 | + Elf32_Off loadoff = -1; | ||
76 | + for (i = 0, segment = elf_pheader; | ||
77 | + i < read16(elf_header->e_phnum, be); i++, segment++) | ||
78 | + { | ||
79 | + if (read32(segment->p_type, be) == PT_LOAD | ||
80 | + && read32(dyn_entry->d_un.d_val, be) >= read32(segment->p_vaddr, be) | ||
81 | + && (read32(dyn_entry->d_un.d_val, be) - read32(segment->p_vaddr, be) | ||
82 | + < read32(segment->p_filesz, be))) | ||
83 | + { | ||
84 | + loadoff = read32(segment->p_vaddr, be) - read32(segment->p_offset, be); | ||
85 | + break; | ||
86 | + } | ||
87 | + } | ||
88 | + if (loadoff == (Elf32_Off) -1) | ||
89 | + { | ||
90 | + /* Very strange. */ | ||
91 | + loadoff = 0; | ||
92 | + } | ||
93 | + | ||
94 | + dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadoff); | ||
95 | + check_ptr (dynamic_strings); | ||
96 | + break; | ||
97 | + } | ||
98 | } | ||
99 | |||
100 | if (dynamic_strings == NULL) | ||
101 | @@ -269,7 +278,6 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
102 | { | ||
103 | int i; | ||
104 | unsigned int j; | ||
105 | - Elf64_Addr loadaddr; | ||
106 | Elf64_Addr dynamic_addr; | ||
107 | Elf64_Xword dynamic_size; | ||
108 | char *program_interpreter; | ||
109 | @@ -347,7 +355,6 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | - loadaddr = -1; | ||
114 | dynamic_addr = 0; | ||
115 | dynamic_size = 0; | ||
116 | program_interpreter = NULL; | ||
117 | @@ -358,11 +365,6 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
118 | |||
119 | switch (read32(segment->p_type, be)) | ||
120 | { | ||
121 | - case PT_LOAD: | ||
122 | - if (loadaddr == (Elf64_Addr) -1) | ||
123 | - loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be); | ||
124 | - break; | ||
125 | - | ||
126 | case PT_DYNAMIC: | ||
127 | if (dynamic_addr) | ||
128 | error (0, 0, _("more than one dynamic segment\n")); | ||
129 | @@ -426,11 +428,6 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
130 | } | ||
131 | |||
132 | } | ||
133 | - if (loadaddr == (Elf64_Addr) -1) | ||
134 | - { | ||
135 | - /* Very strange. */ | ||
136 | - loadaddr = 0; | ||
137 | - } | ||
138 | |||
139 | /* Now we can read the dynamic sections. */ | ||
140 | if (dynamic_size == 0) | ||
141 | @@ -446,11 +443,32 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, | ||
142 | { | ||
143 | check_ptr (dyn_entry); | ||
144 | if (read64(dyn_entry->d_tag, be) == DT_STRTAB) | ||
145 | - { | ||
146 | - dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr); | ||
147 | - check_ptr (dynamic_strings); | ||
148 | - break; | ||
149 | - } | ||
150 | + { | ||
151 | + /* Find the file offset of the segment containing the dynamic | ||
152 | + string table. */ | ||
153 | + Elf64_Off loadoff = -1; | ||
154 | + for (i = 0, segment = elf_pheader; | ||
155 | + i < read16(elf_header->e_phnum, be); i++, segment++) | ||
156 | + { | ||
157 | + if (read64(segment->p_type, be) == PT_LOAD | ||
158 | + && read64(dyn_entry->d_un.d_val, be) >= read64(segment->p_vaddr, be) | ||
159 | + && (read64(dyn_entry->d_un.d_val, be) - read64(segment->p_vaddr, be) | ||
160 | + < read64(segment->p_filesz, be))) | ||
161 | + { | ||
162 | + loadoff = read64(segment->p_vaddr, be) - read64(segment->p_offset, be); | ||
163 | + break; | ||
164 | + } | ||
165 | + } | ||
166 | + if (loadoff == (Elf32_Off) -1) | ||
167 | + { | ||
168 | + /* Very strange. */ | ||
169 | + loadoff = 0; | ||
170 | + } | ||
171 | + | ||
172 | + dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadoff); | ||
173 | + check_ptr (dynamic_strings); | ||
174 | + break; | ||
175 | + } | ||
176 | } | ||
177 | |||
178 | if (dynamic_strings == NULL) | ||
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch index 52986e61c7..d1835c7a10 100644 --- a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch | |||
@@ -400,7 +400,7 @@ Index: ldconfig-native-2.12.1/ldconfig.c | |||
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | +#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org" | 403 | +#define REPORT_BUGS_TO "mailing list : poky@lists.yoctoproject.org" |
404 | /* Print bug-reporting information in the help message. */ | 404 | /* Print bug-reporting information in the help message. */ |
405 | static char * | 405 | static char * |
406 | more_help (int key, const char *text, void *input) | 406 | more_help (int key, const char *text, void *input) |