public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: salevin@lgc.com
To: gcc-gnats@gcc.gnu.org
Subject: target/5855: stat.h mods for malign-double x386 compatibility
Date: Wed, 06 Mar 2002 12:36:00 -0000	[thread overview]
Message-ID: <20020306203128.32098.qmail@sources.redhat.com> (raw)


>Number:         5855
>Category:       target
>Synopsis:       stat.h mods for malign-double x386 compatibility
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 06 12:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stewart A. Levin
>Release:        gcc 3.0.1
>Organization:
>Environment:
Pentium II, RedHat 7.1, gcc built with thread support
>Description:
I'm attached a patch for /usr/include/bits/stat.h that
preserves structure offsets on x386 platforms independent
of the malign-double compiler option.
>How-To-Repeat:
#!/bin/csh -f
set OPTIONS = "-DLINUX -march=pentium -mieee-fp -D__NO_STRING_INLINES -D__USE_EXTERN_INLINES -D_POSIX_C_SOURCE=199309 -D_BSD_SOURCE -D_REENTRANT -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=32"
set DEFINES = "-DLINUX -DLGC_DEFINED -DOW50"
set LDFLAGS = "-L/usr/local/lib -L/usr/X11R6/lib"
set CLIBS = "-lpthread -lg2c"

gcc $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
gcc -I. $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
#gcc -malign-double $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
gcc -I. -malign-double $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
set OPTIONS="$OPTIONS -D_FILE_OFFSET_BITS=64"
gcc $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
gcc -I. $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
#gcc -malign-double $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
gcc -I. -malign-double $OPTIONS $DEFINES teststat.c $LDFLAGS $CLIBS && ./a.out
>Fix:
*** /usr/include/bits/stat.h	Fri Aug 10 05:11:03 2001
--- bits/stat.h	Sat Feb  9 09:17:43 2002
***************
*** 20,25 ****
--- 20,39 ----
  # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
  #endif
  
+ #ifdef __GNUC__
+ #ifndef _STAT_PAD_ATTR
+ #if defined(__i386__)
+ #define _STAT_PAD_ATTR  __attribute__ ((__aligned__ (4),__packed__))
+ #else
+ #define _STAT_PAD_ATTR
+ #endif
+ #endif
+ #else /* __GNUC__ */
+ #ifndef _STAT_PAD_ATTR
+ #define _STAT_PAD_ATTR
+ #endif
+ #endif/* __GNUC__ */
+ 
  /* Versions of the `struct stat' data structure.  */
  #define _STAT_VER_LINUX_OLD	1
  #define _STAT_VER_KERNEL	1
***************
*** 51,57 ****
  #ifndef __USE_FILE_OFFSET64
      __off_t st_size;			/* Size of file, in bytes.  */
  #else
!     __off64_t st_size;			/* Size of file, in bytes.  */
  #endif
      __blksize_t st_blksize;		/* Optimal block size for I/O.  */
  
--- 65,71 ----
  #ifndef __USE_FILE_OFFSET64
      __off_t st_size;			/* Size of file, in bytes.  */
  #else
!     __off64_t st_size _STAT_PAD_ATTR;		/* Size of file, in bytes.  */
  #endif
      __blksize_t st_blksize;		/* Optimal block size for I/O.  */
  
***************
*** 87,93 ****
      __gid_t st_gid;			/* Group ID of the file's group.*/
      __dev_t st_rdev;			/* Device number, if device.  */
      unsigned int __pad2;
!     __off64_t st_size;			/* Size of file, in bytes.  */
      __blksize_t st_blksize;		/* Optimal block size for I/O.  */
  
      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
--- 101,107 ----
      __gid_t st_gid;			/* Group ID of the file's group.*/
      __dev_t st_rdev;			/* Device number, if device.  */
      unsigned int __pad2;
!     __off64_t st_size _STAT_PAD_ATTR;		/* Size of file, in bytes.  */
      __blksize_t st_blksize;		/* Optimal block size for I/O.  */
  
      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
***************
*** 132,134 ****
--- 146,150 ----
  #define	__S_IREAD	0400	/* Read by owner.  */
  #define	__S_IWRITE	0200	/* Write by owner.  */
  #define	__S_IEXEC	0100	/* Execute by owner.  */
+ 
+ #undef _STAT_PAD_ATTR
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-unknown-content-type-cfile; name="teststat.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="teststat.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4KI2luY2x1ZGUgPHN5cy9z
dGF0Lmg+CmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikKewogY2hhciBjMTsKIHN0cnVj
dCBzdGF0IGExOwogc2hvcnQgczE7CiBzdHJ1Y3Qgc3RhdDY0IGEyOwoKIGZwcmludGYoc3Rkb3V0
LCJzaXplb2Yoc3RhdCk9JWx1IHNpemVvZihzdGF0NjQpPSVsdSBvZmYoc3RhdC5zdF9pbm8pPSVs
dSBvZmYoc3RhdC5fX3N0X2lubyk9JWx1IG9mZihzdGF0NjQuc3RfaW5vKT0lbHUgb2ZmKHN0YXQ2
NC5fX3N0X2lubyk9JWx1XG4iLAogICBzaXplb2Yoc3RydWN0IHN0YXQpLCBzaXplb2Yoc3RydWN0
IHN0YXQ2NCksIAogICgoY2hhciAqKSAmKGExLnN0X2lubykpIC0gKChjaGFyICopICYoYTEuc3Rf
ZGV2KSksCiAgKChjaGFyICopICYoYTEuX19zdF9pbm8pKSAtICgoY2hhciAqKSAmKGExLnN0X2Rl
dikpLAogICgoY2hhciAqKSAmKGEyLnN0X2lubykpIC0gKChjaGFyICopICYoYTIuc3RfZGV2KSks
CiAgKChjaGFyICopICYoYTIuX19zdF9pbm8pKSAtICgoY2hhciAqKSAmKGEyLnN0X2RldikpCiAg
KTsKCiAgcmV0dXJuIDA7Cn0K


             reply	other threads:[~2002-03-06 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-06 12:36 salevin [this message]
2002-03-29 16:02 rth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020306203128.32098.qmail@sources.redhat.com \
    --to=salevin@lgc.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).