public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: Manfred Hollstein <manfred@s-direktnet.de>
To: ian@cygnus.com
Cc: bfd@cygnus.com, gas2@cygnus.com, bug-gnu-utils@gnu.org
Subject: Re: BUG in binutils-2.9.1/ld on m88k-motorola-sysv3
Date: Wed, 08 Jul 1998 00:27:00 -0000	[thread overview]
Message-ID: <13731.6659.482340.868072@slsvhmt> (raw)
In-Reply-To: <199807071527.LAA14464@subrogation.cygnus.com>

On Tue, 7 July 1998, 11:27:12, ian@cygnus.com wrote:

 >    Date: Tue,  7 Jul 1998 12:59:39 +0200 (MET DST)
 >    From: Manfred Hollstein <manfred@s-direktnet.de>
 > 
 >    Given this small C source
 > 
 >    /* foo.c */
 >    extern char global_var;
 >    main () { global_var = 1; }
 >    /* EOF */
 > 
 >    should result in an executable with undefined symbols, shouldn't it?
 > 
 >    ...
 > 
 >    As you can see, "global_var" is still undefined. This problem isn't
 >    new, I can easily reproduce it with binutils-2.7 - funnily, we've been 
 >    using this linker already without problems for many million lines of
 >    C/C++ code :-?
 > 
 > Judging by the howto fields in coff-m88k.c, all m88k relocs are
 > handled by the function m88k_special_reloc in that file.  That
 > function does not seem to check for undefined symbols when handling
 > the R_HVRT16 and R_LVRT16 reloc types.  Since it returns bfd_reloc_ok
 > for those types, no further checking will be done.  It should return
 > bfd_reloc_undefined instead for an undefined symbol.  See
 > bfd_perform_relocation.
 > 
 > Ian

Ahh yes, thank you very much for the illumination; I should have
recognized this myself as I introduced the m88k_special_reloc function :-(

The appended patch works for me; Ian, will you check it into the
current development sources?

Thanks, Manfred.

Wed Jul  8 08:01:32 1998  Manfred Hollstein  <manfred@s-direktnet.de>

	* coff-m88k.c (m88k_special_reloc): Don't loose the information
	that a symbol is undefined.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el binutils-2.9.1.orig/bfd/coff-m88k.c binutils-2.9.1/bfd/coff-m88k.c
--- binutils-2.9.1.orig/bfd/coff-m88k.c	Fri May  1 17:48:04 1998
+++ binutils-2.9.1/bfd/coff-m88k.c	Wed Jul  8 08:03:11 1998
@@ -117,8 +117,12 @@ m88k_special_reloc (abfd, reloc_entry, s
 	      bfd_put_16 (abfd, relocation, (unsigned char *) data + addr);
 	}
 
+      /* If we are not producing relocateable output, return an error if
+	 the symbol is not defined.  */
+      if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL)
+	return bfd_reloc_undefined;
+
       return bfd_reloc_ok;
-      break;
 
     default:
       if (output_bfd != (bfd *) NULL)

      reply	other threads:[~1998-07-08  0:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-07  4:14 Manfred Hollstein
1998-07-07  8:27 ` Ian Lance Taylor
1998-07-08  0:27   ` Manfred Hollstein [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13731.6659.482340.868072@slsvhmt \
    --to=manfred@s-direktnet.de \
    --cc=bfd@cygnus.com \
    --cc=bug-gnu-utils@gnu.org \
    --cc=gas2@cygnus.com \
    --cc=ian@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).