On Fri, Aug 19, 2011 at 11:04:11AM +0200, Richard Guenther wrote: > On Fri, Aug 19, 2011 at 12:08 AM, Richard Henderson <r...@redhat.com> wrote: > > On 08/18/2011 02:51 PM, Sriraman Tallam wrote: > >> Oh!, right, sorry. So, the only available option now is to mark it as > >> a constructor in libgcc. > > > > Or call it explicitly from the out-of-line tests. > > > > The thing is, if you intend to use this from ifunc tests, I believe > > that these can run *extremely* early. E.g. LD_BIND_NOW=1 will run > > these while relocating the entire application, and therefore before > > any of DT_INIT (aka .ctors), DT_INIT_ARRAY, or DT_PREINIT_ARRAY. > > So make sure that __cpu_indicator initially has a conservative correct > value? I'd still prefer the constructor-in-libgcc option - if only because > then the compiler-side is much simplified.
Note that exporting data from shared libraries and using those in binaries often leads to copy relocations (which are possibly still not applied when calling IFUNC functions with LD_BIND_NOW=1). Similarly calling a function in a different shared library might be a problem from IFUNC handler. Jakub