[klibc] [PATCH klibc 4/5] ppc64: fix struct stat

Ben Hutchings ben at decadent.org.uk
Tue Jan 5 16:44:16 PST 2016

From: Aurelien Jarno <aurelien at aurel32.net>

On ppc64 the struct stat defined by klibc matches the kernel one.
However it contains implicit padding before the st_rdev field due to the
64-bit alignement. For internal reasons, klibc defines st_rdev as a pair
of 32-bit values (using the __stdev64 macro). They only need to be
32-bit aligned and as a consequence st->st_rdev is incorrectly defined.

The solution is to add an explicit padding in the structure. This fixes
the resume binary on ppc64 BE and LE, and probably other things.

Signed-off-by: Aurelien Jarno <aurelien at aurel32.net>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
 usr/include/arch/ppc64/klibc/archstat.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr/include/arch/ppc64/klibc/archstat.h b/usr/include/arch/ppc64/klibc/archstat.h
index 918d810..0bbbff3 100644
--- a/usr/include/arch/ppc64/klibc/archstat.h
+++ b/usr/include/arch/ppc64/klibc/archstat.h
@@ -12,6 +12,7 @@ struct stat {
 	mode_t		st_mode;
 	uid_t 		st_uid;
 	gid_t 		st_gid;
+	unsigned int	__pad1;
 	__stdev64	(st_rdev);
 	off_t		st_size;
 	unsigned long  	st_blksize;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <http://www.zytor.com/pipermail/klibc/attachments/20160106/9004f9c3/attachment.sig>

More information about the klibc mailing list