public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcov weirdness: local lable being declared
@ 2005-07-30 17:15 Kean Johnston
  2005-07-30 20:21 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Kean Johnston @ 2005-07-30 17:15 UTC (permalink / raw)
  To: gcc

Hi everyone,

I am getting weird warning messages from my assembler when
gcov is being used. I have tracked what I think is the
problem down but I don't really know how to fix it. The
bit of assembler that causes the warning is:

     .type .LPBX0, @object
     .size .LPBX0, 52
.LPBX0:
     ... whole bunch of initialization stuff

The assembler warns that the .type/.size directive is useless.
This is causing many testsuite failures. The assembler is
right. Why is a local lable being declared as if it was a
global symbol? .LPBX0 comes from ASM_GENERATE_INTERNAL_LABEL.

The problem seems to start in coverage.c:create_coverage().
Fairly close to the top of that is a call to assemble_variable().
assemble_variable(), ends up calling ASM_DECLARE_OBJECT_NAME.
This is what is emitting the .type and .size directives.

Is there some way that the tree can be marked as an internal
construct, and if that is set, not have the bit of code in
assemble_variable() call ASM_DECLARE_OBJECT_NAME? Or perhaps
I can train A_D_O_N to not emit anything if its a local?

I see that the tree in question is declared static. Would it
be the right thing to have something like this at the end of
assemble_variable:

    if (!TREE_STATIC (decl)) {
#ifdef ASM_DECLARE_OBJECT_NAME
      last_assemble_variable_decl = decl;
      ASM_DECLARE_OBJECT_NAME (asm_out_file, name, decl);
#else
      /* Standard thing is just output label for the object.  */
      ASM_OUTPUT_LABEL (asm_out_file, name);
#endif
    }

I am not sure if "if (TREE_STATIC (decl))" is the correct test.
Is there a better test that I can check for an internal lable?

Thanks in advance for any insight.

Kean

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

* Re: gcov weirdness: local lable being declared
  2005-07-30 17:15 gcov weirdness: local lable being declared Kean Johnston
@ 2005-07-30 20:21 ` Ian Lance Taylor
  2005-07-30 20:32   ` Kean Johnston
  2005-07-30 21:07   ` Kean Johnston
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2005-07-30 20:21 UTC (permalink / raw)
  To: jkj; +Cc: gcc

Kean Johnston <jkj@sco.com> writes:

> I am getting weird warning messages from my assembler when
> gcov is being used. I have tracked what I think is the
> problem down but I don't really know how to fix it. The
> bit of assembler that causes the warning is:
> 
>      .type .LPBX0, @object
>      .size .LPBX0, 52
> .LPBX0:
>      ... whole bunch of initialization stuff
> 
> The assembler warns that the .type/.size directive is useless.
> This is causing many testsuite failures. The assembler is
> right. Why is a local lable being declared as if it was a
> global symbol? .LPBX0 comes from ASM_GENERATE_INTERNAL_LABEL.

I don't understand why the .type and .size information is useless.
The information is recorded in the object file.  I've seen various
scripts which use that information to do things like associate address
space with variables.  I think the assembler should just be recording
the information, not warning about it.

If you do need a patch for it, I think it should be SCO specific, and
only #if !USE_GAS.

Ian

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

* Re: gcov weirdness: local lable being declared
  2005-07-30 20:21 ` Ian Lance Taylor
@ 2005-07-30 20:32   ` Kean Johnston
  2005-07-31  0:31     ` Ian Lance Taylor
  2005-07-30 21:07   ` Kean Johnston
  1 sibling, 1 reply; 5+ messages in thread
From: Kean Johnston @ 2005-07-30 20:32 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

> I don't understand why the .type and .size information is useless.
Becuase its for a local lable only, not anything thats intended
to wind up in the symbol table? I'm not sure what meaning a
type and size has for a local lable like that?

Kean

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

* Re: gcov weirdness: local lable being declared
  2005-07-30 20:21 ` Ian Lance Taylor
  2005-07-30 20:32   ` Kean Johnston
@ 2005-07-30 21:07   ` Kean Johnston
  1 sibling, 0 replies; 5+ messages in thread
From: Kean Johnston @ 2005-07-30 21:07 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

> I don't understand why the .type and .size information is useless.
Just some further information ... gas thinks it's useless too.

> The information is recorded in the object file.  I've seen various
No, it's not. At least not with gas 2.15.90.0.3. Just is just
silent about it. The SCO assembler is producing a warning because
if you have .type and .size for a sybol or lable for which
those things have no meaning, it warns you in case you meant
to do something else with the symbol. I believe the warning
message is valid.

In my original post, I asked if checking TREE_STATIC would be
the right thing. While it does shut the warning up, I don't think
it is. What we'd really need is some way to mark a tree as
internal. Then in coverage.c, mark the contructed variable
that way. For example, TREE_INTERNAL (gcov_info) = 1. The
only problem is that in order to do this, we would need to invent
a new bit in tree_common. Although there is an unused bit
available, I am not sure this has wide enough utility to
justify using it. But maybe it does. I leave it up to the
experts to decide.

An second solution would be to have create_coverage()
use a symbol name that isn't an internal lable. For example,
prefixing it with __gcov_. That also solves the problem.

A third alternatie would be to make A_D_O_N smarter,
and check to see if the first character of the name is
a period, and not eject the .size and .type if it is.

Anyone care to advise what the best course of action
would be? I'm leaning towards the second solution.

Kean

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

* Re: gcov weirdness: local lable being declared
  2005-07-30 20:32   ` Kean Johnston
@ 2005-07-31  0:31     ` Ian Lance Taylor
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2005-07-31  0:31 UTC (permalink / raw)
  To: jkj; +Cc: gcc

Kean Johnston <jkj@sco.com> writes:

> > I don't understand why the .type and .size information is useless.
> Becuase its for a local lable only, not anything thats intended
> to wind up in the symbol table? I'm not sure what meaning a
> type and size has for a local lable like that?

Oh, I see what you mean.  Sorry.  What if you use the -L assembler
option, though?

I was misled a bit by TREE_STATIC, which is not the property you are
looking for.

> An second solution would be to have create_coverage()
> use a symbol name that isn't an internal lable. For example,
> prefixing it with __gcov_. That also solves the problem.

That sounds like a reasonable approach to me.  I don't see why it is
useful to hide these symbols entirely in any case.  It seems more
useful to have them visible to the debugger, etc.

Ian

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

end of thread, other threads:[~2005-07-31  0:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-30 17:15 gcov weirdness: local lable being declared Kean Johnston
2005-07-30 20:21 ` Ian Lance Taylor
2005-07-30 20:32   ` Kean Johnston
2005-07-31  0:31     ` Ian Lance Taylor
2005-07-30 21:07   ` Kean Johnston

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