This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to avoid a library being optimized out?

Hello All,

Lets say I have a library foo.a which inside has many object files (bar1.o, bar2.o .. barN.o).

How can I tell the linker to not remove the unused sections of the complete library? Not all object files are being used but I would like to keep them in the final image.

I could use the --keep command and specify every barN.o file but it would be too many. Is there a way to tell it to keep the whole library?

In GCC I could write: KEEP(*foo.a:*) in the linker script. Is there something alike for the scatter file/command like.

Thanks

Parents Reply Children
No data