ELF 二进制文件中具有相同名称的不同符号

different symbols with the same name in ELF binary

静态链接 ELF 文件(带符号)可以有两个不同 符号相同 名字?

Can a statically linked ELF file (with symbols) have two different symbols with same name?

当然可以,前提是符号具有本地链接。示例:

// foo.c
static int foo1() { return 42; }
int foo() { return foo1(); }

// bar.c
static int foo1() { return 24; }
int main() { return foo1(); }

gcc -static foo.c bar.c

nm ./a.out | grep ' foo1'
0000000000401c2d t foo1
0000000000401c48 t foo1

QED.