Here's what worked for me.
Building dieharder:
git clone --recursive https://github.com/emeryberger/DieHard
cd DieHard/src
make linux-gcc-x86-64 TARGET=libdieharder
Then I needed to add the following to my Firefox .mozconfig:
ac_add_options --disable-jemalloc
ac_add_options --disable-replace-malloc
The build was like this:
./mach clobber
./mach build
Then to use DieHarder as the allocator:
cd obj-x86_64-pc-linux-gnu/dist/bin
LD_PRELOAD=/home/arthur/DieHard/src/libdieharder.so ./firefox
I was able to use gdb to inspect stack traces and confirm that allocations were being done by libdieharder.so