Conversation
|
Thanks a lot for this work. I forgot that I turned off the unwind test on macos-ARM64 in 4.12. As far as I can remember, at that time I failed to make libunwind work even with a plain C program, regardless of the options passed at link time, so I concluded something was wrong with libunwind. I haven't tried (with a plain C program) since. Re: no-compact-unwind, this was necessary to avoid link-time (or assembly-time?) warnings of the "unwind information is too big to fit the compact format" kind. Maybe it's an x86-specific issue, or maybe the unwind information format changed enough that it's no longer relevant. |
|
I confirm unwinding works for a pure C program on macos 10.15 arm64, but it does not work if |
xavierleroy
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks!
asmcomp/arm64/emit.mlp
Outdated
| (* avoid collision for unwind test with code_begin symbol *) | ||
| if macosx then ` nop\n .align 3\n`; |
There was a problem hiding this comment.
There may be other reasons to add a nop here, see #4690. But why .align 3?
There was a problem hiding this comment.
There was a problem hiding this comment.
OK, that's good to know, thanks!
This PR fixes up the CFI commands to allow unwind on ARM64 that was left over from #10972.
tests/unwindnow passes on both MacOS x86_64 and ARM64.To get things working involved some trial-and-error to force the toolchain to give me DWARF information on MacOS ARM64. In my experience I had to remove the
-no_compact_unwindlink flag on ARM64 fortests/unwindto work. However on x86_64, I found that the-no_compact_unwindlink flag was necessary to keeptests/unwindworking. After attempts to try and find sanity by exploring past issues (e.g. #5921, #7120) and some time with a search engine trying to figure out what other languages do, I was not able to shed strong clarity on this.However I believe the CFI is correct in the PR, even if we ultimately decide to strip some of the CFI from MacOS ARM64 builds by retaining
-no_compact_unwind. My feeling is we should drop-no_compact_unwindon MacOS ARM64 and keeptests/unwindrunning. 4.14 has disabledtests/unwindfor ARM64 because there did not appear to be a way to emit unwind information; see 482b7fe.