News for hackers. Stuff that matters.
Re:A bug story: data alignment on x86 by qb45 on Monday November 07, 2016 @03:05PM (#12894514)
Must have been supported for a while because this stuff is even used in Linux:

  #define __packed2__     __attribute__((packed, aligned(2)))
  
  /*
   * SystemV FS comes in two variants:
   * sysv2: System V Release 2 (e.g. Microport), structure elements aligned(2).
   * sysv4: System V Release 4 (e.g. Consensys), structure elements aligned(4).
   */
  
  struct sysv2_super_block {
          __fs16  s_isize;                /* index of first data zone */
          __fs32  s_fsize __packed2__;    /* total number of zones of this fs */
http://lxr.free-electrons.com/source/include/linux/sysv_fs.h...
Re:A bug story: data alignment on x86 by codys on Monday November 07, 2016 @03:08PM (#12894537)
Note the use of `packed`. `packed` causes the alignment to be set as small as possible (1 byte). The aligned(2) that follows then increases the alignment from 1 byte to 2 bytes.
Re:A bug story: data alignment on x86 by qb45 on Monday November 07, 2016 @03:20PM (#12894660)
Yeah, you're right. Add packed then if you want but I swear the code I posted works on 5.4 as it is.