b2d5196452
PR toolchain/56771 Fix profiling on CPUs that do not support unaligned memory access; Allocate objects (referenced from struct gmonparam) with proper alignments. For monstartup(), objects are allocated on heap. Break is not guaranteed to be aligned at all, unlike stack pointer. For _m_gmon_alloc(), objects are allocated on anonymous memory. p->tos is not aligned properly in general. This fixes quasi-random crashes for *_profile tests, at least on SH-4 and PowerPC 403 [1]. Also, no regression is observed for others as far as I can see. This change does not cause any ABI breakage, as long as application uses proper pointers; use p->tos instead of evil pointer arithmetic like (struct tostruct *)((char *)p->froms + p->fromssize) [2]. [1] Timeout should be increased for some tests. "pic" variants still fail as expected. Dynamically-linked binaries also crash in rtld for SH-4, but this seems different problem... [2] This example did not work even before, since the order of froms[] and tos[] is reversed depending on which of monstartup() or _m_gmon_alloc() is used for allocation. |
||
---|---|---|
.. | ||
Makefile.inc | ||
gmon.c | ||
moncontrol.3 |