Reputation: 181
I am using arm-none-eabi-gcc for STM32 I am trying to generate cross-reference table by passing option '--cref' to the linker, but I get this error
arm-none-eabi-gcc: error: unrecognized command line option '--cref'; did you mean '--xref'?
is '--xref' a replacement for '--cref' ?
Upvotes: 3
Views: 6839
Reputation: 61147
--cref
is an option for the GNU binutils linker, ld
, but it is not an option of gcc
You can direct gcc
to pass such options through to ld
when it invokes the linker by using the the
gcc
option -Wl
, which has the usage:
-Wl,<ld-option>[,<ld-option>...]
So, instead of --cref
, pass -Wl,--cref
in your gcc
commandline.
By itself, this will make the linker print the cross-reference table on the standard output. If you
would prefer to have it in a mapfile, then request a mapfile from the linker as well and the cross-reference
table will be appended to it: -Wl,--cref,-Map=mapfile
(--xref
was an option for gcc
long ago. It is not longer one, but the commandline
parser will still suggest it as one that you might have meant when it parses an unknown
option.)
Upvotes: 3