Created
September 4, 2014 20:44
-
-
Save anonymous/7b1a7e81cbca6123d224 to your computer and use it in GitHub Desktop.
disallow some unaligned reads for ARMv7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/build/probe.pm b/build/probe.pm | |
index ff5fcbe..835b9a6 100644 | |
--- a/build/probe.pm | |
+++ b/build/probe.pm | |
@@ -234,11 +234,10 @@ sub unaligned_access { | |
my $arch = `$command`; | |
if (defined $arch) { | |
chomp $arch; | |
- if ($arch =~ /^(?:x86_64|amd64|i[0-9]86|armv7.*)$/) { | |
- # ARMv7 not yet tested | |
+ if ($arch =~ /^(?:x86_64|amd64|i[0-9]86)$/) { | |
# Don't know alignment constraints for ARMv8 | |
_gen_unaligned_access($config, 'all'); | |
- } elsif ($arch =~ /^armv6/) { | |
+ } elsif ($arch =~ /^armv(?:6|7)/) { | |
_gen_unaligned_access($config, 'int32'); | |
} else { | |
# ARMv5 and earlier do "interesting" things on unaligned 32 bit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clang 3.4 on ARMv7 is crashy when it does unaligned reads: | |
Starting program: /var/tmp/moar-clang/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --setting=NULL --no-regex-lib --target=mbc --output=gen/moar/stage1/nqpmo.moarvm gen/moar/stage1/nqpmo.nqp | |
[Thread debugging using libthread_db enabled] | |
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1". | |
Program received signal SIGBUS, Bus error. | |
0xb6d7186c in MVM_BC_get_N64 (cur_op=0x4a4340 "\b", offset=2) at src/core/interp.h:103 | |
103 return *(MVMnum64 *)where; | |
The attached patch aligns those reads for ARMv7. | |
It's worth noting that gcc 4.8.2 built moar on ARMv7 wasn't crashy, this patch probably penalizes gcc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment