Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARCH_INT64_ALIGN incorrectly detected on linux / arm / gcc 4.4.3 #5088

Closed
vicuna opened this Issue Jun 24, 2010 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Jun 24, 2010

Original bug ID: 5088
Reporter: jp30
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2012-03-24T14:01:46Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.12.0+beta1 or 3.12.0+rc1
Fixed in version: 3.12.0+beta1 or 3.12.0+rc1
Category: ~DO NOT USE (was: OCaml general)

Bug description

The default behaviour of linux on ARM processors is to ignore alignment faults occurring in user processes (rather than sending a SIGBUS, as is normal on other alignment-sensitive architectures). The instruction causing the fault, however, has undefined results.

Ocaml's configuration script attempts to detect alignment-sensitivity by trying to provoke a SIGBUS in config/auto-aux/int64align.c. On ARM systems running linux, the alignment fault is ignored, leading the configuration script to incorrectly unset ARCH_ALIGN_INT64 in config/m.h.

Steps to reproduce:

$ echo 0 > /proc/cpu/alignment # this is the default - ignore alignment faults
$ ./configure && make world # will SIGSEGV
$ grep ALIGN_INT64 config/m.h
#undef ARCH_ALIGN_INT64
$ echo 4 > /proc/cpu/alignment # alignment faults now cause SIGBUS
$ make clean && make world # will SIGBUS

$ echo 4 > /proc/cpu/alignment # alignment faults cause SIGBUS
$ ./configure && make world # build completes correctly
$ grep ALIGN_INT64 config/m.h
#define ARCH_ALIGN_INT64

Suggested remedy:

Since ignoring alignment faults is default behaviour for linux on ARM, I suggest that the configure script set ARCH_ALIGN_INT64 for all arm*-linux hosts (as is already done for sparc).

The problem doesn't seem to occur with gcc 4.3. Possibly earlier gccs don't provide native 64 bit ints on ARM???

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jul 6, 2010

Comment author: @xavierleroy

I'm at a loss to guess which ARM instructions generated by gcc could cause problem with 4-aligned 64-bit accesses. Nonetheless, I updated the configure script as suggested (force alignment for arm*--).

@vicuna vicuna closed this Mar 24, 2012

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.