Is it possible to intermix debug and release (stripped) builds of some modules?

We have a pretty large application, that does not fit into Flash with debug info even with -Os optimizations.
What I’d like to do is to strip debug info or even simply build some modules in release mode (w/o -g).
The problem I see is profile is only all-or-nothing and I cant find the way to make this work.

Is there are any way to achieve this?

System:
mbedOS v5.15
mbed --version: 1.10.5
GCC_ARM
MCU: nrf52480