This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

981001-2.c failing on sparc-sun-solaris - invalid assembly output



compile/981001-2.c is failing on sparc-sun-solaris2.x because we emit
assembly output which is accepted by GAS but not by the pickier
Solaris assembler.  Whittled down to the bare essentials:

int x = 0;
extern int y __attribute__ ((weak, alias("x")));

translates to assembly like so:

	.global x
x:
        .uaword 0
        .weak   y
        y = x
        .weak   y

We emit the .weak op twice.  Solaris as doesn't like that.  (On the
other hand,

int i __attribute__ ((weak)) = 0;

also gets a duplicate weak op, but this time Solaris as has no problem
with it.  Go figure.)

What's going on?  declare_weak calls add_weak which pushes y onto a
list of symbols to be marked weak later.  assemble_alias emits a weak
declaration itself. compile_file regains control from yyparse, and
calls weak_finish, which emits another weak declaration

assemble_alias must continue to emit .weak decls for aliases, because
Solaris as doesn't like this either:

	.global x
x:
        .uaword 0
        y = x
        .weak   y

If we take the push out of declare_weak, then 

int i __attribute__ ((weak));

will fail to be marked weak, and other stuff may break too - the push
is conditioned on HANDLE_PRAGMA_WEAK, which I don't know about.

Suggestions?

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]