public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* libc divdi3 and libgcc
@ 2003-05-02 10:12 Alan Modra
  2003-05-02 14:39 ` H. J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2003-05-02 10:12 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

HJ,
  I think your 2003-04-27 change broke ld.

Configuring gcc with
/src/gcc-3.3/configure --prefix=/usr/local --build=i686-linux \
 --host=i686-linux --target=i686-linux --disable-nls --enable-shared \
 --enable-languages=c,c++

I see

stage1/xgcc -Bstage1/ -B/usr/local/i686-linux/bin/   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H  -o cc1 \
        c-parse.o c-lang.o c-pretty-print.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-objc-common.o c-dump.o libcpp.a  main.o libbackend.a   ../libiberty/libiberty.a
/lib/libc.so.6(*IND*+0x0): multiple definition of `__divdi3'
stage1/libgcc.a(_divdi3.oS)(.text+0x0):/src/gcc-3.3/gcc/libgcc2.c:737: first defined here

__divdi3 in libc is FUNC GLOBAL DEFAULT,
in _divdi3.oS it is FUNC GLOBAL HIDDEN

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-02 10:12 libc divdi3 and libgcc Alan Modra
@ 2003-05-02 14:39 ` H. J. Lu
  2003-05-02 15:44   ` H. J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2003-05-02 14:39 UTC (permalink / raw)
  To: binutils

On Fri, May 02, 2003 at 07:42:24PM +0930, Alan Modra wrote:
> HJ,
>   I think your 2003-04-27 change broke ld.
> 
> Configuring gcc with
> /src/gcc-3.3/configure --prefix=/usr/local --build=i686-linux \
>  --host=i686-linux --target=i686-linux --disable-nls --enable-shared \
>  --enable-languages=c,c++
> 
> I see
> 
> stage1/xgcc -Bstage1/ -B/usr/local/i686-linux/bin/   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H  -o cc1 \
>         c-parse.o c-lang.o c-pretty-print.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-objc-common.o c-dump.o libcpp.a  main.o libbackend.a   ../libiberty/libiberty.a
> /lib/libc.so.6(*IND*+0x0): multiple definition of `__divdi3'
> stage1/libgcc.a(_divdi3.oS)(.text+0x0):/src/gcc-3.3/gcc/libgcc2.c:737: first defined here
> 
> __divdi3 in libc is FUNC GLOBAL DEFAULT,
> in _divdi3.oS it is FUNC GLOBAL HIDDEN
> 

I am using the current binutils on gcc gcc-3_2-rhl8-branch and gcc
mainline. I have no problems. I will check out gcc 3.3.


H.J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-02 14:39 ` H. J. Lu
@ 2003-05-02 15:44   ` H. J. Lu
  2003-05-03  1:52     ` Alan Modra
  0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2003-05-02 15:44 UTC (permalink / raw)
  To: binutils

On Fri, May 02, 2003 at 07:39:00AM -0700, H. J. Lu wrote:
> On Fri, May 02, 2003 at 07:42:24PM +0930, Alan Modra wrote:
> > HJ,
> >   I think your 2003-04-27 change broke ld.
> > 
> > Configuring gcc with
> > /src/gcc-3.3/configure --prefix=/usr/local --build=i686-linux \
> >  --host=i686-linux --target=i686-linux --disable-nls --enable-shared \
> >  --enable-languages=c,c++
> > 
> > I see
> > 
> > stage1/xgcc -Bstage1/ -B/usr/local/i686-linux/bin/   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H  -o cc1 \
> >         c-parse.o c-lang.o c-pretty-print.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-objc-common.o c-dump.o libcpp.a  main.o libbackend.a   ../libiberty/libiberty.a
> > /lib/libc.so.6(*IND*+0x0): multiple definition of `__divdi3'
> > stage1/libgcc.a(_divdi3.oS)(.text+0x0):/src/gcc-3.3/gcc/libgcc2.c:737: first defined here
> > 
> > __divdi3 in libc is FUNC GLOBAL DEFAULT,
> > in _divdi3.oS it is FUNC GLOBAL HIDDEN
> > 
> 
> I am using the current binutils on gcc gcc-3_2-rhl8-branch and gcc
> mainline. I have no problems. I will check out gcc 3.3.
> 
> 
> H.J.

I have no problem with gcc 3.3 either. But I do have one patch

http://sources.redhat.com/ml/binutils/2003-04/msg00568.html

in my binutils. If you still have this problem, please create a small
testcase. I will look into it.


H.J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-02 15:44   ` H. J. Lu
@ 2003-05-03  1:52     ` Alan Modra
  2003-05-03  2:30       ` H. J. Lu
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Alan Modra @ 2003-05-03  1:52 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

On Fri, May 02, 2003 at 08:44:30AM -0700, H. J. Lu wrote:
> in my binutils. If you still have this problem, please create a small
> testcase. I will look into it.

cat > lib.s <<EOF
 .data
 .global x
x: .long 0
EOF
cat > lib.ver <<EOF
FOO { x; };
EOF
cat > main.s <<EOF
 .text
 .global _start
_start:
 jmp _start

 .data
 .global x
 .hidden x
x: .long 0
EOF
as -o lib.o lib.s
as -o main.o main.s
ld -shared -o lib.so --version-script lib.ver lib.o
ld main.o lib.so

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-03  1:52     ` Alan Modra
@ 2003-05-03  2:30       ` H. J. Lu
  2003-05-03  7:06       ` H. J. Lu
  2003-05-03 16:54       ` H. J. Lu
  2 siblings, 0 replies; 9+ messages in thread
From: H. J. Lu @ 2003-05-03  2:30 UTC (permalink / raw)
  To: binutils

On Sat, May 03, 2003 at 11:22:47AM +0930, Alan Modra wrote:
> On Fri, May 02, 2003 at 08:44:30AM -0700, H. J. Lu wrote:
> > in my binutils. If you still have this problem, please create a small
> > testcase. I will look into it.
> 

I see it now. It is odd that I have no problem with gcc on RedHat 9.
I will fix it this weekend.


H.J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-03  1:52     ` Alan Modra
  2003-05-03  2:30       ` H. J. Lu
@ 2003-05-03  7:06       ` H. J. Lu
  2003-05-05  0:30         ` Alan Modra
  2003-05-03 16:54       ` H. J. Lu
  2 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2003-05-03  7:06 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

On Sat, May 03, 2003 at 11:22:47AM +0930, Alan Modra wrote:
> On Fri, May 02, 2003 at 08:44:30AM -0700, H. J. Lu wrote:
> > in my binutils. If you still have this problem, please create a small
> > testcase. I will look into it.
> 
> cat > lib.s <<EOF
>  .data
>  .global x
> x: .long 0
> EOF
> cat > lib.ver <<EOF
> FOO { x; };
> EOF
> cat > main.s <<EOF
>  .text
>  .global _start
> _start:
>  jmp _start
> 
>  .data
>  .global x
>  .hidden x
> x: .long 0
> EOF
> as -o lib.o lib.s
> as -o main.o main.s
> ld -shared -o lib.so --version-script lib.ver lib.o
> ld main.o lib.so
> 

This patch fixed it. I will add some testcases later.


H.J.

[-- Attachment #2: binutils-vsb-ver.patch --]
[-- Type: text/plain, Size: 2164 bytes --]

2003-05-03  H.J. Lu <hjl@gnu.org>

	* elflink.h (elf_merge_symbol): Don't record a hidden/internal
	symbol dynamic. Check indirection when removing the old
	definition for symbols with non-default visibility.
	(elf_add_default_symbol): Skip when told by elf_merge_symbol.

--- bfd/elflink.h.vsb	2003-05-01 08:59:33.000000000 -0700
+++ bfd/elflink.h	2003-05-02 23:48:54.000000000 -0700
@@ -641,7 +641,10 @@ elf_merge_symbol (abfd, info, name, sym,
       /* Make sure this symbol is dynamic.  */
       h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
       /* FIXME: Should we check type and size for protected symbol?  */
-      return _bfd_elf_link_record_dynamic_symbol (info, h);
+      if (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
+	return _bfd_elf_link_record_dynamic_symbol (info, h);
+      else
+	return TRUE;
     }
   else if (!newdyn
 	   && ELF_ST_VISIBILITY (sym->st_other)
@@ -650,10 +653,15 @@ elf_merge_symbol (abfd, info, name, sym,
       /* If the new symbol with non-default visibility comes from a
 	 relocatable file and the old definition comes from a dynamic
 	 object, we remove the old definition.  */
+      if ((*sym_hash)->root.type == bfd_link_hash_indirect)
+	h = *sym_hash;
       h->root.type = bfd_link_hash_new;
       h->root.u.undef.abfd = NULL;
-      h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
-      h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+      if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+	{
+	  h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
+	  h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+	}
       /* FIXME: Should we check type and size for protected symbol?  */
       h->size = 0;
       h->type = 0;
@@ -1096,6 +1104,9 @@ elf_add_default_symbol (abfd, info, h, n
 			  &size_change_ok, dt_needed))
     return FALSE;
 
+  if (skip)
+    return TRUE;
+
   if (! override)
     {
       bh = &hi->root;
@@ -1205,6 +1216,9 @@ elf_add_default_symbol (abfd, info, h, n
 			  &size_change_ok, dt_needed))
     return FALSE;
 
+  if (skip)
+    return TRUE;
+
   if (override)
     {
       /* Here SHORTNAME is a versioned name, so we don't expect to see

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-03  1:52     ` Alan Modra
  2003-05-03  2:30       ` H. J. Lu
  2003-05-03  7:06       ` H. J. Lu
@ 2003-05-03 16:54       ` H. J. Lu
  2 siblings, 0 replies; 9+ messages in thread
From: H. J. Lu @ 2003-05-03 16:54 UTC (permalink / raw)
  To: binutils

On Sat, May 03, 2003 at 11:22:47AM +0930, Alan Modra wrote:
> On Fri, May 02, 2003 at 08:44:30AM -0700, H. J. Lu wrote:
> > in my binutils. If you still have this problem, please create a small
> > testcase. I will look into it.
> 

I checked in the following testcase.


H.J.
---
2003-05-03  H.J. Lu <hjl@gnu.org>

	* ld-elfvers/vers.exp: Add vers27a, vers27b, vers27c1 and
	vers27c2 to test versioned definition vs. hidden definition in
	different files.

	* ld-elfvers/vers27a.c: New file.
	* ld-elfvers/vers27a.dsym: Likewise.
	* ld-elfvers/vers27a.map: Likewise.
	* ld-elfvers/vers27a.ver: Likewise.
	* ld-elfvers/vers27b.c: Likewise.

	* ld-elfvers/vers27b.dsym: New empty file.
	* ld-elfvers/vers27b.ver: Likwise.
	* ld-elfvers/vers27c.c: Likwise.
	* ld-elfvers/vers27c.dsym: Likwise.
	* ld-elfvers/vers27c.ver: Likwise.

--- ld/testsuite/ld-elfvers/vers.exp.ver-vsb	2003-05-03 00:06:48.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers.exp	2003-05-03 09:37:31.000000000 -0700
@@ -919,3 +919,9 @@ if [istarget x86_64-*-linux*] {
 } else {
     build_vers_lib_no_pic "vers26b3" vers26b.c vers26b3 "vers26a.so vers26b1.so vers26a.o" "" vers26b.ver vers26b.dsym ""
 }
+
+# Test versioned definition vs. hidden definition in different files.
+build_vers_lib_no_pic "vers27a" vers27a.c vers27a "" vers27a.map vers27a.ver vers27a.dsym ""
+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 ""
--- ld/testsuite/ld-elfvers/vers27a.c.ver-vsb	2003-05-03 09:38:46.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27a.c	2003-05-03 09:26:45.000000000 -0700
@@ -0,0 +1 @@
+void foo () {}
--- ld/testsuite/ld-elfvers/vers27a.dsym.ver-vsb	2003-05-03 09:38:46.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27a.dsym	2003-05-03 09:28:50.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/vers27a.map.ver-vsb	2003-05-03 09:38:46.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27a.map	2003-05-03 09:28:27.000000000 -0700
@@ -0,0 +1,5 @@
+VERS.0 {
+  global:
+    foo;
+  local: *;
+};
--- ld/testsuite/ld-elfvers/vers27a.ver.ver-vsb	2003-05-03 09:38:46.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27a.ver	2003-05-03 09:30:25.000000000 -0700
@@ -0,0 +1,4 @@
+Version definitions:
+1 0x01 0x065b090f vers27a.so
+2 0x00 0x05aa7610 VERS.0
+
--- ld/testsuite/ld-elfvers/vers27b.c.ver-vsb	2003-05-03 09:38:46.000000000 -0700
+++ ld/testsuite/ld-elfvers/vers27b.c	2003-05-03 09:31:03.000000000 -0700
@@ -0,0 +1,2 @@
+void foo () {}
+asm (".hidden foo");

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-03  7:06       ` H. J. Lu
@ 2003-05-05  0:30         ` Alan Modra
  2003-05-05  0:55           ` H. J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2003-05-05  0:30 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

On Sat, May 03, 2003 at 12:05:59AM -0700, H. J. Lu wrote:
> 2003-05-03  H.J. Lu <hjl@gnu.org>
> 
> 	* elflink.h (elf_merge_symbol): Don't record a hidden/internal
> 	symbol dynamic. Check indirection when removing the old
> 	definition for symbols with non-default visibility.
> 	(elf_add_default_symbol): Skip when told by elf_merge_symbol.
> 
> --- bfd/elflink.h.vsb	2003-05-01 08:59:33.000000000 -0700
> +++ bfd/elflink.h	2003-05-02 23:48:54.000000000 -0700
> @@ -641,7 +641,10 @@ elf_merge_symbol (abfd, info, name, sym,
>        /* Make sure this symbol is dynamic.  */
>        h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
>        /* FIXME: Should we check type and size for protected symbol?  */
> -      return _bfd_elf_link_record_dynamic_symbol (info, h);
> +      if (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
> +	return _bfd_elf_link_record_dynamic_symbol (info, h);
> +      else
> +	return TRUE;
>      }
>    else if (!newdyn
>  	   && ELF_ST_VISIBILITY (sym->st_other)

Please comment the reason why STV_PROTECTED needs to be treated
specially.  OK to commit with that change.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: libc divdi3 and libgcc
  2003-05-05  0:30         ` Alan Modra
@ 2003-05-05  0:55           ` H. J. Lu
  0 siblings, 0 replies; 9+ messages in thread
From: H. J. Lu @ 2003-05-05  0:55 UTC (permalink / raw)
  To: binutils

On Mon, May 05, 2003 at 09:59:32AM +0930, Alan Modra wrote:
> On Sat, May 03, 2003 at 12:05:59AM -0700, H. J. Lu wrote:
> > 2003-05-03  H.J. Lu <hjl@gnu.org>
> > 
> > 	* elflink.h (elf_merge_symbol): Don't record a hidden/internal
> > 	symbol dynamic. Check indirection when removing the old
> > 	definition for symbols with non-default visibility.
> > 	(elf_add_default_symbol): Skip when told by elf_merge_symbol.
> > 
> > --- bfd/elflink.h.vsb	2003-05-01 08:59:33.000000000 -0700
> > +++ bfd/elflink.h	2003-05-02 23:48:54.000000000 -0700
> > @@ -641,7 +641,10 @@ elf_merge_symbol (abfd, info, name, sym,
> >        /* Make sure this symbol is dynamic.  */
> >        h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
> >        /* FIXME: Should we check type and size for protected symbol?  */
> > -      return _bfd_elf_link_record_dynamic_symbol (info, h);
> > +      if (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
> > +	return _bfd_elf_link_record_dynamic_symbol (info, h);
> > +      else
> > +	return TRUE;
> >      }
> >    else if (!newdyn
> >  	   && ELF_ST_VISIBILITY (sym->st_other)
> 
> Please comment the reason why STV_PROTECTED needs to be treated
> specially.  OK to commit with that change.
> 

Done.


H.J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-05-05  0:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-02 10:12 libc divdi3 and libgcc Alan Modra
2003-05-02 14:39 ` H. J. Lu
2003-05-02 15:44   ` H. J. Lu
2003-05-03  1:52     ` Alan Modra
2003-05-03  2:30       ` H. J. Lu
2003-05-03  7:06       ` H. J. Lu
2003-05-05  0:30         ` Alan Modra
2003-05-05  0:55           ` H. J. Lu
2003-05-03 16:54       ` H. J. Lu

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).