Skip to content

A way to disable tail call optimizations in LLVM for arm targets #112041

@nikarh

Description

@nikarh

Hi, I am the maintainer of Tier 3 target armv7-sony-vita-newlibeabihf.

There is an issue with tail call optimization causing crashes on this specific target. As an example, this often happens in drop calls, which in System allocator do libc::free, or in thread code which calls destroy functions as a last call.

The exact cause of the issue is unknown and would be hard to figure out, it might be caused by llvm bug, an issue with opensource SDK used to create a binary for the target platform, or outright hardware limitation. What complicates the analysis most is the fact that there is essentially no way to debug code on this platform.

So far the best solution I found for this issue is outright disabling tail and sibling call optimizations in llvm for this platform. With it disabled, there are no crashes regardless of the opt-level. The problem is there is no flag in llvm to disable tail calls on arm.

What would be the best course of action to fix this problem? Should I make a PR to upstream llvm with a flag that allows disabling tail calls on arm, and then get it backported to rust llvm fork?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions