* PATCH: Problem with GNU ld version 2.14.90.0.1 20030505 (Linux)
[not found] ` <20030508031637.GA3596@nevyn.them.org>
@ 2003-05-08 4:15 ` H. J. Lu
2003-05-08 5:09 ` PATCH: A testcase H. J. Lu
0 siblings, 1 reply; 4+ messages in thread
From: H. J. Lu @ 2003-05-08 4:15 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Dr. Ernst Molitor, molitor, bug-binutils, binutils
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
On Wed, May 07, 2003 at 11:16:37PM -0400, Daniel Jacobowitz wrote:
> Hmm? I don't see this as a binutils bug - which patch of HJ's is it?
>
Here are the patch and the testcase. Alan has OKed the patch in
private email. I will check in a testcase patch based on my testcase
also.
H.J.
[-- Attachment #2: bug.tar.gz --]
[-- Type: application/x-gzip, Size: 560 bytes --]
[-- Attachment #3: bfd-hidden.patch --]
[-- Type: text/plain, Size: 2800 bytes --]
2003-05-07 H.J. Lu <hongjiu.lu@intel.com>
* elflink.h (elf_link_check_versioned_symbol): Also handle the
case that a DSO references a hidden symbol which may be
satisfied by a versioned symbol in another DSO.
(elf_link_output_extsym): Check versioned definition for hidden
symbol referenced by a DSO.
--- bfd/elflink.h.hidden 2003-05-07 09:10:22.000000000 -0700
+++ bfd/elflink.h 2003-05-07 19:24:29.000000000 -0700
@@ -6229,21 +6229,45 @@ elf_link_sec_merge_syms (h, data)
/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
allowing an unsatisfied unversioned symbol in the DSO to match a
- versioned symbol that would normally require an explicit version. */
+ versioned symbol that would normally require an explicit version.
+ We also handle the case that a DSO references a hidden symbol
+ which may be satisfied by a versioned symbol in another DSO. */
static bfd_boolean
elf_link_check_versioned_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
- bfd *undef_bfd = h->root.u.undef.abfd;
+ bfd *abfd;
struct elf_link_loaded_list *loaded;
- if ((undef_bfd->flags & DYNAMIC) == 0
- || info->hash->creator->flavour != bfd_target_elf_flavour
- || elf_dt_soname (undef_bfd) == NULL)
+ if (info->hash->creator->flavour != bfd_target_elf_flavour)
return FALSE;
+ switch (h->root.type)
+ {
+ default:
+ abfd = NULL;
+ break;
+
+ case bfd_link_hash_undefined:
+ case bfd_link_hash_undefweak:
+ abfd = h->root.u.undef.abfd;
+ if ((abfd->flags & DYNAMIC) == 0 || elf_dt_soname (abfd) == NULL)
+ return FALSE;
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ abfd = h->root.u.def.section->owner;
+ break;
+
+ case bfd_link_hash_common:
+ abfd = h->root.u.c.p->section->owner;
+ break;
+ }
+ BFD_ASSERT (abfd != NULL);
+
for (loaded = elf_hash_table (info)->loaded;
loaded != NULL;
loaded = loaded->next)
@@ -6263,7 +6287,7 @@ elf_link_check_versioned_symbol (info, h
input = loaded->abfd;
/* We check each DSO for a possible hidden versioned definition. */
- if (input == undef_bfd
+ if (input == abfd
|| (input->flags & DYNAMIC) == 0
|| elf_dynversym (input) == 0)
continue;
@@ -6415,7 +6439,8 @@ elf_link_output_extsym (h, data)
&& (h->elf_link_hash_flags
& (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC
| ELF_LINK_DYNAMIC_DEF | ELF_LINK_DYNAMIC_WEAK))
- == (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC))
+ == (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC)
+ && ! elf_link_check_versioned_symbol (finfo->info, h))
{
(*_bfd_error_handler)
(_("%s: %s symbol `%s' in %s is referenced by DSO"),
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: A testcase
2003-05-08 4:15 ` PATCH: Problem with GNU ld version 2.14.90.0.1 20030505 (Linux) H. J. Lu
@ 2003-05-08 5:09 ` H. J. Lu
0 siblings, 0 replies; 4+ messages in thread
From: H. J. Lu @ 2003-05-08 5:09 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
On Wed, May 07, 2003 at 09:15:38PM -0700, H. J. Lu wrote:
> On Wed, May 07, 2003 at 11:16:37PM -0400, Daniel Jacobowitz wrote:
> > Hmm? I don't see this as a binutils bug - which patch of HJ's is it?
> >
>
> Here are the patch and the testcase. Alan has OKed the patch in
> private email. I will check in a testcase patch based on my testcase
> also.
>
I will check in this testcase shortly.
H.J.
[-- Attachment #2: ld-hidden-test.patch --]
[-- Type: text/plain, Size: 4467 bytes --]
2003-05-07 H.J. Lu <hongjiu.lu@intel.com>
* ld-elfvers/vers.exp (build_binary): Support build exeutable.
(build_binary): Renamed from ...
(build_vers_lib): This.
(build_vers_lib_no_pic): Updated.
(build_vers_lib_pic): Likewise.
Add vers27d1, vers27d2 and vers27d3 to test versioned
definition for hidden symbol referenced by a DSO.
* ld-elfvers/vers27d.dsym: New file.
* ld-elfvers/vers27d.sym: Likewise.
* ld-elfvers/vers27d.ver: Likewise.
* ld-elfvers/vers27d1.c: Likewise.
* ld-elfvers/vers27d2.c: Likewise.
* ld-elfvers/vers27d3.c: Likewise.
--- ld/testsuite/ld-elfvers/vers.exp.hidden 2003-05-07 21:16:30.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers.exp 2003-05-07 21:59:18.000000000 -0700
@@ -497,7 +497,7 @@ proc objdump_versionstuff { objdump obje
}
}
-proc build_vers_lib { pic test source libname other mapfile verexp versymexp symexp } {
+proc build_binary { shared pic test source libname other mapfile verexp versymexp symexp } {
global ld
global srcdir
global subdir
@@ -508,7 +508,6 @@ proc build_vers_lib { pic test source li
global objdump
global CC
global CFLAGS
- global shared
global script
if ![ld_compile "$CC -S $pic $CFLAGS" $srcdir/$subdir/$source $tmpdir/$libname.s] {
@@ -565,13 +564,19 @@ proc build_vers_lib { pic test source li
}
+proc build_executable { test source libname other mapfile verexp versymexp symexp } {
+ build_binary "" "" $test $source $libname $other $mapfile $verexp $versymexp $symexp
+}
+
proc build_vers_lib_no_pic { test source libname other mapfile verexp versymexp symexp } {
- build_vers_lib "" $test $source $libname $other $mapfile $verexp $versymexp $symexp
+ global shared
+ build_binary $shared "" $test $source $libname $other $mapfile $verexp $versymexp $symexp
}
proc build_vers_lib_pic { test source libname other mapfile verexp versymexp symexp } {
global picflag
- build_vers_lib $picflag $test $source $libname $other $mapfile $verexp $versymexp $symexp
+ global shared
+ build_binary $shared $picflag $test $source $libname $other $mapfile $verexp $versymexp $symexp
}
proc test_ldfail { test flag source execname other mapfile whyfail } {
@@ -929,3 +934,6 @@ build_vers_lib_no_pic "vers27a" vers27a.
build_vers_lib_no_pic "vers27b" vers27b.c vers27b "" "" vers27b.ver vers27b.dsym ""
build_vers_lib_no_pic "vers27c1" vers27c.c vers27c1 "vers27b.o vers27a.so" "" vers27c.ver vers27c.dsym ""
build_vers_lib_no_pic "vers27c2" vers27c.c vers27c2 "vers27a.so vers27b.o" "" vers27c.ver vers27c.dsym ""
+build_vers_lib_pic "vers27d1" vers27d1.c vers27d1 "" vers27a.map vers27d.ver vers27d.dsym vers27d.sym
+build_vers_lib_pic "vers27d2" vers27d2.c vers27d2 "" "" vers27b.ver vers27b.dsym ""
+build_executable "vers27d3" vers27d3.c vers27d3 "vers27b.o vers27d2.so vers27d1.so" "" vers27b.ver vers27b.dsym ""
--- ld/testsuite/ld-elfvers/vers27d.dsym.hidden 2003-05-07 22:00:12.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27d.dsym 2003-05-07 21:36:20.000000000 -0700
@@ -0,0 +1,2 @@
+[0]*[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+[0]*[ ]+VERS.0[ ]+VERS.0
+[0-9a-f]*[ ]+g[ ]+DF[ ]+.text[ ]+[0-9a-f]*[ ]+\(VERS.0\)[ ]+(0x[0-9a-f]*|)[ ]*foo
--- ld/testsuite/ld-elfvers/vers27d.sym.hidden 2003-05-07 22:00:12.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27d.sym 2003-05-07 21:37:47.000000000 -0700
@@ -0,0 +1 @@
+[0-9a-f]*[ ]+g[ ]+F[ ]+.text[ ]+[0-9a-f]* (0x[0-9a-f][0-9a-f] )?foo@VERS.0
--- ld/testsuite/ld-elfvers/vers27d.ver.hidden 2003-05-07 22:00:12.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27d.ver 2003-05-07 21:56:45.000000000 -0700
@@ -0,0 +1,4 @@
+Version definitions:
+1 0x01 0x05ac0cff vers27d1.so
+2 0x00 0x05aa7610 VERS.0
+
--- ld/testsuite/ld-elfvers/vers27d1.c.hidden 2003-05-07 22:00:12.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27d1.c 2003-05-07 21:27:05.000000000 -0700
@@ -0,0 +1,6 @@
+void
+foo ()
+{
+}
+
+asm (".symver foo,foo@VERS.0");
--- ld/testsuite/ld-elfvers/vers27d2.c.hidden 2003-05-07 22:00:12.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27d2.c 2003-05-07 21:27:35.000000000 -0700
@@ -0,0 +1,7 @@
+void foo ();
+
+void
+ref ()
+{
+ foo ();
+}
--- ld/testsuite/ld-elfvers/vers27d3.c.hidden 2003-05-07 22:00:12.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27d3.c 2003-05-07 21:29:22.000000000 -0700
@@ -0,0 +1,11 @@
+extern void ref ();
+extern void foo ();
+
+void _start() __asm__("_start");
+
+void
+_start ()
+{
+ foo ();
+ ref ();
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with GNU ld version 2.14.90.0.1 20030505 (Linux)
[not found] ` <1052380351.20525.47.camel@felicia>
@ 2003-05-08 14:15 ` H. J. Lu
2003-05-08 16:22 ` Dr. Ernst Molitor
0 siblings, 1 reply; 4+ messages in thread
From: H. J. Lu @ 2003-05-08 14:15 UTC (permalink / raw)
To: Dr. Ernst Molitor; +Cc: Daniel Jacobowitz, Alan Modra, binutils
On Thu, May 08, 2003 at 09:52:31AM +0200, Dr. Ernst Molitor wrote:
>
> LD does not print out which DSO caused the problem. The full output of
> the testcase kindly provided by H.J.Lu on my box (with GNU ld version
> 2.14.90.0.1 20030505) is:
It is hard to tell which DSO references a hidden symbol without adding
some new data fields. I don't think it is worth its memory usage and
complication.
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with GNU ld version 2.14.90.0.1 20030505 (Linux)
2003-05-08 14:15 ` Problem with GNU ld version 2.14.90.0.1 20030505 (Linux) H. J. Lu
@ 2003-05-08 16:22 ` Dr. Ernst Molitor
0 siblings, 0 replies; 4+ messages in thread
From: Dr. Ernst Molitor @ 2003-05-08 16:22 UTC (permalink / raw)
To: H. J. Lu; +Cc: Daniel Jacobowitz, Alan Modra, binutils
On Thu, 2003-05-08 at 16:14, H. J. Lu wrote:
>
> It is hard to tell which DSO references a hidden symbol without adding
> some new data fields. I don't think it is worth its memory usage and
> complication.
>
Given the ease with which the symbols from the DSOs in question can be
had as a list to look into (e.g., using nm -l <name of DSO>), I feel
things are fine right now (with your patch applied...).
Again, thank you very much.
Best wishes and regards,
Ernst
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-05-08 16:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1052346144.20677.40.camel@felicia>
[not found] ` <20030508022830.GA2983@nevyn.them.org>
[not found] ` <20030508025732.GD11607@bubble.sa.bigpond.net.au>
[not found] ` <20030508031637.GA3596@nevyn.them.org>
2003-05-08 4:15 ` PATCH: Problem with GNU ld version 2.14.90.0.1 20030505 (Linux) H. J. Lu
2003-05-08 5:09 ` PATCH: A testcase H. J. Lu
[not found] ` <1052380351.20525.47.camel@felicia>
2003-05-08 14:15 ` Problem with GNU ld version 2.14.90.0.1 20030505 (Linux) H. J. Lu
2003-05-08 16:22 ` Dr. Ernst Molitor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).