[llvm-dev] Should llvm-nm classify Mach-O __DATA, __common symbols as BSS?

Clay McClure via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 24 11:28:12 PST 2018


Hello LLVM-Devs,

Perhaps a pedantic question, but I'm wondering how __DATA,__common and
__DATA,__bss symbols differ, and whether llvm-nm ought not classify
the former as type "B" as it does the latter:

$ cat bss.c
int i;
static int si __attribute__((used));

$ clang -fno-common -c bss.c

$ nm bss.o
0000000000000000 S _i
0000000000000004 b _si

$ nm -m bss.o
0000000000000000 (__DATA,__common) external _i
0000000000000004 (__DATA,__bss) non-external [no dead strip] _si

My (somewhat limited) understanding of linking and loading is that
both of these symbols will be zero-filled at run-time by the operating
system or program loader. To my mind, "B (bss section symbol)" conveys
that better than "S (symbol in a section other than those above").

The relevant commit appears to be r211321 — I'm happy to submit a
patch, if appropriate.

Cheers,

Clay


More information about the llvm-dev mailing list