Below is my code:
//Module 1
void sth()
{
}
//Module 2
int sth= 1;
int func()
{
}
and when invoking gcc
, the linker throws an error:
multiple definitions of sth found.
But is the link that dumb that it couldn't tell the difference between functions and variables? Especially there is a symbols table in ELF, there is a "type" in Elf64_Symbol
to differentiate function and object. Why doesn't the linker use this information?