summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2013-06-28 21:42:19 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-06-28 21:42:19 +0000
commitce61a2ad2e078a19454411832b167444b6c9ae66 (patch)
treecc2ca2f921b2a1dcaea9745fbce745c1615cfd6d /elf
parentef65da39e62ecd49e2b65b0cb6e4c8f75a1ee096 (diff)
downloadglibc-ce61a2ad2e078a19454411832b167444b6c9ae66.tar.gz
Mark packed structure element used with atomic operation aligned.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-profile.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9034be229a..8fa6efca42 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -131,7 +131,18 @@ struct here_cg_arc_record
{
uintptr_t from_pc;
uintptr_t self_pc;
- uint32_t count;
+ /* The count field is atomically incremented in _dl_mcount, which
+ requires it to be properly aligned for its type, and for this
+ alignment to be visible to the compiler. The amount of data
+ before an array of this structure is calculated as
+ expected_size in _dl_start_profile. Everything in that
+ calculation is a multiple of 4 bytes (in the case of
+ kcountsize, because it is derived from a subtraction of
+ page-aligned values, and the corresponding calculation in
+ __monstartup also ensures it is at least a multiple of the size
+ of u_long), so all copies of this field do in fact have the
+ appropriate alignment. */
+ uint32_t count __attribute__ ((aligned (__alignof__ (uint32_t))));
} __attribute__ ((packed));
static struct here_cg_arc_record *data;