misc: Wrap __attribute__((aligned())) in a macro in compiler.hh.
This attribute is gcc specific (also implemented by clang for compatibility), and so should be behind a level of abstraction to make using different compilers easier. Change-Id: I7495f011f617268dd7a589dc0bcf1b3b7f515046 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35976 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#define __ARCH_ARM_LINUX_LINUX_HH__
|
||||
|
||||
#include "arch/arm/utility.hh"
|
||||
#include "base/compiler.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
|
||||
class ArmLinux : public Linux
|
||||
@@ -219,9 +220,9 @@ class ArmLinux32 : public ArmLinux
|
||||
uint32_t st_gid;
|
||||
uint64_t st_rdev;
|
||||
uint8_t __pad3[4];
|
||||
int64_t __attribute__ ((aligned (8))) st_size;
|
||||
M5_ALIGNED(8) int64_t st_size;
|
||||
uint32_t st_blksize;
|
||||
uint64_t __attribute__ ((aligned (8))) st_blocks;
|
||||
M5_ALIGNED(8) uint64_t st_blocks;
|
||||
uint32_t st_atimeX;
|
||||
uint32_t st_atime_nsec;
|
||||
uint32_t st_mtimeX;
|
||||
|
||||
@@ -30,18 +30,8 @@
|
||||
#define __ARCH_MIPS_LINUX_ALIGNED_HH__
|
||||
|
||||
|
||||
/* GCC 3.3.X has a bug in which attributes+typedefs don't work. 3.2.X is fine
|
||||
* as in 3.4.X, but the bug is marked will not fix in 3.3.X so here is
|
||||
* the work around.
|
||||
*/
|
||||
#if (__GNUC__ == 3 && __GNUC_MINOR__ != 3) || __GNUC__ > 3
|
||||
typedef uint64_t uint64_ta __attribute__ ((aligned (8))) ;
|
||||
typedef int64_t int64_ta __attribute__ ((aligned (8))) ;
|
||||
typedef Addr Addr_a __attribute__ ((aligned (8))) ;
|
||||
#else
|
||||
#define uint64_ta uint64_t __attribute__ ((aligned (8)))
|
||||
#define int64_ta int64_t __attribute__ ((aligned (8)))
|
||||
#define Addr_a Addr __attribute__ ((aligned (8)))
|
||||
#endif /* __GNUC__ __GNUC_MINOR__ */
|
||||
typedef M5_ALIGNED(8) uint64_t uint64_ta;
|
||||
typedef M5_ALIGNED(8) int64_t int64_ta;
|
||||
typedef M5_ALIGNED(8) Addr Addr_a;
|
||||
|
||||
#endif /* __ARCH_MIPS_LINUX_ALIGNED_HH__ */
|
||||
|
||||
@@ -99,6 +99,9 @@
|
||||
# define M5_LOCAL [[gnu::visibility("hidden")]]
|
||||
# define M5_WEAK [[gnu::weak]]
|
||||
|
||||
// Force an alignment for a variable.
|
||||
# define M5_ALIGNED(alignment) [[gnu::aligned(alignment)]]
|
||||
|
||||
// Marker for what should be an unreachable point in the code.
|
||||
# define M5_UNREACHABLE __builtin_unreachable()
|
||||
|
||||
|
||||
@@ -657,7 +657,7 @@ class ScalarBase : public DataWrap<Derived, ScalarInfoProxy>
|
||||
|
||||
protected:
|
||||
/** The storage of this stat. */
|
||||
char storage[sizeof(Storage)] __attribute__ ((aligned (8)));
|
||||
M5_ALIGNED(8) char storage[sizeof(Storage)];
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -1878,7 +1878,7 @@ class DistBase : public DataWrap<Derived, DistInfoProxy>
|
||||
|
||||
protected:
|
||||
/** The storage for this stat. */
|
||||
char storage[sizeof(Storage)] __attribute__ ((aligned (8)));
|
||||
M5_ALIGNED(8) char storage[sizeof(Storage)];
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user