On Saturday, 30 April 2022 at 18:18:02 UTC, Dukc wrote:
I have figured out that my development build of Phobos is for
some reason including instances of `__cmp` and `dstrcmp`
templates from DRuntime in the Phobos binary. Since `-betterC`
client code does not link Phobos in, it fails if it tries to
use those functions.
The problem: how do I track down what includes those functions
in the Phobos binary? The -vasm switch of DMD gives a neat
output, but I can get it to only show the disassembly of files
I'm compiling (not already combined files), and before the
linking phase. So no info where the function calls point to.
I also tried ndisasm. It can disassemble already compiled
binaries, but it's output is utter trash. It can't even figure
where a function begins or ends, let alone displaying their
name. Instead it displays just a sea of `add` instructions for
the areas between the functions.
I'm looking for something where I could search for the call to
the DRuntime functions in question, from an already combined .o
or .a. What do you suggest? I'm on Linux.
If they are templates then try compiling whatever is causing them
with `-vtemplates=list-instances`. If you can't recompile then
you may be stuck grepping whatever disassembler output works.
The sea of add instructions is padding, lookup what `add BYTE
PTR [rax],al` assembles to. vasm isn't a good disassembler for
anything other than debugging the compiler, all the jumps and
relocations aren't resolved.