You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 3912 Reporter: anonymous Assigned to:@xavierleroy Status: closed (set by @xavierleroy on 2011-06-04T15:59:38Z) Resolution: won't fix Priority: normal Severity: crash Version: 3.09.0 Category: ~DO NOT USE (was: OCaml general) Monitored by:@glondu gildor smimram jcristau
Bug description
OCaml native code programs crash when used with recent versions of GNU ld on alpha. This appears to be because ld now implements global optimizations on the gp register (relaxing). The code generator signifies to the linker when this is safe via .prologue commands. However, these appear to be generated incorrectly by OCaml at times. For instance, the code for caml_apply2 is:
caml_apply2:
...
.prologue 0
...
mov $1, $27
.livereg 0x4007e030, 0x00000000
jmp ($1)
As I understand it, a .prologue value of 0 means that the gp register ($27) is unused by the function, however it is clearly used here. Indeed setting the value >0 avoids the segfault (at least until the next function with .prologue incorrectly set to 0). I'm not an alpha assembly expert (most of my knowledge was learned via searching for this bug!), but it looks like the instr_needs_gp function in alpha/emit.mlp needs to at least check for Imov when one operand is $29. This would require some restructuring, so I don't have a patch at the moment, but if you're interested, I can probably come up with one.
This behavior is present in the current binutils package (2.16.1cvs20051117-1) in Debian's unstable distribution. Although this package is based on a CVS snapshot of binutils, the behavior will be included in the next release which shouldn't be too far away. I don't have a small example to reproduce this, buf if you rebuild OCaml on alpha, then ocamlopt.opt will segfault at startup. A temporary workaround is to pass -Wl,--no-relax to gcc which turns off the optimization.
Cheers,
Mike Furr (mfurr at debian.org)
The text was updated successfully, but these errors were encountered:
Adding -Wl,--no-relax to bytecclinkopts and nativecclinkopts in configure breaks ocamlopt -output-obj and ocamlopt -pack, which call "ld" directly with these options.
Is it possible to change the toplevel Makefile to use "gcc -nostdlib -Wl,-r" instead of "ld -r" in PARTIALLD and PACKLD, to make it possible to give the same options to native_pack_linker, native_c_linker and native_partial_linker?
Six years (!) after this PR was opened, it appears that the Alpha port of ocamlopt is dead for good. Debian wisely elected to a bytecode-only ocaml package on Alpha, we (Caml dev team) got no other requests to keep that port alive, and we also retired our last Alpha servers after 12 years of service. So, allow me to close this PR and declare ocamlopt/Alpha officially dead. RIP.
Original bug ID: 3912
Reporter: anonymous
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2011-06-04T15:59:38Z)
Resolution: won't fix
Priority: normal
Severity: crash
Version: 3.09.0
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu gildor smimram jcristau
Bug description
OCaml native code programs crash when used with recent versions of GNU ld on alpha. This appears to be because ld now implements global optimizations on the gp register (relaxing). The code generator signifies to the linker when this is safe via .prologue commands. However, these appear to be generated incorrectly by OCaml at times. For instance, the code for caml_apply2 is:
caml_apply2:
...
.prologue 0
...
mov $1, $27
.livereg 0x4007e030, 0x00000000
jmp ($1)
As I understand it, a .prologue value of 0 means that the gp register ($27) is unused by the function, however it is clearly used here. Indeed setting the value >0 avoids the segfault (at least until the next function with .prologue incorrectly set to 0). I'm not an alpha assembly expert (most of my knowledge was learned via searching for this bug!), but it looks like the instr_needs_gp function in alpha/emit.mlp needs to at least check for Imov when one operand is $29. This would require some restructuring, so I don't have a patch at the moment, but if you're interested, I can probably come up with one.
This behavior is present in the current binutils package (2.16.1cvs20051117-1) in Debian's unstable distribution. Although this package is based on a CVS snapshot of binutils, the behavior will be included in the next release which shouldn't be too far away. I don't have a small example to reproduce this, buf if you rebuild OCaml on alpha, then ocamlopt.opt will segfault at startup. A temporary workaround is to pass -Wl,--no-relax to gcc which turns off the optimization.
Cheers,
Mike Furr (mfurr at debian.org)
The text was updated successfully, but these errors were encountered: