summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/profile/Inputs/instrprof-merge-match.c
diff options
context:
space:
mode:
authorRainer Orth <ro@gcc.gnu.org>2019-07-11 18:26:24 +0000
committerRainer Orth <ro@gcc.gnu.org>2019-07-11 18:26:24 +0000
commit9512c0a1d1966b7c9328ed1460a1787c4a45cbb6 (patch)
tree2803ffc6d976f018b04bb5c9f0f62eaba85f56c7 /compiler-rt/test/profile/Inputs/instrprof-merge-match.c
parenta286aae4d818f8a2e0eb70c68c0605cae6874a44 (diff)
downloadbcm5719-llvm-9512c0a1d1966b7c9328ed1460a1787c4a45cbb6.tar.gz
bcm5719-llvm-9512c0a1d1966b7c9328ed1460a1787c4a45cbb6.zip
[profile][test] Fix Profile-* :: instrprof-merge.c etc. on SPARC
While working on https://reviews.llvm.org/D40900 (which effectively is about enabling compiler-rt on sparc these days), I came across two failing profile testcases: Profile-sparc :: instrprof-merge-match.test Profile-sparc :: instrprof-merge.c Profile-sparcv9 :: instrprof-merge-match.test Profile-sparcv9 :: instrprof-merge.c All of them crashed with a SIGBUS in __llvm_profile_merge_from_buffer: Thread 2 received signal SIGSEGV, Segmentation fault. [Switching to Thread 1 (LWP 1)] 0x00012368 in __llvm_profile_merge_from_buffer ( ProfileData=0x2384c <main.Buffer> "\377lprofR\201", ProfileSize=360) at /vol/llvm/src/llvm/local/projects/compiler-rt/lib/profile/InstrProfilingMerge.c:95 95 SrcDataEnd = SrcDataStart + Header->DataSize; where Header is insufficiently aligned for a strict-alignment target like SPARC. Fixed by forcing the alignment to uint64_t, the members of struct __llvm_profile_header, in the callers. Tested on sparcv9-sun-solaris2.11. https://reviews.llvm.org/D64498 llvm-svn: 365805
Diffstat (limited to 'compiler-rt/test/profile/Inputs/instrprof-merge-match.c')
-rw-r--r--compiler-rt/test/profile/Inputs/instrprof-merge-match.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/test/profile/Inputs/instrprof-merge-match.c b/compiler-rt/test/profile/Inputs/instrprof-merge-match.c
index 6e29e4a4e51..bc3ab283c9b 100644
--- a/compiler-rt/test/profile/Inputs/instrprof-merge-match.c
+++ b/compiler-rt/test/profile/Inputs/instrprof-merge-match.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include "../profile_test.h"
int __llvm_profile_runtime = 0;
uint64_t __llvm_profile_get_size_for_buffer(void);
@@ -20,7 +21,7 @@ extern uint64_t libEntry(char *Buffer, uint64_t MaxSize);
int main(int argc, const char *argv[]) {
const uint64_t MaxSize = 10000;
- static char Buffer[MaxSize];
+ static char ALIGNED(sizeof(uint64_t)) Buffer[MaxSize];
uint64_t Size = __llvm_profile_get_size_for_buffer();
if (Size > MaxSize)
OpenPOWER on IntegriCloud