Commit 3cdcc0b5 authored by Artem Pyanykh's avatar Artem Pyanykh Committed by Marge Bot

Add a linker test re: section alignment

parent 7bbfb789
......@@ -6,3 +6,8 @@ unsigned_reloc_macho_x64:
as -o unsigned_reloc_macho_x64.o unsigned_reloc_macho_x64.s
'$(TEST_HC)' $(TEST_HC_OPTS_NO_RTSOPTS) -v0 --make -no-rtsopts-suggestions -no-hs-main -o runner runner.c
./runner unsigned_reloc_macho_x64.o getAnswer
aligned_mem_access:
cc -c -o aligned_mem_access.o aligned_mem_access.c
'$(TEST_HC)' $(TEST_HC_OPTS_NO_RTSOPTS) -v0 --make -no-rtsopts-suggestions -no-hs-main -o runner runner.c
./runner aligned_mem_access.o foo
#include <stdio.h>
#include <immintrin.h>
__m128 mvec = {1.0, 2.0, 3.0, 42.0};
float fvec[] = {.0, .0, .0, .0};
/* Uses movaps instruction to move data between XMMn <-> mem. Fails
* with segfault when data section is not properly aligned (16 byte).
*/
long foo(void)
{
_mm_store_ps(fvec, mvec);
return (long) fvec[3];
}
Linking: path = aligned_mem_access.o, symname = _foo
42
\ No newline at end of file
......@@ -7,3 +7,10 @@ test('unsigned_reloc_macho_x64',
unless(arch('x86_64'), skip)
],
run_command, ['$MAKE -s --no-print-directory unsigned_reloc_macho_x64'])
test('aligned_mem_access',
[
extra_files(['runner.c', 'aligned_mem_access.c']),
unless(opsys('darwin') and arch('x86_64'), expect_broken(13624))
],
run_command, ['$MAKE -s --no-print-directory aligned_mem_access'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment