I am using GNU version 4.7
with following link options:
--relax -Xld -nostdlib --gc-sections -Xld --cref -Xld --whole-archive
my issue is the linker is not removing unused strings from printf()
functions that are unused in the file. I have tried removing the
--relax and --whole-archive without any results to this issue.
Example file included in build:
printf("THIS SHOULD BE INCLUDED IN EXECUTATBLE ");
printf("THIS SHOULD BE REMOVED BY LINKER");
The issue is that after the file is compiled that includes both
functions, constant data is grouped together. However, because
functionNOTIncludedInLink is not used by the executable, it is removed
by the linker, however, the linker is not removing the constant string
data that was previously allocated by the compiler for the function
("THIS SHOULD BE REMOVED BY LINKER" remains in const data section).
Are there any ld options that can be used to fix this issue?
I do not want to have to eliminate all my unused functions from files to
keep the constant data from getting compiled and linked into my