This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/18720: Properly merge non-default versioned symbol
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 27 Jul 2015 09:55:03 -0700
- Subject: Re: [PATCH] PR ld/18720: Properly merge non-default versioned symbol
- Authentication-results: sourceware.org; auth=none
- References: <20150726221550 dot GA16472 at gmail dot com> <CAJimCsGatEeKRRYcwYG_v-s5O=wE-2mbFjNkLiHzfi0RdCLu0A at mail dot gmail dot com> <CAMe9rOoGhZG=OxDV5tYwORqT7gwD_FzNArRe59N4uJxyrd6rsw at mail dot gmail dot com> <CAJimCsEh5LG-Q-z7Fq_wqWP8qqWog+wNewa4j=jhhLt_gKjCug at mail dot gmail dot com>
On Mon, Jul 27, 2015 at 9:47 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> Why should the direct call to foo from the main program bind to the
>>> non-default versioned symbol? It seems to me that both calls should
>>> bind to the version in the DSO.
>>
>> It is because foo is defined in main.
>
> But it's not -- only foo@FOO is defined in main. If you think it's
> right that main should also have an unversioned definition, then why
> should the call from bar() to foo() bind to the one in the DSO? And
> which foo() are you expecting the indirect reference to bind to?
>
Here is our disagreement on this code:
+#include <stdio.h>
+
+void
+foo (void)
+{
+ printf ("MAIN\n");
+}
+
+asm (".symver foo,foo@FOO");
To me, this defines foo and foo@FOO. Both points to the same
address. This is how gas and ld work on symbol versioning for
a long time. I don't think we should change it just because gold
behaves differently.
--
H.J.