This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Re: A patch for default version and archive


On Tue, Nov 14, 2000 at 01:58:18AM -0800, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@valinux.com> writes:
> 
> > 1. My patch doesn't introduce any new matches. Both references to
> > symbol@ver1 and symbol will match the definition of symbol@@ver1
> > today.
> > 2. My patch only changes how the linker deals with archives. Before
> > it only checks "symbol" for "symbol@@ver1", with my patch, it will
> > also check "symbol@ver1".
> 
> This all is under the premise that ld is handling versioned symbols
> and that this is good.  It's not and ld should not do what you assume
> as the before-behavior in the first place since this, as I've layed
> out, is creating big problems.

Your testcase is flawed. See below. Please show me a testcase I can
compile.

> 
> If you reference symbol@@ver1 this means you expect ver1 to be the

There cannn't be reference to symbol@@ver1. You cannot make one unless
you try very hard by like modifying assembler.

# cat x.c
#include <stdio.h>

int
main ()
{
  FILE *fp = fopen ("/tmp/foo.out", "w");

  fprintf (fp, "Hellow world\n");
  fclose (fp);
  return 0;
}
# gcc -c x.c
# nm x.o
         U fclose@GLIBC_2.1
         U fopen@GLIBC_2.1
         U fprintf@GLIBC_2.0
00000000 t gcc2_compiled.
00000000 T main

Did you see all references be made to single `@'. That is the key
point. It is very important. Otherwise, what you described would
happen and I would agree with you.

> version everybody is using and not some compatibility version where
> you know that the interface is different from the current version.
> Otherwise you would have made a reference to symbol@var1 in the first
> place.  I hope you can agree with that.

No, I don't agree. You haven't checked out what I have proposed. But I
don't think it belongs to the binutils mailing list.

> 
> Now, this means that the wherever the data structures of this
> interface are used you use the old version.  Also in using other
> libraries or for own code.  Now assume one of the things you want to
> do is write a callback for a function which is versioned.  The library
> is defining a new and an old version of the function.  The code is
> split in three pieces and I haven't tried compiling it:

Please try to compile it. It won't compile for me.


> 
> 1. part: the old code of the library:
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /* foo.h */
> struct thedata
> {
>   char i;
> };
> extern int (*fp) (struct thedata);
> /* note that to actually get a reference to foo@@ver1 we have to use

Here is the problem. You cannot get a reference to foo@@ver1 in a
.o file generated by as. I have checked in a testsuite for .symver.
One test is:

----symver2.s----
        .data
        .globl foo1
        .type foo1,object
foo1:
        .long foo
        .symver foo,foo@@version1
L_foo1:
        .size foo1,L_foo1-foo1
-------------

and the expected output is

.*: Assembler messages:
.*:8: Error: invalid attempt to declare external version name as default in symbol `foo@@version1'
 

You may be able to find a way to get around it. But I will call it
"serious misuse" :-).

Please show me a testcase. I can be convinced with a testcase I can
see myself. Thanks.



H.J.

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