public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* It is ok to have undefined hidden symbols in a .o file
@ 2000-06-05 12:59 H . J . Lu
  2000-06-05 13:03 ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: H . J . Lu @ 2000-06-05 12:59 UTC (permalink / raw)
  To: loewis; +Cc: Ulrich Drepper, binutils

Where there are

1. foo is undefined, hidden in bar.o
2. foo is defined in foo.o.

both

# gcc -shared -o libfoo.so bar.o foo.o
# gcc -shared -o libfoo.so foo.o bar.o

should work. This patch fixes it. I'd like to check it in if it
is ok with everyone.


-- 
H.J. Lu (hjl@gnu.org)
--
2000-06-05  H.J. Lu  <hjl@gnu.org>

	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
	an error when seeing an undefined symbol with hidden/internal
	attributes. It is handled in *_relocate_section ().

Index: elflink.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.c,v
retrieving revision 1.4
diff -u -p -r1.4 elflink.c
--- elflink.c	2000/05/30 19:32:42	1.4
+++ elflink.c	2000/06/05 19:50:49
@@ -226,21 +226,8 @@ _bfd_elf_link_record_dynamic_symbol (inf
 	{
 	case STV_INTERNAL:
 	case STV_HIDDEN:
-	  /* This symbol must be defined in the shared object or
-	     executable.  */
-	  if (h->root.type == bfd_link_hash_undefined)
-	    {
-	      bfd * abfd = h->root.u.undef.abfd;
-	      const char * name = h->root.root.string;
-	      
-	      (*info->callbacks->undefined_symbol)
-		(info, name, abfd, bfd_und_section_ptr, 0, true);
-
-	      /* We have flaged a fatal error. We now treat this as
-	         a normal symbol to avoid further error messages. */
-	      h->other ^= ELF_ST_VISIBILITY (h->other);
-	    }
-	  else if (h->root.type != bfd_link_hash_undefweak)
+	  if (h->root.type != bfd_link_hash_undefined
+	      && h->root.type != bfd_link_hash_undefweak)
 	    {
 	      h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
 	      return true;

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

* Re: It is ok to have undefined hidden symbols in a .o file
  2000-06-05 12:59 It is ok to have undefined hidden symbols in a .o file H . J . Lu
@ 2000-06-05 13:03 ` Ulrich Drepper
  2000-06-05 13:49   ` H . J . Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Drepper @ 2000-06-05 13:03 UTC (permalink / raw)
  To: H . J . Lu; +Cc: loewis, binutils

"H . J . Lu" <hjl@valinux.com> writes:

> Where there are
> 
> 1. foo is undefined, hidden in bar.o
> 2. foo is defined in foo.o.

Yep, this must be possible.

> both
> 
> # gcc -shared -o libfoo.so bar.o foo.o
> # gcc -shared -o libfoo.so foo.o bar.o
> 
> should work. This patch fixes it. I'd like to check it in if it
> is ok with everyone.

Makes sense to me.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

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

* Re: It is ok to have undefined hidden symbols in a .o file
  2000-06-05 13:03 ` Ulrich Drepper
@ 2000-06-05 13:49   ` H . J . Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H . J . Lu @ 2000-06-05 13:49 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: loewis, binutils

On Mon, Jun 05, 2000 at 01:03:43PM -0700, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@valinux.com> writes:
> 
> > Where there are
> > 
> > 1. foo is undefined, hidden in bar.o
> > 2. foo is defined in foo.o.
> 
> Yep, this must be possible.
> 
> > both
> > 
> > # gcc -shared -o libfoo.so bar.o foo.o
> > # gcc -shared -o libfoo.so foo.o bar.o
> > 
> > should work. This patch fixes it. I'd like to check it in if it
> > is ok with everyone.
> 
> Makes sense to me.
> 

Thanks. I checked in my patch. I also checked some new testcases into
ld/testsuite/ld-elfvsb.


-- 
H.J. Lu (hjl@gnu.org)

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

* Re: It is ok to have undefined hidden symbols in a .o file
@ 2000-06-05 15:01 Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2000-06-05 15:01 UTC (permalink / raw)
  To: hjl; +Cc: loewis, drepper, binutils

Hi H.J.

: 2000-06-05  H.J. Lu  <hjl@gnu.org>
: 
: 	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
: 	an error when seeing an undefined symbol with hidden/internal
: 	attributes. It is handled in *_relocate_section ().

Approved.

Cheers
	Nick

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

end of thread, other threads:[~2000-06-05 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-05 12:59 It is ok to have undefined hidden symbols in a .o file H . J . Lu
2000-06-05 13:03 ` Ulrich Drepper
2000-06-05 13:49   ` H . J . Lu
2000-06-05 15:01 Nick Clifton

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