Port-m68k archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Natural alignment used on NetBSD/m68k



> Having been a Mac developer way back when, I know a lot of older
> 68K platforms used two-byte alignment; it doesn't surprise me
> that NetBSD a.out would use it too. I suspect the same is true
> of SunOS; unfortunately I'm not in a position to power up my
> Sun-3/60C at the moment to check what SunOS 4.1.1_U1 uses.
> If someone has SunOS running in TME then it should be
> straightforward to get this information though.

https://gist.github.com/tsutsui/60e8f10a0153d834393640cb52c9f521

(typed from the above screenshot)

---
# dmesg | head -8

Feb 15 12:38
SunOS Release 4.1.1 (GENERIC) #1: Sat Oct 13 06:05:48 PDT 1990
Copyright (c) 1983-1990, Sun Microsystems, Inc.
mem = 24576K (0x18000000)
avail mem = 23486464
Ethernet address = 8:0:20:0:0:3
si at vme24d16 0x200000 vec 0x40
# uname -a
SunOS ferrari 4.1.1 1 sun3
# cat test.c
#include <stdio.h>
#include <sys/stdtypes.h>

#define offsetof(type, member) ((size_t)(unsigned long)(&((type *)0)->member))

struct test { char x; int y; };

int main()
{
    printf("struct test { char x; int y; };\n");
    printf("sizeof(sturct test) = %d\n", sizeof(struct test));
    printf("offsetof(struct test, y) = %d\n", offsetof(struct test, y));
}
# cc test.c
# file a.out
a.out:		mc68020 demand paged dynamically linked executable not stripped
# ./a.out
struct test { char x; int y; };
sizeof(struct test) = 6
offsetof(struct test, y) = 2
# 

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index