Re: RFC: Add STB_GNU_SECONDARY

2012-04-23 Thread H.J. Lu
On Sat, Apr 21, 2012 at 12:01 PM, Joern Rennecke amyl...@spamcop.net wrote: Quoting H.J. Lu hjl.to...@gmail.com: 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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-21 Thread H.J. Lu
On Fri, Apr 20, 2012 at 6:08 PM, Joern Rennecke amyl...@spamcop.net 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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-21 Thread Joern Rennecke
Quoting H.J. Lu hjl.to...@gmail.com: 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

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

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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 12:50 PM, Roland McGrath rol...@hack.frob.com 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

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 primary one,

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 1:26 PM, Roland McGrath rol...@hack.frob.com 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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Joern Rennecke
Quoting H.J. Lu hjl.to...@gmail.com: 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?

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 1:55 PM, Joern Rennecke amyl...@spamcop.net wrote: Quoting H.J. Lu hjl.to...@gmail.com: 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

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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread H.J. Lu
On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant ccout...@google.com 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

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 hjl.to...@gmail.com wrote: On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant ccout...@google.com 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

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 rol...@hack.frob.com 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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant ccout...@google.com 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:54 PM, Petr Baudis pa...@ucw.cz 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 rol...@hack.frob.com wrote: Please provide an example that illustrates why you think you need this. Currently we use

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 i...@google.com wrote: H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant ccout...@google.com 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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 3:59 PM, Ian Lance Taylor i...@google.com wrote: H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant ccout...@google.com wrote: We only have very few bits to in STB_XXX field. This is exactly why I'm

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 i...@google.com wrote: H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 3:59 PM, Ian Lance Taylor i...@google.com wrote: H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant ccout...@google.com wrote:

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Ian Lance Taylor
H.J. Lu hjl.to...@gmail.com 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

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 i...@google.com wrote: H.J. Lu hjl.to...@gmail.com 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 Ian Lance Taylor
H.J. Lu hjl.to...@gmail.com writes: On Fri, Apr 20, 2012 at 5:49 PM, Ian Lance Taylor i...@google.com wrote: H.J. Lu hjl.to...@gmail.com 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

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Joern Rennecke
Quoting H.J. Lu hjl.to...@gmail.com: 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