Skip to content

Build with -fno-threadsafe-statics #599

Closed
@arodland

Description

@arodland

What kind of issue is this?

  • Feature Request. Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

It looks like you should add -fno-threadsafe-statics to the default build flags. I ported an Arduino Due project to platform.io and the build size got twice as big. On some investigation I found that a whole mess of exception handling code was being included (despite -fno-exceptions) with pio that wasn't included when building with arduino. I tracked it down to FrameworkArduino/USB/PluggableUSB.cpp, specifically the static PluggableUSB_ obj; line, which brings in __cxa_guard_acquire, which brings in the whole rest of the mess. Adding build_flags = -fno-threadsafe-statics in my platformio.ini brings the text size down from 89776 to 40208. The Arduino IDE builds with this flag since 1.5.8 (arduino/Arduino#107).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions