This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Add missing alloca.h include
AbandonedPublic

Authored by ldionne on Jul 5 2023, 3:32 AM.

Details

Reviewers
StevenvdSchoot
Group Reviewers
Restricted Project
Summary

At the moment we list a set of specifric platforms for which we use alloca for
_LIBUNWIND_REMEMBER_ALLOC. We assume that on those platforms alloca is already
provided somehow. This assumption turns out to be wrong sometimes. In
particular a baremetal system using picolibc is assumed to provide aloca, but
doesn't when compiled with pedantic/without gnu extentions.

This changes the behaviour by looking for different ways an alloca
implementation could be provided and using it when found. If no alloca can be
found we revert back to using malloc.

Diff Detail

Event Timeline

StevenvdSchoot created this revision.Jul 5 2023, 3:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 3:32 AM
StevenvdSchoot requested review of this revision.Jul 5 2023, 3:32 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 5 2023, 3:32 AM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript

alloca.h isn’t a standard header, and not all those platforms included in the ifdef do have a header with that name (even if they have the alloca function/macro provided somehow by some other header).

See earlier discussion in e.g. https://reviews.llvm.org/D149635.

StevenvdSchoot edited the summary of this revision. (Show Details)

alloca.h isn’t a standard header, and not all those platforms included in the ifdef do have a header with that name (even if they have the alloca function/macro provided somehow by some other header).

See earlier discussion in e.g. https://reviews.llvm.org/D149635.

Ahh, sorry I missed that PR.
I see there has been no activity on that issue since May 10. Based on the comments there, I created a new version.

mstorsjo added inline comments.Jul 6 2023, 3:11 PM
libunwind/src/config.h
31

Please avoid changing the indentation of the otherwise unchanged lines (throughout the whole patch).

Undid formatting changes

ldionne commandeered this revision.Sep 11 2023, 2:32 PM
ldionne added a reviewer: StevenvdSchoot.
ldionne added a subscriber: ldionne.

[Github PR transition cleanup]

Abandoning in favour of picking up D149635, where we suggested just using __builtin_alloca. All supported compilers should support it.

ldionne abandoned this revision.Sep 11 2023, 2:32 PM
ldionne marked an inline comment as done.