Skip to content

Why is libc++_static.a not compiled with -ffunction-sections and -fdata-sections #748

@R1kk3r

Description

@R1kk3r

Description

When building my Android app with a native library, I chose to use c++_static instead of c++_shared because my code use only a subset (std::string, std:vector and std::map) of the c++ library. The idea was to decrease my APK size as much as possible. Since I have one native library only, using a static c++ library should be safe.

Somehow, it seems that the whole c++ library have been embedded inside my tiny native library. The flag --gc-sections has not effect and looking with objdump it seems that the object files of libc++_static.a were not compiled with -ffunction-sections -fdata-sections. Is there any reason for that?

Environment Details

  • NDK Version: ndk 16, ndk 17
  • Build system: cmake
  • Host OS: Mac
  • Compiler: Clang
  • ABI: arm64-v8a
  • STL: c++_static
  • NDK API level: 21

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions