public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/5855: stat.h mods for malign-double x386 compatibility
@ 2002-03-29 16:02 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-03-29 16:02 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, salevin

Synopsis: stat.h mods for malign-double x386 compatibility

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Fri Mar 29 16:02:11 2002
State-Changed-Why:
    This is not a gcc issue.  Contact the glibc folk with this.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5855


^ permalink raw reply	[flat|nested] 2+ messages in thread

* target/5855: stat.h mods for malign-double x386 compatibility
@ 2002-03-06 12:36 salevin
  0 siblings, 0 replies; 2+ messages in thread
From: salevin @ 2002-03-06 12:36 UTC (permalink / raw)
  To: gcc-gnats


>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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-30  0:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-29 16:02 target/5855: stat.h mods for malign-double x386 compatibility rth
  -- strict thread matches above, loose matches on Subject: below --
2002-03-06 12:36 salevin

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).