How to distinguish two static functions with the same name?

llvm-nm does show the difference between two static functions (e.g.,
_print n the following example) with the same name. Is there a way of
allowing it to show their differences (for example, the file where
they are from)? Thanks.

$ gcc -Wall -pedantic -g -c -o print1.o print1.c
$ ar cr ./libprint1.a print1.o
$ gcc -Wall -pedantic -g -fPIC -shared -o ./libprint3.so print3.c
$ gcc -Wall -pedantic -g -c -o main.o main.c
$ gcc -Wall -pedantic -g -c -o print2.o print2.c
$ gcc -L. -lprint1 -lprint3 -o ./main.exe main.o print2.o
$ nm ./main.exe
0000000100000000 T __mh_execute_header
0000000100000ef0 T _main
0000000100000f10 t _print
0000000100000f40 t _print
0000000100000ec0 T _print1
0000000100000f20 T _print2
                 U _print3
                 U _puts
                 U dyld_stub_binder

==> main.c <==
/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>
void print1();
static void print() {
    print1();
}

int main() {
    print();
    return 0;
}

==> print1.c <==
/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>
void print2();

void print1() {
    puts("Hello World1!");
    print2();
}

==> print2.c <==
/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>
void print3();

static void print() {
    puts("Hello World2!");
}

void print2() {
    print();
    print3();
}

==> print3.c <==
/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>

void print3() {
    puts("Hello World3!");
}

From: llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org] On Behalf Of Peng
Yu via llvm-dev
Sent: Thursday, January 10, 2019 12:04 AM
To: llvm-dev@lists.llvm.org
Subject: [llvm-dev] How to distinguish two static functions with the same
name?

llvm-nm does show the difference between two static functions (e.g.,
_print n the following example) with the same name. Is there a way of
allowing it to show their differences (for example, the file where
they are from)? Thanks.

You are building with -g so I would expect running addr2line on each
function's address would give you its source location.
--paulr