Unit-at-a-time in real world (Re: Development plan *ducks*)

Zack Weinberg zack@codesourcery.com
Tue Jul 29 18:12:00 GMT 2003


Jan Hubicka <jh@suse.cz> writes:

>
> a) program referencing variables
>    from asm staements and not using __attribute__ ((used)).
>    Such problems we hit in glibc, prelink, wine and kernel.
>    One of anoying side effect is that the proper combination of flags for
>    such variable is __attribute__ ((used)) to instruct compiler to always
>    emit the variable *together* with __attribute__ ((unused)) that instruct
>    compiler to not emit warning.  This looks funny, so I would guess that
>    attribute used sould imply __attribute__ ((unused)) and set TREE_USED
>    flag too.  (do you follow the funny logic in the names)?

I think you're right, __attribute__ ((used)) should silence the
warning.  Send in a patch.

>    Another ugly thing is that 3.2 does not support attribute used on
>    variables so you need ifdef machinery.

Can the problem be avoided in another way, e.g. by putting the
variable into the operands list of the asm statement?

> b) using toplevel asm statements to change sections of functions (this
>    is present in gcc runtime and glibc).  The proper fix is to use gcc
>    section attributes or -fno-unit-at-a-time as work around.

The C++ front end, down the road, would be happier if -funit-at-a-time
were the *only* option.  So could you please do what it takes to make
sure there is another way to handle all such cases?  (Pathological
examples can be pushed off with 'rewrite in assembly'.)

zw



More information about the Gcc mailing list