You copied the Doc URL to your clipboard.

ARM Compiler armlink User Guide : --bestdebug, --no_bestdebug

--bestdebug, --no_bestdebug

Selects between linking for smallest code and data size or for 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.

Use --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.


The default is --no_bestdebug. The smallest COMDAT groups are selected when linking, at the expense of a possibly slightly poorer debug illusion.


For two objects compiled with different optimization levels:

armclang --target=arm-arm-none-eabi -march=armv8-a -c -O2 file1.c
armclang --target=arm-arm-none-eabi -march=armv8-a -c -O0 file2.c
armlink --bestdebug file1.o file2.o -o image.axf