public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* Bugs in gcc or binutils 2.7?
@ 1996-07-18  0:27 H.J. Lu
  1996-07-18  8:53 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 1996-07-18  0:27 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc2, Ken Raeburn, gas2

I got this with binutils 2.7 under i486-linux:

# cat foo.c
#pragma weak foo
foo ()
{
}
# gcc -c foo.c
/tmp/cca21074.s: Assembler messages:
/tmp/cca21074.s:17: Error: foo already declared as global


-- 
H.J. Lu
Innovix Technologies, Inc.
hjl@innovix.com

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

* Re: Bugs in gcc or binutils 2.7?
  1996-07-18  0:27 Bugs in gcc or binutils 2.7? H.J. Lu
@ 1996-07-18  8:53 ` Ian Lance Taylor
  1996-07-18 10:42   ` Robert.Wilhelm
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 1996-07-18  8:53 UTC (permalink / raw)
  To: hjl; +Cc: gcc2, raeburn, gas2

   From: hjl@innovix.com (H.J. Lu)
   Date: Thu, 18 Jul 1996 00:25:30 -0700 (PDT)

   I got this with binutils 2.7 under i486-linux:

   # cat foo.c
   #pragma weak foo
   foo ()
   {
   }
   # gcc -c foo.c
   /tmp/cca21074.s: Assembler messages:
   /tmp/cca21074.s:17: Error: foo already declared as global

The assembler has issued this warning for over a year, including the
2.6 release.  I recently (July 5) changed the warning into an error.
Do you receive a warning when you use an earlier version of the
binutils?

Ian


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

* Re: Bugs in gcc or binutils 2.7?
  1996-07-18  8:53 ` Ian Lance Taylor
@ 1996-07-18 10:42   ` Robert.Wilhelm
  1996-07-18 12:46     ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Robert.Wilhelm @ 1996-07-18 10:42 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: hjl, gcc2, raeburn, gas2, Robert Wilhelm

> The assembler has issued this warning for over a year, including the
> 2.6 release.  I recently (July 5) changed the warning into an error.
> Do you receive a warning when you use an earlier version of the
> binutils?
> 

gas 2.5.2linux   no message
gas 2.6.0.2      warning
gas 2.7          error

BTW: The current gcc snapshot (ss-960707) produces the same asm-output as
gcc 2.7.2.

$ cat tt.c

#pragma weak foo

foo()
{}


$ gcc  -S tt.c
$ cat tt.s
        .file   "tt.c"
        .version        "01.01"
gcc2_compiled.:
.text
        .align 16
.globl foo
        .type    foo,@function
foo:
        pushl %ebp
        movl %esp,%ebp
.L1:
        movl %ebp,%esp
        popl %ebp
        ret
.Lfe1:
        .size    foo,.Lfe1-foo
        .weak   foo
        .ident  "GCC: (GNU) 2.7.2"

$ as -v tt.s
GNU assembler version cygnus/linux-2.5.2l.15 (i486-linux), using BFD version cygnus/linux-2.5.2l.11
$ as2 -v tt.s
GNU assembler version 2.6 (i586-unknown-linux), using BFD version 2.6.0.2
tt.s: Assembler messages:
tt.s:17: Warning: foo already declared as global
$ as.new -v tt.s
GNU assembler version 2.7 (i486-unknown-linux), using BFD version 2.7
tt.s: Assembler messages:
tt.s:17: Error: foo already declared as global

-- 
Robert Wilhelm  rwilhelm@physik.tu-muenchen.de  robert@gaston.camelot.de

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

* Re: Bugs in gcc or binutils 2.7?
  1996-07-18 10:42   ` Robert.Wilhelm
@ 1996-07-18 12:46     ` Ian Lance Taylor
  1996-07-18 13:25       ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 1996-07-18 12:46 UTC (permalink / raw)
  To: Robert.Wilhelm; +Cc: hjl, gcc2, raeburn, gas2, rwilhelm

   From: Robert.Wilhelm@Physik.TU-Muenchen.DE
   Date: Thu, 18 Jul 1996 19:42:13 +0200 (MET DST)

   > The assembler has issued this warning for over a year, including the
   > 2.6 release.  I recently (July 5) changed the warning into an error.
   > Do you receive a warning when you use an earlier version of the
   > binutils?

   gas 2.5.2linux   no message
   gas 2.6.0.2      warning
   gas 2.7          error

   BTW: The current gcc snapshot (ss-960707) produces the same asm-output as
   gcc 2.7.2.

This program works correctly when compiled by gcc.  It does not try to
define foo as both weak and global.

extern int foo () __attribute__ ((weak));
foo ()
{
}

I'm inclined to think that if gcc wants to handle #pragma weak, it
should do it the same way as __attribute__ ((weak)).  I think the
current assembler behaviour is reasonable, although I can change it if
necessary.

Ian


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

* Re: Bugs in gcc or binutils 2.7?
  1996-07-18 12:46     ` Ian Lance Taylor
@ 1996-07-18 13:25       ` Roland McGrath
  0 siblings, 0 replies; 5+ messages in thread
From: Roland McGrath @ 1996-07-18 13:25 UTC (permalink / raw)
  To: ian; +Cc: Robert.Wilhelm, hjl, gcc2, raeburn, gas2, rwilhelm

I agree GCC should be fixed.  Obviously `#pragma weak' and __attribute__
((weak)) should use the same mechanism (they don't now).  `#pragma weak'
lets you specify undefined externs as weak, which doesn't work with the
__attribute__ ((weak)) syntax (I reported this before and suggested two
possible ways to fix it, but noone ever did anything about it.)


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

end of thread, other threads:[~1996-07-18 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-18  0:27 Bugs in gcc or binutils 2.7? H.J. Lu
1996-07-18  8:53 ` Ian Lance Taylor
1996-07-18 10:42   ` Robert.Wilhelm
1996-07-18 12:46     ` Ian Lance Taylor
1996-07-18 13:25       ` Roland McGrath

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