I have gone through the linker documentation for HIDDEN and PROVIDE_HIDDEN multiple times, but I am not really able to understand what they exactly do.
For example, if I write a linker script with an assignment like this :
naveen = 10;
SECTIONS
{
}
I see the symbol in
$ objdump -t kernel8.elf | grep naveen
000000000000000a g *ABS* 0000000000000000 naveen
If I add HIDDEN
, I still see the symbol there :
HIDDEN(naveen = 10);
SECTIONS
{
}
$ objdump -t kernel8.elf | grep naveen
000000000000000a l *ABS* 0000000000000000 naveen
For PROVIDE
and PROVIDE_HIDDEN
added in SECTIONS
command, I don't see the symbol in either case. So I am not really able to differentiate between HIDDEN/non-hidden
and PROVIDE/PROVIDE_HIDDEN
behaviours. Can someone please explain with nice and short example the use-cases. I searched a lot but either I did not find good examples, or I could not make sense out of it.