Skip to content

Commit

Permalink
crypto: LLVMLinux: aligned-attribute.patch
Browse files Browse the repository at this point in the history
__attribute__((aligned)) applies the default alignment for the largest scalar
type for the target ABI. gcc allows it to be applied inline to a defined type.
Clang only allows it to be applied to a type definition (PR11071).

Making it into 2 lines makes it more readable and works with both compilers.

Author: Mark Charlebois <[email protected]>
Signed-off-by: Mark Charlebois <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
  • Loading branch information
mcharleb authored and behanw committed Jun 7, 2014
1 parent d4c5491 commit 66d8ea5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/shash.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ EXPORT_SYMBOL_GPL(crypto_shash_setkey);
static inline unsigned int shash_align_buffer_size(unsigned len,
unsigned long mask)
{
return len + (mask & ~(__alignof__(u8 __attribute__ ((aligned))) - 1));
typedef u8 __attribute__ ((aligned)) u8_aligned;
return len + (mask & ~(__alignof__(u8_aligned) - 1));
}

static int shash_update_unaligned(struct shash_desc *desc, const u8 *data,
Expand Down

0 comments on commit 66d8ea5

Please sign in to comment.