grub-devel
[Top][All Lists]
Advanced

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

Re: Issue in netbsd_bootinfo.h


From: Grégoire Sutre
Subject: Re: Issue in netbsd_bootinfo.h
Date: Thu, 10 Nov 2011 00:42:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20111010 Iceowl/1.0b2 Icedove/3.1.15

On 11/09/2011 01:14 AM, Seth Goldberg wrote:
Hi,

The following structure definition is causing linker failures (not with GNU
ld) when building GRUB2:

struct grub_netbsd_btinfo_bootwedge {
grub_uint32_t biosdev;
grub_disk_addr_t startblk;
grub_uint64_t nblks;
grub_disk_addr_t matchblk;
grub_uint64_t matchnblks;
grub_uint8_t matchhash[16]; /* MD5 hash */
} __packed;


The question is: Is this a valid way to declare a structure with a packed
data structure on NetBSD?

Yes.  IIRC, this struct declaration was inspired from:

http://nxr.netbsd.org/xref/src/sys/arch/x86/include/bootinfo.h#70

> Or did you mean to add "__attribute__((packed))"
there?

Indeed, you're right.  NetBSD defines __packed depending on the
compiler:

http://nxr.netbsd.org/source/xref/src/sys/sys/cdefs.h#314

For GCC, it's "__attribute__((__packed__))" as you said.  Sorry
about that.  I wonder why it didn't cause problems until now, though.

Grégoire




reply via email to

[Prev in Thread] Current Thread [Next in Thread]