aboutsummaryrefslogtreecommitdiffstats
path: root/libinstaller
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-10-22 13:42:31 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2012-10-22 13:42:31 -0700
commit99f5441baa76a44680bf96a2fc01637f64fe3ff5 (patch)
tree02b0f68d523785b9d0764bcd945400fb5c76202f /libinstaller
parentadeae7c9c7079aacb6b36467b81c22eb8b17f002 (diff)
downloadsyslinux-99f5441baa76a44680bf96a2fc01637f64fe3ff5.tar.gz
syslinux-99f5441baa76a44680bf96a2fc01637f64fe3ff5.tar.xz
syslinux-99f5441baa76a44680bf96a2fc01637f64fe3ff5.zip
Packed definition: workaround for mingw + gcc 4.7
__attribute__((packed)) does the wrong thing when in ms-struct mode; this breaks compiling on mingw-w64. Therefore force gcc struct mode when we use packed. This obsoletes checkin 7d9ee65 win: Add -mno-ms-bitfields Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'libinstaller')
-rw-r--r--libinstaller/syslxint.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index 2e317d0e..e5428b79 100644
--- a/libinstaller/syslxint.h
+++ b/libinstaller/syslxint.h
@@ -23,6 +23,17 @@
# define X86_MEM 0
#endif
+#ifdef __GNUC__
+# ifdef __MINGW32__
+ /* gcc 4.7 miscompiles packed structures in MS-bitfield mode */
+# define PACKED __attribute__((packed,gcc_struct))
+# else
+# define PACKED __attribute__((packed))
+# endif
+#else
+# error "Need to define PACKED for this compiler"
+#endif
+
/*
* Access functions for littleendian numbers, possibly misaligned.
*/
@@ -190,7 +201,7 @@ struct ext_patch_area {
struct syslinux_extent {
uint64_t lba;
uint16_t len;
-} __attribute__((packed));
+} PACKED;
/* FAT bootsector format, also used by other disk-based derivatives */
struct fat_boot_sector {
@@ -218,7 +229,7 @@ struct fat_boot_sector {
char VolumeLabel[11];
char FileSysType[8];
uint8_t Code[442];
- } __attribute__ ((packed)) bs16;
+ } PACKED bs16;
struct {
uint32_t FATSz32;
uint16_t ExtFlags;
@@ -234,13 +245,13 @@ struct fat_boot_sector {
char VolumeLabel[11];
char FileSysType[8];
uint8_t Code[414];
- } __attribute__ ((packed)) bs32;
- } __attribute__ ((packed));
+ } PACKED bs32;
+ } PACKED;
uint32_t bsMagic;
uint16_t bsForwardPtr;
uint16_t bsSignature;
-} __attribute__ ((packed));
+} PACKED;
/* NTFS bootsector format */
struct ntfs_boot_sector {
@@ -273,7 +284,7 @@ struct ntfs_boot_sector {
uint32_t bsMagic;
uint16_t bsForwardPtr;
uint16_t bsSignature;
-} __attribute__((packed));
+} PACKED;
#define FAT_bsHead bsJump
#define FAT_bsHeadLen offsetof(struct fat_boot_sector, bsBytesPerSec)