From: Mark Wielaard <mark@klomp.org>
To: Ulf Hermann <ulf.hermann@qt.io>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH v2] Make sure packed structs follow the gcc memory layout
Date: Sat, 19 Aug 2017 08:11:00 -0000 [thread overview]
Message-ID: <20170818204959.GC3169@stream> (raw)
In-Reply-To: <01f496b4-a384-64a0-4263-7df28098e8fe@qt.io>
On Fri, Aug 18, 2017 at 02:05:10PM +0200, Ulf Hermann wrote:
> gcc defaults to using struct layouts that follow the native conventions,
> even if __attribute__((packed)) is given. In order to get the layout we
> expect, we need to tell gcc to always use the gcc struct layout, at
> least for packed structs. To do this, we can use the gcc_struct
> attribute.
>
> This is important, not only for porting to windows, but also potentially
> for other platforms, as the bugs resulting from struct layout
> differences are rather subtle and hard to find.
I don't have internet access at the moment to lookup the documentation
for gcc_struct. And none of the sources I have locally at the moment
seem to use gcc_struct. So I am not completely clear on why this is
only needed for packed structs. Wouldn't this be a general problem for
any struct that might be layed out differently but that we might map
to some on-disk data structure?
Cheers,
Mark
next prev parent reply other threads:[~2017-08-19 8:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 12:05 Ulf Hermann
2017-08-19 8:11 ` Mark Wielaard [this message]
[not found] <603c23c4-05f2-4cc9-8081-1065774486c6@email.android.com>
2017-09-20 22:01 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170818204959.GC3169@stream \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=ulf.hermann@qt.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).