Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix segfaults with debug mode code on 64-bit Arm #3875

Merged
merged 1 commit into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .release-notes/3875.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Fix segfaults with debug builds on 64-bit Arm

Debug builds on 64-bit Arm platforms were segfaulting. The code generated when doing `ponyc --debug` wouldn't work and would eventually crash. We believe the source to be an LLVM bug but, aren't certain.

We've introduced a work around that fixes the segfault problem, but does some optimization of debug builds for 64-bit Arm platforms. Additional investigation is underway. You can track progress by [following issue #3874](https://github.com/ponylang/ponyc/issues/3874).
7 changes: 6 additions & 1 deletion src/libponyc/codegen/host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <stdio.h>
#include "codegen.h"
#include "genopt.h"
#include "ponyassert.h"

using namespace llvm;
Expand All @@ -27,8 +28,12 @@ LLVMTargetMachineRef codegen_machine(LLVMTargetRef target, pass_opt_t* opt,
if(opt->pic || opt->library)
reloc = Reloc::PIC_;

// The Arm debug fix is a "temporary" fix for issue #3874
// https://github.com/ponylang/ponyc/issues/3874
// Hopefully we get #3874 figured out in a reasonable amount of time.
CodeGenOpt::Level opt_level =
opt->release ? CodeGenOpt::Aggressive : CodeGenOpt::None;
opt->release ? CodeGenOpt::Aggressive :
target_is_arm(opt->triple) ? CodeGenOpt::Default : CodeGenOpt::None;

TargetOptions options;
options.TrapUnreachable = true;
Expand Down