Reputation: 350
Which function will be called ?
cscope:
[1] include/linux/sched.h
Cscope tag: show_regs
1 108 /data/linux-3.4.7/arch/x86/kernel/process.c <<show_regs>>
void show_regs(struct pt_regs *regs)
2 14 /data/linux-3.4.7/arch/x86/um/sysrq_32.c <<show_regs>>
void show_regs(struct pt_regs *regs)
3 37 /data/linux-3.4.7/arch/x86/um/sysrq_64.c <<show_regs>>
void show_regs(struct pt_regs *regs)
And how gcc know which function will be linked?
Upvotes: 0
Views: 425
Reputation: 41
Within a shared library, a call to a function that is a global symbol costs a “call” instruction to a code location in the so-called PLT (procedure linkage table) which contains a “jump” instruction to the actual function's code.
when the language allows different entities to be named with the same identifier as long as they occupy a different namespace (where a namespace is typically defined by a module, class, or explicit namespace directive) collisions are resolved through the concept of name mangling.
Name mangling provides a way of encoding additional information in the name of a function, structure, class or another datatype in order to pass more semantic information from the compilers to linkers.
SRC : Wiki , gnu.org
Upvotes: 1