public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: sjmunroe@vnet.ibm.com
Cc: libc-hacker@sources.redhat.com
Subject: Re: chech-abi for PPC64
Date: Fri, 21 Mar 2003 22:26:00 -0000	[thread overview]
Message-ID: <200303212149.h2LLnpU20106@magilla.sf.frob.com> (raw)
In-Reply-To: Steven Munroe's message of  Friday, 21 March 2003 15:01:04 -0600 <3E7B7D90.4020807@us.ibm.com>

The discrepancy that is confounding abilist.awk is that these symbols do
not have STT_OBJECT type, which produces "DO" in objdump output.  Instead
they have STT_NOTYPE, which produces "D".  They have also been put into
.sbss rather than .sdata.

You are using gcc 3.3, right?  I get similar results on my ppc32 build when
I use gcc 3.3.  (I have not tried gcc 3.3 on another platform lately.)

I bet that if you try both 3.2 and 3.3 as in the following example from my
ppc32 machine, you will see similar output:

	$ echo 'int x = 0;' | gcc -S -o - -x c -
		.file   "<stdin>"
		.globl x
		.section        ".sdata","aw"
		.align 2
		.type   x,@object
		.size   x,4
	x:
		.long   0
		.ident  "GCC: (GNU) 3.2.3 20030316 (Debian prerelease)"
	$ echo 'int x = 0;' | gcc-3.3 -S -o - -x c -
		.file   "<stdin>"
		.globl x
		.globl x
		.section        ".sbss","aw",@nobits
		.align 2
	x:
		.zero   4
		.size   x, 4
		.ident  "GCC: (GNU) 3.3 20030315 (prerelease)"
	$

GCC 3.3 decides that since these variables are initialized to zero, they
can go into .sbss instead of .sdata.  I guess that's ok (saves a word of
disk space and the overhead of reading it in, which adds up eventually).  

However, it fails to emit the .type directive (and emits .globl twice,
which is harmless but obviously not intended).  My gcc-3.3 does the same
thing for the normal case of a bss symbol, i.e.:

	$ echo 'int x __attribute__((nocommon));' | gcc-3.3 -S -o - -x c -
		.file   "<stdin>"
		.globl x
		.globl x
		.section        ".sbss","aw",@nobits
		.align 2
	x:
		.zero   4
		.size   x, 4
		.ident  "GCC: (GNU) 3.3 20030315 (prerelease)"

	$

The missing type field is only catastrophic for a function symbol, but it
probably creates other problems for variables.  I'm declaring it a feature
that abilist.awk is so anal about parsing the objdump output and caught
this problem for us.

Please report this as a GCC bug through appropriate channels.  My last
trivial example is probably the simplest one whose fix will be the right
thing, but make sure the "int x = 0;" case produces the right output too.
For the record, the expected output for either "int x = 0;" or 
"int x __attribute__((nocommon));" is:

		.file   "<stdin>"
		.globl x
		.section        ".sbss","aw",@nobits
		.type   x,@object
		.size   x, 4
		.align 2
	x:
		.zero   4
		.ident  "GCC: (GNU) 3.3 20030315 (prerelease)"

(though the .type and .size lines can be placed anywhere, it doesn't matter).

I don't think we should do anything in libc to work around this while GCC
gets fixed.  GCC 3.2 is fine already, and 3.3 is not released yet.



Thanks,
Roland

  reply	other threads:[~2003-03-21 21:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-21 21:03 Steven Munroe
2003-03-21 22:26 ` Roland McGrath [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-21 22:27 Steve Munroe
2003-03-21 23:48 ` Jakub Jelinek
2003-03-21 14:51 Steven Munroe
2003-03-21 21:01 ` Roland McGrath

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=200303212149.h2LLnpU20106@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=sjmunroe@vnet.ibm.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).