Re: RFC: Add STB_GNU_SECONDARY

2012-04-23 Thread H.J. Lu
On Sat, Apr 21, 2012 at 12:01 PM, Joern Rennecke wrote: > Quoting "H.J. Lu" : > >> Putting our own foo in a section with a special prefix in section name, >> like .secondary_*, works with linker support.  But it isn't very reliable. > > > In what way is requiring linker support for STB_GNU_SECONDA

Re: RFC: Add STB_GNU_SECONDARY

2012-04-21 Thread Joern Rennecke
Quoting "H.J. Lu" : Putting our own foo in a section with a special prefix in section name, like .secondary_*, works with linker support. But it isn't very reliable. In what way is requiring linker support for STB_GNU_SECONDARY more reliable than requiring linker support for .secondary_* sect

Re: RFC: Add STB_GNU_SECONDARY

2012-04-21 Thread H.J. Lu
On Fri, Apr 20, 2012 at 6:08 PM, Joern Rennecke wrote: >>> Even better, you could use symbolic tags, and have the linker script >>> assign precedence values to these tags. >> >> >> It won't help us. > > > Maybe it wouldn't buy you more than the secondary symbols right now, but > it would give a lo

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Joern Rennecke
Quoting "H.J. Lu" : We only have very few bits to in STB_XXX field. Well, you could put the information somewhere else. E.g. a special relocation, or a special elf section. Or you could mangle the information into the section name in which the symbol is present. Even better, you could u

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
"H.J. Lu" writes: > On Fri, Apr 20, 2012 at 5:49 PM, Ian Lance Taylor wrote: >> "H.J. Lu" writes: >> >>> In our usage, the backup definition may not be at the end of >>> command line since it may reference library symbols. >> >> You could write out the backup function you need under a different

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 5:49 PM, Ian Lance Taylor wrote: > "H.J. Lu" writes: > >> In our usage, the backup definition may not be at the end of >> command line since it may reference library symbols. > > You could write out the backup function you need under a different name. > Then have the backu

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
"H.J. Lu" writes: > In our usage, the backup definition may not be at the end of > command line since it may reference library symbols. You could write out the backup function you need under a different name. Then have the backup symbol at the end of the link call the new name of the backup func

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 4:40 PM, Ian Lance Taylor wrote: > "H.J. Lu" writes: > >> On Fri, Apr 20, 2012 at 3:59 PM, Ian Lance Taylor wrote: >>> "H.J. Lu" writes: >>> On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant wrote: >> We only have very few bits to in STB_XXX field. > > This

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
"H.J. Lu" writes: > On Fri, Apr 20, 2012 at 3:59 PM, Ian Lance Taylor wrote: >> "H.J. Lu" writes: >> >>> On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant wrote: > We only have very few bits to in STB_XXX field. This is exactly why I'm not in favor of this extension. The feature

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 3:59 PM, Ian Lance Taylor wrote: > "H.J. Lu" writes: > >> On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant wrote: We only have very few bits to in STB_XXX field. >>> >>> This is exactly why I'm not in favor of this extension. The feature >>> doesn't seem compelling enou

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 3:54 PM, Petr Baudis wrote: > On Fri, Apr 20, 2012 at 01:11:34PM -0700, H.J. Lu wrote: >> On Fri, Apr 20, 2012 at 12:50 PM, Roland McGrath >> wrote: >> > Please provide an example that illustrates why you think you need this. >> > >> >> Currently we use weak undefined sym

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
"H.J. Lu" writes: > On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant wrote: >>> We only have very few bits to in STB_XXX field. >> >> This is exactly why I'm not in favor of this extension. The feature >> doesn't seem compelling enough to use up one of these precious >> reserved values (in fact, yo

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Petr Baudis
On Fri, Apr 20, 2012 at 01:11:34PM -0700, H.J. Lu wrote: > On Fri, Apr 20, 2012 at 12:50 PM, Roland McGrath wrote: > > Please provide an example that illustrates why you think you need this. > > > > Currently we use weak undefined symbol, foo, to do > > if (&foo != 0) > foo is defined. > else >

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 3:47 PM, H.J. Lu wrote: > On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant wrote: >>> We only have very few bits to in STB_XXX field. >> >> This is exactly why I'm not in favor of this extension. The feature >> doesn't seem compelling enough to use up one of these precious >>

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant wrote: >> We only have very few bits to in STB_XXX field. > > This is exactly why I'm not in favor of this extension. The feature > doesn't seem compelling enough to use up one of these precious > reserved values (in fact, you're using the next-to-last

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Cary Coutant
> We only have very few bits to in STB_XXX field. This is exactly why I'm not in favor of this extension. The feature doesn't seem compelling enough to use up one of these precious reserved values (in fact, you're using the next-to-last one that's reserved for OS use). You want a backup definitio

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 1:55 PM, Joern Rennecke wrote: > Quoting "H.J. Lu" : > >> Hi, >> >> We have a need to define a secondary symbol as backup in >> case there isn't a primary one.  Here is a proposal for >> STB_GNU_SECONDARY.  Any comments? > > > If two levels of prevedence (ordinary and weak)

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Joern Rennecke
Quoting "H.J. Lu" : Hi, We have a need to define a secondary symbol as backup in case there isn't a primary one. Here is a proposal for STB_GNU_SECONDARY. Any comments? If two levels of prevedence (ordinary and weak) are not enough, why will three levels be so much better? If you use a sign

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 1:26 PM, Roland McGrath wrote: >> Currently we use weak undefined symbol, foo, to do >> >> if (&foo != 0) >>  foo is defined. >> else >>  foo isn't defined. >> >> We want is to define foo as a secondary symbol so that >> we can always use foo without checking.  If there is

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Roland McGrath
> Currently we use weak undefined symbol, foo, to do > > if (&foo != 0) > foo is defined. > else > foo isn't defined. > > We want is to define foo as a secondary symbol so that > we can always use foo without checking. If there is a primary > one in a .o file and .so file, we will get the prim

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 12:50 PM, Roland McGrath wrote: > Please provide an example that illustrates why you think you need this. > Currently we use weak undefined symbol, foo, to do if (&foo != 0) foo is defined. else foo isn't defined. We want is to define foo as a secondary symbol so that

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Roland McGrath
Please provide an example that illustrates why you think you need this. Thanks, Roland

RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
Hi, We have a need to define a secondary symbol as backup in case there isn't a primary one. Here is a proposal for STB_GNU_SECONDARY. Any comments? Thanks. -- H.J. --- STB_GNU_SECONDARY Secondary symbols are similar to weak symbols, but their definitions have even lower precede