1 |
bluebird 08/11/17 22:34:49 |
2 |
|
3 |
Added: zziplib-0.13.49-sparc-aligned-access.patch |
4 |
Log: |
5 |
Fix a bus error on sparc and add ~sparc keyword, bug #239472 |
6 |
(Portage version: 2.2_rc14/cvs/Linux 2.6.28-rc5-00019-ge14c8bf sparc64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-libs/zziplib/files/zziplib-0.13.49-sparc-aligned-access.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/zziplib/files/zziplib-0.13.49-sparc-aligned-access.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/zziplib/files/zziplib-0.13.49-sparc-aligned-access.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: zziplib-0.13.49-sparc-aligned-access.patch |
15 |
=================================================================== |
16 |
This patch for zziplib (0.13.49) fixes a bus error on Linux/SPARC. |
17 |
|
18 |
Since SPARC machines are big endian and zip files are stored in little endian, |
19 |
zziplib needs to do byte swapping. On GNU/Linux this is usually done using |
20 |
glibc's bswap_{16,32,64} functions but in this case calling one of these |
21 |
functions triggers a bus error. This patch makes zziplib use it's own byte |
22 |
swapping functions (which do work) on Linux/SPARC instead of glibc's. |
23 |
|
24 |
To reproduce it run (in the src dir): |
25 |
cd Linux_*_sparc64.d && ./bins/zzcat test/test/README |
26 |
or |
27 |
make check |
28 |
|
29 |
Problem found by: Ferris McCormick <fmccor@g.o> |
30 |
Patch written by: Friedrich Oslage <bluebird@g.o> |
31 |
with advice from: Mike Frysinger <vapier@g.o> |
32 |
|
33 |
External references: https://bugs.gentoo.org/show_bug.cgi?id=239472 |
34 |
|
35 |
--- zzip/fetch.c |
36 |
+++ zzip/fetch.c |
37 |
@@ -17,7 +17,7 @@ |
38 |
#include <zzip/fetch.h> |
39 |
|
40 |
#if defined ZZIP_WORDS_BIGENDIAN && \ |
41 |
- defined bswap_16 && defined bswap_32 && defined bswap_64 |
42 |
+ defined bswap_16 && defined bswap_32 && defined bswap_64 && !defined(__sparc__) |
43 |
# define __ZZIP_GET16(__p) bswap_16(*(uint16_t*)(__p)) |
44 |
# define __ZZIP_GET32(__p) bswap_32(*(uint32_t*)(__p)) |
45 |
# define __ZZIP_SET16(__p,__x) (*(uint16_t*)(__p) = bswap_16((uint16_t)(__x))) |
46 |
--- zzip/fetch.h |
47 |
+++ zzip/fetch.h |
48 |
@@ -24,7 +24,7 @@ extern uint64_t __zzip_get64(zzip_byte_t * s) __zzip_attribute__((const)); |
49 |
extern void __zzip_set64(zzip_byte_t * s, uint64_t v); |
50 |
|
51 |
#ifdef ZZIP_WORDS_BIGENDIAN |
52 |
-# if defined bswap_16 && defined bswap_32 && defined bswap_64 /* i.e. linux */ |
53 |
+# if defined bswap_16 && defined bswap_32 && defined bswap_64 && !defined(__sparc__) /* i.e. linux */ |
54 |
# define ZZIP_GET16(__p) bswap_16(*(uint16_t*)(__p)) |
55 |
# define ZZIP_GET32(__p) bswap_32(*(uint32_t*)(__p)) |
56 |
# define ZZIP_GET64(__p) bswap_64(*(uint64_t*)(__p)) |