diff options
author | Nitin A Kamble <nitin.a.kamble@intel.com> | 2011-03-29 12:55:18 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-04-04 23:56:31 +0100 |
commit | f897723207b00b4c9dcdb43107891b7b82ce22f3 (patch) | |
tree | d429a853ef252a1cf887c822535012c33ebf4d26 /meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch | |
parent | 1418414e9d8d5ebbf38b95be8c0ce83dbe4b525f (diff) | |
download | poky-f897723207b00b4c9dcdb43107891b7b82ce22f3.tar.gz |
ldconfig-native-2.12.1: newer recipe with eglibc sources
This fixes [YOCTO #780]
Handle the input/output data with different endian-ness correctly
Also fix the definition of LD_SO for cross environment
And remove the older 2.5 version of ldconfig-native recipe
(From OE-Core rev: 694db055f3729662e0e0193a31f2098be599877f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch')
-rw-r--r-- | meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch | 451 |
1 files changed, 451 insertions, 0 deletions
diff --git a/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch new file mode 100644 index 0000000000..77ba03c1af --- /dev/null +++ b/meta/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch | |||
@@ -0,0 +1,451 @@ | |||
1 | Do data input/output handling according to endien-ness of the library file. | ||
2 | |||
3 | 2011/04/04 | ||
4 | Richard Purdie <richard.purdie@linuxfoundation.org> | ||
5 | Nitin Kamble <nitin.a.kamble@intel.com> | ||
6 | |||
7 | Index: ldconfig-native-2.12.1/readelflib.c | ||
8 | =================================================================== | ||
9 | --- ldconfig-native-2.12.1.orig/readelflib.c | ||
10 | +++ ldconfig-native-2.12.1/readelflib.c | ||
11 | @@ -38,6 +38,28 @@ do \ | ||
12 | } \ | ||
13 | while (0); | ||
14 | |||
15 | +int be; | ||
16 | +static uint16_t read16(uint16_t x, int be) | ||
17 | +{ | ||
18 | + if (be) | ||
19 | + return be16toh(x); | ||
20 | + return le16toh(x); | ||
21 | +} | ||
22 | + | ||
23 | +static uint32_t read32(uint32_t x, int be) | ||
24 | +{ | ||
25 | + if (be) | ||
26 | + return be32toh(x); | ||
27 | + return le32toh(x); | ||
28 | +} | ||
29 | + | ||
30 | +static uint64_t read64(uint64_t x, int be) | ||
31 | +{ | ||
32 | + if (be) | ||
33 | + return be64toh(x); | ||
34 | + return le64toh(x); | ||
35 | +} | ||
36 | + | ||
37 | /* Returns 0 if everything is ok, != 0 in case of error. */ | ||
38 | int | ||
39 | process_elf_file32 (const char *file_name, const char *lib, int *flag, | ||
40 | @@ -59,15 +81,17 @@ process_elf_file32 (const char *file_nam | ||
41 | elf_header = (Elf32_Ehdr *) file_contents; | ||
42 | *osversion = 0; | ||
43 | |||
44 | - if (elf_header->e_type != ET_DYN) | ||
45 | + be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); | ||
46 | + | ||
47 | + if (read16(elf_header->e_type, be) != ET_DYN) | ||
48 | { | ||
49 | error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, | ||
50 | - elf_header->e_type); | ||
51 | + read16(elf_header->e_type, be)); | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | /* Get information from elf program header. */ | ||
56 | - elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); | ||
57 | + elf_pheader = (Elf32_Phdr *) (read32(elf_header->e_phoff, be) + file_contents); | ||
58 | check_ptr (elf_pheader); | ||
59 | |||
60 | /* The library is an elf library, now search for soname and | ||
61 | @@ -79,27 +103,27 @@ process_elf_file32 (const char *file_nam | ||
62 | dynamic_size = 0; | ||
63 | program_interpreter = NULL; | ||
64 | for (i = 0, segment = elf_pheader; | ||
65 | - i < elf_header->e_phnum; i++, segment++) | ||
66 | + i < read16(elf_header->e_phnum, be); i++, segment++) | ||
67 | { | ||
68 | check_ptr (segment); | ||
69 | |||
70 | - switch (segment->p_type) | ||
71 | + switch (read32(segment->p_type, be)) | ||
72 | { | ||
73 | case PT_LOAD: | ||
74 | if (loadaddr == (Elf32_Addr) -1) | ||
75 | - loadaddr = segment->p_vaddr - segment->p_offset; | ||
76 | + loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be); | ||
77 | break; | ||
78 | |||
79 | case PT_DYNAMIC: | ||
80 | if (dynamic_addr) | ||
81 | error (0, 0, _("more than one dynamic segment\n")); | ||
82 | |||
83 | - dynamic_addr = segment->p_offset; | ||
84 | - dynamic_size = segment->p_filesz; | ||
85 | + dynamic_addr = read32(segment->p_offset, be); | ||
86 | + dynamic_size = read32(segment->p_filesz, be); | ||
87 | break; | ||
88 | |||
89 | case PT_INTERP: | ||
90 | - program_interpreter = (char *) (file_contents + segment->p_offset); | ||
91 | + program_interpreter = (char *) (file_contents + read32(segment->p_offset, be)); | ||
92 | check_ptr (program_interpreter); | ||
93 | |||
94 | /* Check if this is enough to classify the binary. */ | ||
95 | @@ -113,20 +137,20 @@ process_elf_file32 (const char *file_nam | ||
96 | break; | ||
97 | |||
98 | case PT_NOTE: | ||
99 | - if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) | ||
100 | + if (!*osversion && read32(segment->p_filesz, be) >= 32 && segment->p_align >= 4) | ||
101 | { | ||
102 | Elf32_Word *abi_note = (Elf32_Word *) (file_contents | ||
103 | - + segment->p_offset); | ||
104 | - Elf32_Addr size = segment->p_filesz; | ||
105 | + + read32(segment->p_offset, be)); | ||
106 | + Elf32_Addr size = read32(segment->p_filesz, be); | ||
107 | |||
108 | - while (abi_note [0] != 4 || abi_note [1] != 16 | ||
109 | - || abi_note [2] != 1 | ||
110 | + while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 | ||
111 | + || read32(abi_note [2], be) != 1 | ||
112 | || memcmp (abi_note + 3, "GNU", 4) != 0) | ||
113 | { | ||
114 | -#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) | ||
115 | - Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) | ||
116 | - + ROUND (abi_note[0]) | ||
117 | - + ROUND (abi_note[1]); | ||
118 | +#define ROUND(len) (((len) + sizeof (Elf32_Word) - 1) & -sizeof (Elf32_Word)) | ||
119 | + Elf32_Addr note_size = 3 * sizeof (Elf32_Word) | ||
120 | + + ROUND (read32(abi_note[0], be)) | ||
121 | + + ROUND (read32(abi_note[1], be)); | ||
122 | |||
123 | if (size - 32 < note_size || note_size == 0) | ||
124 | { | ||
125 | @@ -140,10 +164,10 @@ process_elf_file32 (const char *file_nam | ||
126 | if (size == 0) | ||
127 | break; | ||
128 | |||
129 | - *osversion = (abi_note [4] << 24) | | ||
130 | - ((abi_note [5] & 0xff) << 16) | | ||
131 | - ((abi_note [6] & 0xff) << 8) | | ||
132 | - (abi_note [7] & 0xff); | ||
133 | + *osversion = (read32(abi_note [4], be) << 24) | | ||
134 | + ((read32(abi_note [5], be) & 0xff) << 16) | | ||
135 | + ((read32(abi_note [6], be) & 0xff) << 8) | | ||
136 | + (read32(abi_note [7], be) & 0xff); | ||
137 | } | ||
138 | break; | ||
139 | |||
140 | @@ -167,13 +191,13 @@ process_elf_file32 (const char *file_nam | ||
141 | |||
142 | /* Find the string table. */ | ||
143 | dynamic_strings = NULL; | ||
144 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
145 | + for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; | ||
146 | ++dyn_entry) | ||
147 | { | ||
148 | check_ptr (dyn_entry); | ||
149 | - if (dyn_entry->d_tag == DT_STRTAB) | ||
150 | + if (read32(dyn_entry->d_tag, be) == DT_STRTAB) | ||
151 | { | ||
152 | - dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); | ||
153 | + dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr); | ||
154 | check_ptr (dynamic_strings); | ||
155 | break; | ||
156 | } | ||
157 | @@ -183,15 +207,15 @@ process_elf_file32 (const char *file_nam | ||
158 | return 1; | ||
159 | |||
160 | /* Now read the DT_NEEDED and DT_SONAME entries. */ | ||
161 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
162 | + for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; | ||
163 | ++dyn_entry) | ||
164 | { | ||
165 | - if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) | ||
166 | + if (read32(dyn_entry->d_tag, be) == DT_NEEDED || read32(dyn_entry->d_tag, be) == DT_SONAME) | ||
167 | { | ||
168 | - char *name = dynamic_strings + dyn_entry->d_un.d_val; | ||
169 | + char *name = dynamic_strings + read32(dyn_entry->d_un.d_val, be); | ||
170 | check_ptr (name); | ||
171 | |||
172 | - if (dyn_entry->d_tag == DT_NEEDED) | ||
173 | + if (read32(dyn_entry->d_tag, be) == DT_NEEDED) | ||
174 | { | ||
175 | |||
176 | if (*flag == FLAG_ELF) | ||
177 | @@ -208,7 +232,7 @@ process_elf_file32 (const char *file_nam | ||
178 | } | ||
179 | } | ||
180 | |||
181 | - else if (dyn_entry->d_tag == DT_SONAME) | ||
182 | + else if (read32(dyn_entry->d_tag, be) == DT_SONAME) | ||
183 | *soname = xstrdup (name); | ||
184 | |||
185 | /* Do we have everything we need? */ | ||
186 | @@ -246,15 +270,17 @@ process_elf_file64 (const char *file_nam | ||
187 | elf_header = (Elf64_Ehdr *) file_contents; | ||
188 | *osversion = 0; | ||
189 | |||
190 | - if (elf_header->e_type != ET_DYN) | ||
191 | + be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); | ||
192 | + | ||
193 | + if (read16(elf_header->e_type, be) != ET_DYN) | ||
194 | { | ||
195 | error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, | ||
196 | - elf_header->e_type); | ||
197 | + read16(elf_header->e_type, be)); | ||
198 | return 1; | ||
199 | } | ||
200 | |||
201 | /* Get information from elf program header. */ | ||
202 | - elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); | ||
203 | + elf_pheader = (Elf64_Phdr *) (read64(elf_header->e_phoff, be) + file_contents); | ||
204 | check_ptr (elf_pheader); | ||
205 | |||
206 | /* The library is an elf library, now search for soname and | ||
207 | @@ -266,27 +292,27 @@ process_elf_file64 (const char *file_nam | ||
208 | dynamic_size = 0; | ||
209 | program_interpreter = NULL; | ||
210 | for (i = 0, segment = elf_pheader; | ||
211 | - i < elf_header->e_phnum; i++, segment++) | ||
212 | + i < read16(elf_header->e_phnum, be); i++, segment++) | ||
213 | { | ||
214 | check_ptr (segment); | ||
215 | |||
216 | - switch (segment->p_type) | ||
217 | + switch (read32(segment->p_type, be)) | ||
218 | { | ||
219 | case PT_LOAD: | ||
220 | if (loadaddr == (Elf64_Addr) -1) | ||
221 | - loadaddr = segment->p_vaddr - segment->p_offset; | ||
222 | + loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be); | ||
223 | break; | ||
224 | |||
225 | case PT_DYNAMIC: | ||
226 | if (dynamic_addr) | ||
227 | error (0, 0, _("more than one dynamic segment\n")); | ||
228 | |||
229 | - dynamic_addr = segment->p_offset; | ||
230 | - dynamic_size = segment->p_filesz; | ||
231 | + dynamic_addr = read64(segment->p_offset, be); | ||
232 | + dynamic_size = read32(segment->p_filesz, be); | ||
233 | break; | ||
234 | |||
235 | case PT_INTERP: | ||
236 | - program_interpreter = (char *) (file_contents + segment->p_offset); | ||
237 | + program_interpreter = (char *) (file_contents + read64(segment->p_offset, be)); | ||
238 | check_ptr (program_interpreter); | ||
239 | |||
240 | /* Check if this is enough to classify the binary. */ | ||
241 | @@ -300,20 +326,21 @@ process_elf_file64 (const char *file_nam | ||
242 | break; | ||
243 | |||
244 | case PT_NOTE: | ||
245 | - if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) | ||
246 | + if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4) | ||
247 | { | ||
248 | Elf64_Word *abi_note = (Elf64_Word *) (file_contents | ||
249 | - + segment->p_offset); | ||
250 | - Elf64_Addr size = segment->p_filesz; | ||
251 | + + read64(segment->p_offset, be)); | ||
252 | + Elf64_Addr size = read32(segment->p_filesz, be); | ||
253 | |||
254 | - while (abi_note [0] != 4 || abi_note [1] != 16 | ||
255 | - || abi_note [2] != 1 | ||
256 | + while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 | ||
257 | + || read32(abi_note [2], be) != 1 | ||
258 | || memcmp (abi_note + 3, "GNU", 4) != 0) | ||
259 | { | ||
260 | +#undef ROUND | ||
261 | #define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) | ||
262 | Elf64_Addr note_size = 3 * sizeof (Elf64_Word) | ||
263 | - + ROUND (abi_note[0]) | ||
264 | - + ROUND (abi_note[1]); | ||
265 | + + ROUND (read32(abi_note[0], be)) | ||
266 | + + ROUND (read32(abi_note[1], be)); | ||
267 | |||
268 | if (size - 32 < note_size || note_size == 0) | ||
269 | { | ||
270 | @@ -327,10 +354,10 @@ process_elf_file64 (const char *file_nam | ||
271 | if (size == 0) | ||
272 | break; | ||
273 | |||
274 | - *osversion = (abi_note [4] << 24) | | ||
275 | - ((abi_note [5] & 0xff) << 16) | | ||
276 | - ((abi_note [6] & 0xff) << 8) | | ||
277 | - (abi_note [7] & 0xff); | ||
278 | + *osversion = (read32(abi_note [4], be) << 24) | | ||
279 | + ((read32(abi_note [5], be) & 0xff) << 16) | | ||
280 | + ((read32(abi_note [6], be) & 0xff) << 8) | | ||
281 | + (read32(abi_note [7], be) & 0xff); | ||
282 | } | ||
283 | break; | ||
284 | |||
285 | @@ -354,13 +381,13 @@ process_elf_file64 (const char *file_nam | ||
286 | |||
287 | /* Find the string table. */ | ||
288 | dynamic_strings = NULL; | ||
289 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
290 | + for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; | ||
291 | ++dyn_entry) | ||
292 | { | ||
293 | check_ptr (dyn_entry); | ||
294 | - if (dyn_entry->d_tag == DT_STRTAB) | ||
295 | + if (read64(dyn_entry->d_tag, be) == DT_STRTAB) | ||
296 | { | ||
297 | - dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); | ||
298 | + dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr); | ||
299 | check_ptr (dynamic_strings); | ||
300 | break; | ||
301 | } | ||
302 | @@ -370,15 +397,15 @@ process_elf_file64 (const char *file_nam | ||
303 | return 1; | ||
304 | |||
305 | /* Now read the DT_NEEDED and DT_SONAME entries. */ | ||
306 | - for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; | ||
307 | + for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; | ||
308 | ++dyn_entry) | ||
309 | { | ||
310 | - if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) | ||
311 | + if (read64(dyn_entry->d_tag, be) == DT_NEEDED || read64(dyn_entry->d_tag, be) == DT_SONAME) | ||
312 | { | ||
313 | - char *name = dynamic_strings + dyn_entry->d_un.d_val; | ||
314 | + char *name = dynamic_strings + read64(dyn_entry->d_un.d_val, be); | ||
315 | check_ptr (name); | ||
316 | |||
317 | - if (dyn_entry->d_tag == DT_NEEDED) | ||
318 | + if (read64(dyn_entry->d_tag, be) == DT_NEEDED) | ||
319 | { | ||
320 | |||
321 | if (*flag == FLAG_ELF) | ||
322 | @@ -395,7 +422,7 @@ process_elf_file64 (const char *file_nam | ||
323 | } | ||
324 | } | ||
325 | |||
326 | - else if (dyn_entry->d_tag == DT_SONAME) | ||
327 | + else if (read64(dyn_entry->d_tag, be) == DT_SONAME) | ||
328 | *soname = xstrdup (name); | ||
329 | |||
330 | /* Do we have everything we need? */ | ||
331 | Index: ldconfig-native-2.12.1/readlib.c | ||
332 | =================================================================== | ||
333 | --- ldconfig-native-2.12.1.orig/readlib.c | ||
334 | +++ ldconfig-native-2.12.1/readlib.c | ||
335 | @@ -169,7 +169,8 @@ process_file (const char *real_file_name | ||
336 | ret = 1; | ||
337 | } | ||
338 | /* Libraries have to be shared object files. */ | ||
339 | - else if (elf_header->e_type != ET_DYN) | ||
340 | + else if ((elf_header->e_ident[EI_DATA] == ELFDATA2MSB && be16toh(elf_header->e_type) != ET_DYN) || | ||
341 | + (elf_header->e_ident[EI_DATA] == ELFDATA2LSB && le16toh(elf_header->e_type) != ET_DYN)) | ||
342 | ret = 1; | ||
343 | else if (process_elf_file (file_name, lib, flag, osversion, soname, | ||
344 | file_contents, statbuf.st_size)) | ||
345 | Index: ldconfig-native-2.12.1/cache.c | ||
346 | =================================================================== | ||
347 | --- ldconfig-native-2.12.1.orig/cache.c | ||
348 | +++ ldconfig-native-2.12.1/cache.c | ||
349 | @@ -39,6 +39,29 @@ | ||
350 | # define N_(msgid) msgid | ||
351 | #define _(msg) msg | ||
352 | |||
353 | +extern int be; | ||
354 | + | ||
355 | +static uint16_t write16(uint16_t x, int be) | ||
356 | +{ | ||
357 | + if (be) | ||
358 | + return htobe16(x); | ||
359 | + return htole16(x); | ||
360 | +} | ||
361 | + | ||
362 | +static uint32_t write32(uint32_t x, int be) | ||
363 | +{ | ||
364 | + if (be) | ||
365 | + return htobe32(x); | ||
366 | + return htole32(x); | ||
367 | +} | ||
368 | + | ||
369 | +static uint64_t write64(uint64_t x, int be) | ||
370 | +{ | ||
371 | + if (be) | ||
372 | + return htobe64(x); | ||
373 | + return htole64(x); | ||
374 | +} | ||
375 | + | ||
376 | struct cache_entry | ||
377 | { | ||
378 | char *lib; /* Library name. */ | ||
379 | @@ -279,7 +302,12 @@ save_cache (const char *cache_name) | ||
380 | /* Number of normal cache entries. */ | ||
381 | int cache_entry_old_count = 0; | ||
382 | |||
383 | - for (entry = entries; entry != NULL; entry = entry->next) | ||
384 | + if (be) | ||
385 | + printf("saving cache in big endian encoding\n"); | ||
386 | + else | ||
387 | + printf("saving cache in little endian encoding\n"); | ||
388 | + | ||
389 | + for (entry = entries; entry != NULL; entry = entry->next) | ||
390 | { | ||
391 | /* Account the final NULs. */ | ||
392 | total_strlen += strlen (entry->lib) + strlen (entry->path) + 2; | ||
393 | @@ -310,7 +338,7 @@ save_cache (const char *cache_name) | ||
394 | memset (file_entries, '\0', sizeof (struct cache_file)); | ||
395 | memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1); | ||
396 | |||
397 | - file_entries->nlibs = cache_entry_old_count; | ||
398 | + file_entries->nlibs = write32(cache_entry_old_count, be); | ||
399 | } | ||
400 | |||
401 | struct cache_file_new *file_entries_new = NULL; | ||
402 | @@ -330,8 +358,8 @@ save_cache (const char *cache_name) | ||
403 | memcpy (file_entries_new->version, CACHE_VERSION, | ||
404 | sizeof CACHE_VERSION - 1); | ||
405 | |||
406 | - file_entries_new->nlibs = cache_entry_count; | ||
407 | - file_entries_new->len_strings = total_strlen; | ||
408 | + file_entries_new->nlibs = write32(cache_entry_count, be); | ||
409 | + file_entries_new->len_strings = write32(total_strlen, be); | ||
410 | } | ||
411 | |||
412 | /* Pad for alignment of cache_file_new. */ | ||
413 | @@ -358,9 +386,9 @@ save_cache (const char *cache_name) | ||
414 | /* First the library. */ | ||
415 | if (opt_format != 2 && entry->hwcap == 0) | ||
416 | { | ||
417 | - file_entries->libs[idx_old].flags = entry->flags; | ||
418 | + file_entries->libs[idx_old].flags = write32(entry->flags, be); | ||
419 | /* XXX: Actually we can optimize here and remove duplicates. */ | ||
420 | - file_entries->libs[idx_old].key = str_offset + pad; | ||
421 | + file_entries->libs[idx_old].key = write32(str_offset + pad, be); | ||
422 | } | ||
423 | if (opt_format != 0) | ||
424 | { | ||
425 | @@ -368,10 +396,10 @@ save_cache (const char *cache_name) | ||
426 | not doing so makes the code easier, the string table | ||
427 | always begins at the beginning of the the new cache | ||
428 | struct. */ | ||
429 | - file_entries_new->libs[idx_new].flags = entry->flags; | ||
430 | - file_entries_new->libs[idx_new].osversion = entry->osversion; | ||
431 | - file_entries_new->libs[idx_new].hwcap = entry->hwcap; | ||
432 | - file_entries_new->libs[idx_new].key = str_offset; | ||
433 | + file_entries_new->libs[idx_new].flags = write32(entry->flags, be); | ||
434 | + file_entries_new->libs[idx_new].osversion = write32(entry->osversion, be); | ||
435 | + file_entries_new->libs[idx_new].hwcap = write64(entry->hwcap, be); | ||
436 | + file_entries_new->libs[idx_new].key = write32(str_offset, be); | ||
437 | } | ||
438 | |||
439 | size_t len = strlen (entry->lib) + 1; | ||
440 | @@ -379,9 +407,9 @@ save_cache (const char *cache_name) | ||
441 | str_offset += len; | ||
442 | /* Then the path. */ | ||
443 | if (opt_format != 2 && entry->hwcap == 0) | ||
444 | - file_entries->libs[idx_old].value = str_offset + pad; | ||
445 | + file_entries->libs[idx_old].value = write32(str_offset + pad, be); | ||
446 | if (opt_format != 0) | ||
447 | - file_entries_new->libs[idx_new].value = str_offset; | ||
448 | + file_entries_new->libs[idx_new].value = write32(str_offset, be); | ||
449 | len = strlen (entry->path) + 1; | ||
450 | str = mempcpy (str, entry->path, len); | ||
451 | str_offset += len; | ||