Skip to contentSkip to conversation

puzzles about hidden_def and hidden_proto

DISCUSSION Ken 1 participant 1 message Oct 5, 2007 SELinux security module

lore
Share & tools
lore

Ken

author
#0 lore raw
Quoted 11 lines

They came from Ulrich Drepper.
See:
http://people.redhat.com/drepper/dsohowto.pdf <http://people.redhat.com/drepper/dsohowto.pdf>

They are to create and use private definitions of the symbols for calls to them within the shared library to avoid relocations on them, as that has a cost and is usually unnecessary (you typically don't need to permit interposition on such calls). You declare them with hidden_proto() in a header file (see src/*_internal.h), include those headers in the .c files that use those symbols, and put a hidden_def() in the .c file after the definition.

hi, Stephen, thanks for your reply

sorry for reply late, i have learned ulrich's paper, and i think i understand what hidden_* macro means, but there were still two questions, whick i dont understand:

1
IMHO, the implementation of hidden_proto() is a kind of "symbol rename" trick, we can continue to refer to the symbol as fct in the source, but it will be named fct_internal in the asm.

but i don't understand who make the trick happened? GCC?

it's not a grammar of C, i wonder why:

extern __typeof(OLD) OLD asm(NEW)

can rename OLD to NEW?

2
what are the difference between this "rename" trick and gcc "alias" attribute?

why not use "alias" in hidden_proto()

thans in advance for any hints