This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH v2] Use latest FreeBSD definition for DIRSIZ
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: newlib at sourceware dot org
- Date: Tue, 2 Apr 2013 13:38:22 +0200
- Subject: Re: [PATCH v2] Use latest FreeBSD definition for DIRSIZ
- References: <1364468303-7319-1-git-send-email-sebastian dot huber at embedded-brains dot de> <1364480150-19758-1-git-send-email-sebastian dot huber at embedded-brains dot de> <515451CF dot 6080109 at embedded-brains dot de>
- Reply-to: newlib at sourceware dot org
On Mar 28 15:21, Sebastian Huber wrote:
> On 03/28/2013 03:15 PM, Sebastian Huber wrote:
> This is a direct copy of DIRSIZ() from the FreeBSD sources:
>
> http://svnweb.freebsd.org/base/head/lib/libc/gen/scandir.c?revision=202693&view=markup
>
> The "sizeof(struct dirent) - sizeof(dp)->d_name" is not identical to
> "offsetof (struct dirent, d_name)". For example on PowerPC with the
> RTEMS definition for struct dirent we have an off_t field which is
> 64-bit. This results in 64-bit aligned size of struct dirent per
> PowerPC ABI. If I compare patch v1 with v2 we have:
>
> --- 1.txt 2013-03-28 15:08:05.742963772 +0100
> +++ 2.txt 2013-03-28 15:08:16.034922388 +0100
> @@ -1,5 +1,5 @@
>
> -./scandir.o-v1: file format elf32-powerpc
> +./scandir.o-v2: file format elf32-powerpc
>
>
> Disassembly of section .text:
> @@ -79,7 +79,7 @@
> 11c: 48 00 00 01 bl 11c <scandir+0x11c>
> 120: 38 63 00 04 addi r3,r3,4
> 124: 54 63 00 3a rlwinm r3,r3,0,0,29
> - 128: 38 63 00 14 addi r3,r3,20
> + 128: 38 63 00 18 addi r3,r3,24
> 12c: 48 00 00 01 bl 12c <scandir+0x12c>
> 130: 7f e4 fb 78 mr r4,r31
> 134: 7c 7f 1b 79 mr. r31,r3
Ok, I can see how the extra 4 bytes are a bad thing for embedded targets.
I applied your original patch.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat