This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi] Disable calls to fprintf when building for baremetal targets in release mode
ClosedPublic

Authored by rs on Feb 24 2017, 8:08 AM.

Details

Summary

We've been having issues with using libcxxabi and libunwind for baremetal targets because fprintf is dependent on io functions, this patch disable calls to fprintf when building for baremetal targets in release mode.

libunwind patch is here https://reviews.llvm.org/D30340

Diff Detail

Repository
rL LLVM

Event Timeline

rs created this revision.Feb 24 2017, 8:08 AM
rs retitled this revision from Disable calls to fprintf when building for baremetal targets in release mode to [libcxxabi] Disable calls to fprintf when building for baremetal targets in release mode.Feb 24 2017, 8:11 AM
rs edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Feb 24 2017, 8:30 AM
This revision was automatically updated to reflect the committed changes.
EricWF edited edge metadata.Feb 24 2017, 9:25 AM

isn't this incorrect because config.h always defines LIBCXX_BAREMETAL?

isn't this incorrect because config.h always defines LIBCXX_BAREMETAL?

Oh, right, it needs to be:

#if !LIBCXXABI_BAREMETAL || !defined(NDEBUG)
rmaprath edited edge metadata.Feb 24 2017, 9:41 AM

Perhaps change config.h and remove the definition there and adjust other places accordingly?

The current form is very easy to trip over.

Perhaps change config.h and remove the definition there and adjust other places accordingly?

The current form is very easy to trip over.

Eric's point is that LIBCXXABI_BAREMETAL is a 0/1 flag, not a defined/not-defined flag. Please don't change from one form to the other... it's disruptive to build systems.

rs added a comment.Feb 24 2017, 9:57 AM

Ah sorry for the mistake. Fix is here https://reviews.llvm.org/D30343

Perhaps change config.h and remove the definition there and adjust other places accordingly?

The current form is very easy to trip over.

Eric's point is that LIBCXXABI_BAREMETAL is a 0/1 flag, not a defined/not-defined flag. Please don't change from one form to the other... it's disruptive to build systems.

I actually think it's better to maintain consistency between libc++ and libc++abi. And libc++ never uses 0/1 flags. So I would rather see a fix in config.h.

Frankly I don't care that it is disruptive to build systems unless it's the build system owned by LLVM.