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 non-release build crashes on Arm #3860

Merged
merged 1 commit into from
Sep 18, 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/3860.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Fix non-release build crashes on Arm

We've fixed a cause of "random" crashes that impacted at minimum, debug versions of Pony programs running on 32-bit Arm builds on the Raspberry Pi 4.

It's likely that the crashes impacted debug versions of Pony programs running on all Arm systems, but we don't have enough testing infrastructure to know for sure.
20 changes: 0 additions & 20 deletions src/libponyc/codegen/genopt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1401,28 +1401,8 @@ static void optimise(compile_t* c, bool pony_specific)
}

pmb.populateFunctionPassManager(fpm);

if(target_is_arm(c->opt->triple))
{
// On ARM, without this, trace functions are being loaded with a double
// indirection with a debug binary. An ldr r0, [LABEL] is done, loading
// the trace function address, but then ldr r2, [r0] is done to move the
// address into the 3rd arg to pony_traceobject. This double indirection
// gives a garbage trace function. In release mode, a different path is
// used and this error doesn't happen. Forcing an OptLevel of 1 for the MPM
// results in the alternate (working) asm being used for a debug build.
if(!c->opt->release)
pmb.OptLevel = 1;
}

pmb.populateModulePassManager(mpm);

if(target_is_arm(c->opt->triple))
{
if(!c->opt->release)
pmb.OptLevel = 0;
}

// LLVM 7 and up has a bug where running MergeFunctions more than once
// causes an assert fail saying "Invalid RAUW on key of ValueMap". We can
// avoid that by setting to false before populating lpm, after mpm was
Expand Down