* Issue in netbsd_bootinfo.h
@ 2011-11-09 0:14 Seth Goldberg
2011-11-09 23:42 ` Grégoire Sutre
0 siblings, 1 reply; 3+ messages in thread
From: Seth Goldberg @ 2011-11-09 0:14 UTC (permalink / raw)
To: grub-devel
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? Or did you mean to add "__attribute__((packed))"
there? The linker error is due to multiply-defined __packed symbols:
ld: fatal: symbol '__packed' is multiply-defined:
(file loader/i386/bsd_module-bsd.o type=OBJT; file loader/i386/bsd_module-bsd32.o type=OBJT);
ld: fatal: symbol '__packed' is multiply-defined:
(file loader/i386/bsd_module-bsd.o type=OBJT; file loader/i386/bsd_module-bsd64.o type=OBJT);
ld: fatal: file processing errors. No output written to bsd.module
--S
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Issue in netbsd_bootinfo.h
2011-11-09 0:14 Issue in netbsd_bootinfo.h Seth Goldberg
@ 2011-11-09 23:42 ` Grégoire Sutre
2011-11-09 23:57 ` Seth Goldberg
0 siblings, 1 reply; 3+ messages in thread
From: Grégoire Sutre @ 2011-11-09 23:42 UTC (permalink / raw)
To: The development of GNU GRUB
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Issue in netbsd_bootinfo.h
2011-11-09 23:42 ` Grégoire Sutre
@ 2011-11-09 23:57 ` Seth Goldberg
0 siblings, 0 replies; 3+ messages in thread
From: Seth Goldberg @ 2011-11-09 23:57 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1465 bytes --]
Hi,
Great. My guess is: some linkers are more forgiving than others. Can you
get this fixed for non-Netbsd platforms where __packed is undefined, please?
Thanks,
--S
Quoting Grégoire Sutre, who wrote the following on Thu, 10 Nov 2011:
> 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
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-09 23:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 0:14 Issue in netbsd_bootinfo.h Seth Goldberg
2011-11-09 23:42 ` Grégoire Sutre
2011-11-09 23:57 ` Seth Goldberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.