This option selects between linking for smallest code/data size or best debug illusion. Input objects might contain common data (COMDAT) groups, but these might not be identical across all input objects because of differences such as objects compiled with different optimization levels.
The default is
--no_bestdebug. This ensures
that the code and data of the final image are the same regardless
of whether you compile for debug or not. The smallest COMDAT groups
are selected when linking, at the expense of a possibly slightly
poorer debug illusion.
--bestdebug to select COMDAT groups with
the best debug view. Be aware that the code and data of the final
image might not be the same when building with or without debug.
For two objects compiled with different optimization levels:
armclang -c -O2 file1.c armclang -c -O0 file2.c armlink --force-scanlib --bestdebug fil1.o file2.o -o image.axf