This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reason for __ aliases of variables


On Tue, 7 Mar 2017, Florian Weimer wrote:

> We have some global variables in glibc which have internal __ aliases (e.g.,
> daylight and __daylight).  Why do we do this?

As discussed in the signgam context: if the __ alias is exported at a 
public symbol version, as well as the non-__ version as a weak alias, and 
glibc internally only references the __ version, then: if an application 
references the variable without defining its own copy then the application 
will end up with a dynamic relocation against the __ alias (thanks to 
static linker magic), while if it defines its own copy then that copy will 
be separate.  So this provides namespace protection.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]