It's definitely in the linker command line according to the logs.
The following kvm errors imply that it's not considered, which made me
think that it might be an ordering issue for ld that doesn't affect
gold. I haven't tried a tried, it takes 70 minutes to get to that
point. I'm not sure what to patch to even get the -Wl,--trace to show
on the command line. (is that correct?)

You probably can cd to the proper directory (not sure which that is,
you can infer from the exact command line and the files found) and just
copy&paste the effectively invoked command (from the wrapper work log)
to test the failing link step directly.
Once you find out what needs changing, we can think about how to code it
in the real build.
Martin

I just tried to build xulrunner from pkgsrc-current using the standard
linker and I got a DIFFERENT linker error than before.

There are hundreds of undefined references in crmfreq.c prefixed with
"PORT_" such as "PORT_FreeArena_Util".

This is in addition to the kvm undefined references. It fails at the
same command.