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
4.01.0dev emits compact unwind warnings since switch to clang #5921
Comments
Comment author: @damiendoligez Reproduced on 10.7.5 with Xcode 4.5.1. We will need to clean up the configuration script and the "driver" part of the compilers. |
Comment author: @damiendoligez In fact, $nativecccompopts is not used for linking executables. Nor is $nativecclinkopts (this is used only with ld for packing libraries). The flag must be put into both $mksharedlib and $mkexe. I've done that and the warning disappeared (commit 13423 in trunk). Not tested on earlier versions of XCode. If they break and someone cares, we'll probably have to test for the presence of "clang" in the path before we add this flag. |
Comment author: @johnwhitington This warning is now gone with 4.01.0 on Xcode 5 / OS X 10.9, without any patch. However, we now have another rather abundant noisy warning: ocamlfind ocamlc cpdflibwrapper.c; |
Comment author: @mshinwell I think just silencing these warnings may have been a mistake; it might indicate an error in the DWARF information emitted by the OCaml compiler. I am going to investigate further later this week, since there has been recent evidence of problems in this area. |
Comment author: @mshinwell I looked into this further. The problem appears to arise from code in the OS X linker that attempts to synthesize compact unwind sections from DWARF CFA information. I didn't manage to understand completely how it works, but I'm fairly sure it's tripping up on the OCaml CFA information because we don't have any callee-save registers. There is a comment in recent versions of libunwind that suggests the OS X linker has stopped this behaviour since it is fragile (no surprises there). It wasn't clear from the latest version of the ld64 source code I looked at that this was the case, however. In any event, I think keeping compact unwind section generation disabled is the correct thing to do. If in future we wish to revisit this, the correct solution is very likely to have the OCaml compiler emit the compact unwind information directly. Then there should be no misunderstandings. |
Original bug ID: 5921
Reporter: @avsm
Assigned to: @mshinwell
Status: closed (set by @xavierleroy on 2015-12-11T18:29:29Z)
Resolution: fixed
Priority: normal
Severity: minor
OS: MacOS X
OS Version: 10.8
Version: 4.00.1
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.01.0
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Monitored by: meurer @ygrek @dbuenzli
Bug description
On latest MacOS X and trunk, any invocation of the linker results in warnings such as:
ld: warning: could not create compact unwind for _camlTypecore__add_pattern_variables_1925: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlTypecore__type_pattern_1937: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlTypecore__type_pattern_list_1949: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlTypecore__type_class_arg_pattern_1959: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _camlTypecore__mkpat_1981: stack subq instruction is too different from dwarf stack size
The warnings can be suppressed by passing -no-compact-unwind to the linker:
--- a/configure
+++ b/configure
@@ -734,7 +734,8 @@ case "$arch,$nativecc,$system,$host_type" in
,,rhapsody,) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
if $arch64; then partialld="ld -r -arch ppc64"; fi;;
,gcc,cygwin,) nativecccompopts="$gcc_warnings -U_WIN32";;
,gcc,,*) nativecccompopts="$gcc_warnings";;
esac
but I've not got an older 10.6/7 to see if this breaks anything there. Although I notice that trunk is also broken on 10.6 due to #5912
The above patch also still results in relocation warnings while bootstrapping the compiler.
Steps to reproduce
$ echo 'let _ = Printf.printf "foo%!"' > test.ml
$ ocamlopt -linkall test.ml
<warnings result on MacOS X 10.8>
The text was updated successfully, but these errors were encountered: