[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 03/57] Use GCC __BIGGEST_ALIGNMENT__ for sos-po
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 03/57] Use GCC __BIGGEST_ALIGNMENT__ for sos-pool MAX_ALIGN |
Date: |
Fri, 21 Sep 2012 14:11:04 +0300 |
Use the __BIGGEST_ALIGNMENT__ macro provided by GCC for sos_alloc()
allocation alignment. The macro gives ``the largest alignment ever used
for any data type on the target machine you are compiling for.''
__BIGGEST_ALIGNMENT__ also has some other nice properties, e.g. it is
power-of-two on all architectures (note that on i386, sizeof(long
double) = 12), and on some architectures (e.g. SuperH) the alignment
requirement can be lower than sizeof(long double).
---
src/mi/mempool.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/mi/mempool.c b/src/mi/mempool.c
index 6fb5afe..b49202b 100644
--- a/src/mi/mempool.c
+++ b/src/mi/mempool.c
@@ -25,7 +25,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
#include "libunwind_i.h"
-#define MAX_ALIGN (sizeof (long double))
+/* From GCC docs: ``Gcc also provides a target specific macro
+ * __BIGGEST_ALIGNMENT__, which is the largest alignment ever used for any data
+ * type on the target machine you are compiling for.'' */
+#ifdef __BIGGEST_ALIGNMENT__
+# define MAX_ALIGN __BIGGEST_ALIGNMENT__
+#else
+# define MAX_ALIGN (sizeof (long double))
+#endif
static char sos_memory[SOS_MEMORY_SIZE];
static char *sos_memp;
--
1.7.9.5
- [Libunwind-devel] [PATCH 00/57] patchset v2, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 02/57] Remove unneeded `atomic_ops.h' inclusion in `dwarf.h', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 03/57] Use GCC __BIGGEST_ALIGNMENT__ for sos-pool MAX_ALIGN,
Tommi Rantala <=
- [Libunwind-devel] [PATCH 08/57] Use __sync builtin atomics on all architectures if available, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 01/57] Pull attribute macros from `libunwind_i.h' to new header `compiler.h', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 07/57] Remove unneeded `cmpxchg_ptr()' from include/libunwind_i.h, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 06/57] Simplify `sos_alloc()' implementation, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 04/57] Workaround non-power-of-two i386 sizeof(long double) in src/mi/mempool.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 15/57] HPPA: kludge out unused variable in unw_get_save_loc() stub, Tommi Rantala, 2012/09/21