public inbox for
 help / color / mirror / Atom feed
From: Manfred Hollstein <>
Subject: BUG in binutils-2.9.1/ld on m88k-motorola-sysv3
Date: Tue, 07 Jul 1998 04:14:00 -0000	[thread overview]
Message-ID: <13729.64373.444444.251863@slsvhmt> (raw)

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?

binutils-2.9.1/ld fails to recognize this and produces an executable
without any complaint, which will core dump when running, of course.

I've built the stuff using:

$ env CC=sparc-sun-solaris2.5.1-gcc 'CFLAGS=-O0 -g ' LDFLAGS=-g ' \
      LINGUAS=de es fr it' 'INSTALL=/tools/gnu/bin/install -c'	  \
      'INSTALL_DATA=/tools/gnu/bin/install -c -m 644'		  \
      'INSTALL_PROGRAM=/tools/gnu/bin/install -c -m 755'	  \
  /bin/sh ../binutils-2.9.1/configure --host=sparc-sun-solaris2.5.1	\
      --target=delta88 --build=sparc-sun-solaris2.5.1			\
      --srcdir=../binutils-2.9.1					\
      --prefix=/u/b60/manfred/gnu/sparc-sun-solaris2.5.1		\
      --enable-targets=delta88,m68k-motorola-sysv,m88k-motorola-sysv3,m68k-unknown-ieee \
      --enable-shared=no --verbose
$ gmake -wk SHELL=/u/b60/manfred/gnu/sparc-sun-solaris2.5.1/bin/bash all check info

To simplify checking, fixing (I've already debugged, but cannot find
the reason), ... I've appended a small 88k assembler source, which can 
be used to demonstrate the problem.

	file	 "foo.s"
	align	 8
	global	 __start
	or.u	 r13,r0,hi16(_global_var)
	or	 r12,r0,1
	st.b	 r12,r13,lo16(_global_var)
	jmp	 r1

$ ./gas/as-new -o foo.o foo.s
$ ./binutils/nm-new foo.o
00000010 b .bss
00000010 d .data
00000000 t .text
00000000 T __start
         U _global_var

Looks good, so far; but, when linking, NO complaint:

$ ./ld/ld-new -o a.out foo.o 
$ ./binutils/nm-new a.out
004000c8 b .bss
004000c8 d .data
000200b8 t .text
000200c8 T __.fini_end
000200c8 T __.fini_start
000200b8 T __.init.end
000200b8 T __.init.start
000200c8 T __.initp.end
000200c8 T __.initp.start
000200c8 T __.tdesc_start
000200b8 T __.text.start
000200c8 T __.text_end
004000c8 B __end
000200b8 T __start
004000c8 D _edata
004000c8 B _end
000200c8 T _etext
         U _global_var

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 :-?

Any ideas?

 Manfred Hollstein       If you have any questions about GNU software:
 Hindenburgstr. 13/1                   < >
 75446 Wiernsheim, FRG  < >
 PGP key:    < >

             reply	other threads:[~1998-07-07  4:14 UTC|newest]

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

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:

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

  git send-email \
    --in-reply-to=13729.64373.444444.251863@slsvhmt \ \ \ \ \ \

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