Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only use --gc-sections for release builds, because it can harm debugging #1813

Closed
DanAlbert opened this issue Nov 30, 2022 · 3 comments
Closed
Assignees

Comments

@DanAlbert
Copy link
Member

Description

#1717 needs a partial revert

@DanAlbert DanAlbert moved this to Triaged in NDK r26 Nov 30, 2022
@DanAlbert DanAlbert moved this to Triaged in NDK r25c Nov 30, 2022
@DanAlbert
Copy link
Member Author

The rationale from Studio:

It can cause unused functions to be removed even with -O0, which causes surprises when trying to use those functions in expression evaluation.

@DanAlbert
Copy link
Member Author

This can't be fixed for the new CMake toolchain, only the legacy one (which is fortunately the default), because CMake doesn't have an affordance for us to override ldflags for specific build modes: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Platform/Android-Clang.cmake#L16-21

r25c will fix ndk-build and the legacy cmake toolchain file (again, the default), but the new form is going to remain broken until someone can be freed up to spend the time needed to make cmake work for us.

@DanAlbert
Copy link
Member Author

Forked the new toolchain file stuff into #1826.

@DanAlbert DanAlbert moved this from Triaged to Merged in NDK r26 Jan 13, 2023
@DanAlbert DanAlbert self-assigned this Jan 13, 2023
osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
The user may want to call "unused" functions during debugging.

This fix does not cover the new cmake toolchain. afaict CMake does not
give us the control needed to fix this bug without entirely reverting
the feature in that mode (we can control linker flags, but not per
mode).

Bug: android/ndk#1813
Test: expanded the gc-sections test
Change-Id: I095e2e70f522f4dbd5021f0efab49dfd86cfba51
@DanAlbert DanAlbert moved this from Needs cherry-pick to Merged in NDK r25c Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Merged
Status: Merged
Development

No branches or pull requests

1 participant