Skip to content

Add a stub __cxa_free_exception to cxa_noexception.cpp#19183

Merged
dschuff merged 1 commit intomainfrom
cxafree
Apr 15, 2023
Merged

Add a stub __cxa_free_exception to cxa_noexception.cpp#19183
dschuff merged 1 commit intomainfrom
cxafree

Conversation

@dschuff
Copy link
Copy Markdown
Member

@dschuff dschuff commented Apr 14, 2023

In some cases cxa_free_exception can be called by compiler-generated code, which may cause linkage failure in emscripten's default mode which allows throwing but not catching. This PR adds a "stub" __cxa_free_exception to go along with __cxa_allocate_exception.

In some cases cxa_free_exception can be called by compiler-generated
code, which may cause linkage failure in emscripten's default
mode which allows throwing but not catching. This PR adds a "stub"
__cxa_free_exception to go along with __cxa_allocate_exception.
@dschuff dschuff requested review from aheejin and sbc100 April 14, 2023 22:51
@dschuff
Copy link
Copy Markdown
Member Author

dschuff commented Apr 14, 2023

This does fix the LLVM testsuite failure seen in #16627
It's not completely clear to me whether alloc/free should actually do something in this case or not. IIUC in the default mode, throws become aborts, so maybe actually allocating and freeing is unnecessary. But this implementation mirrors the allocation.

@dschuff dschuff changed the title Add a stub cxa_free_exception cxa_noexception.cpp Add a stub __cxa_free_exception to cxa_noexception.cpp Apr 14, 2023
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a test but I guess we can rely on the llvm testsuite for now.

@dschuff
Copy link
Copy Markdown
Member Author

dschuff commented Apr 14, 2023

Yeah I think the llvm testsuite is ok coverage for now. I did verify it locally.

@dschuff dschuff enabled auto-merge (squash) April 14, 2023 23:06
@dschuff dschuff merged commit 518d9fe into main Apr 15, 2023
@dschuff dschuff deleted the cxafree branch April 15, 2023 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants