Subject: Should a NetBSD compiler/assembler prepend "_" to global symbol names?
To: None <port-pmax@sun-lamp.cs.berkeley.edu>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 09/02/1994 00:09:47
I've compiled a "NetBSD" a.out format kernel from the same source
as an ecoff kernel; and constructive native NetBSD utilites like
kvm_mkdb, ps, ifconfig, and netstat. ps works just about fine.

However, it prints

    "ps: nlist: can't find following symbols: _fscale _ccpu
    _avail_start _avail_end"

(wrapped for legibility) because these names correspond to
kernel variables called "fscale" in the C source, and neither gas
nor the gcc I'm using  put an underscore on.

That GCC is an Ultrix binary, configured for ultrix/ecoff, invoked via
a script that passes GCC options to produce "netBSD" binaries.

    #!/bin/csh  -f
    gcc -nostdinc -nostdlib -I/usr/include -mgas -G0 \
      -B/usr/local/mips-dec-bsd/bin/  -Xlinker /usr/lib/crt0.o \
      $argv[*]:q -L/usr/lib -lc -lgcc


I expect the most correct fix, longer term, is to configure a "native"
NetBSD gcc that prepends an underscore to linker-visible C
variables. Does that sound wrong to anyone?

------------------------------------------------------------------------------