Вам нужна следующая опция ld(1)
:
-y symbol
--trace-symbol=symbol
Print the name of each linked file in which symbol appears. This
option may be given any number of times. On many systems it is
necessary to prepend an underscore.
Вы можете подать это через cc(1)
интерфейс -Wl,option
-Wl,option
Pass option as an option to the linker. If option contains commas,
it is split into multiple options at the commas.
Итак, cc -Wl,--trace-symbol=yyerror ...