I continue to look for answers to difficult questions.
There is a project for an arm under GCC with a static load. Addresses of variables and data do not change, for gcc everything is known, and it successfully optimizes. There is an almost-manual dynamic library for this project - as a bonus.
But there is an itch.
There is a desire, together with a static load, to simultaneously collect dynamic load blocks. With one button.
In the settings of the linker itself, there is a significant difference. A piece of code for dynamic loading must be in one block - for loading into memory. The code itself can access the absolute external addresses, as well as the offset within the block for quick access to their own addresses.
The project is assembled in two stages, first the static part is assembled - with completely disconnected dynamics. Then, dynamic libraries are built for loading into memory. Everything works fine, but it takes a very long time. I can quickly change the code in static, or quickly change the code in the dynamics. Together does not work quickly.
So here, when I collect separately - there are no errors, but there is a problem of almost manual search of static addresses for a dynamic library.
When you combine two linker settings for static and dynamic - bugs begin.
The most innocuous is an attempt to save one access address for static and dynamics in the body of the dynamics.
I guess I'm inventing a new bicycle at the android level. But direct use of rules and ready-made solutions does not give a positive effect. Most likely the problem is in the sequence of directives assignments for gcc itself, but where exactly the error is not clear.
I need to understand how to change the linker settings for individual project files. Change so that they return to their previous state, without recursion of dependencies for the connected files. Because the connected files can be shared for two settings.