I may be able to cast some new light on this problem.
I had this same problem when linking with heaptrc.o (under Linux) when testing out the new version of the Firebird.pas file distributed with Firebird 4 and while integrating it into IBX. There was no such problem with the current version.
I eventually traced the problem to this line in Firebird.pas:
function fb_get_master_interface : IMaster; cdecl; external 'fbclient';
It is a simple function declaration for an external function, and I had omitted to comment it out when preparing the new version. IBX dynamically loads libfbclient and hence the above is not appropriate.
Simply commenting out this line allowed the test program to link successfully with heaptrc.o.
My guess is that this linker problem is due to defining an external function in a way that is appropriate for a static library and then linking it to a library intended to be dynamically loaded.