This is the mail archive of the gcc-patches@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]

Re: PATCH for weak Vtable issue


Hi,

 without actually testing it, it seams it would solve
the problem on the mips-side. From my testing on the
failures in the mainline, the sequence

.weakext label
.globl label

 produces a WEAK entry in the object file with no GLOB alias.
Look at "i3" in below example compiled with the current MIPSpro
assembler.

% more bla.s
          .data
          .weakext i
          .weakext i11,i1
          .weakext i22,i2
i:        .word   0
i1:       .word   0
          .globl  i2
i2:       .word   0
          .globl  i3
          .weakext i3
i3:       .word   0
          .ent  bla
  bla:
          .text
          .weakext j
j:        .globl k
k:
          .weakext l,k
          .end
% as -c bla.s
% nm bla.o
Symbols from bla.o:
[Index]   Value      Size    Type  Bind  Other     Shndx   Name
[1]     |         0|       0|SECT |LOCL |DEFAULT  |4      |.text
[2]     |         0|       0|SECT |LOCL |DEFAULT  |5      |.data
[3]     |         8|       4|OBJT |GLOB |DEFAULT  |5      |i2
[4]     |        12|       4|OBJT |WEAK |DEFAULT  |5      |i3
[5]     |         8|       0|OBJT |WEAK |DEFAULT  |5      |i22
[6]     |         0|       0|FUNC |GLOB |DEFAULT  |4      |k
[7]     |         0|       0|FUNC |WEAK |DEFAULT  |4      |l
[8]     |        16|       0|FUNC |LOCL |DEFAULT  |5      |bla



===
------------------------------------------------------
Martin Knoblauch
email: knobi@knobisoft.de or knobi@rocketmail.com
www:   http://www.knobisoft.de







---Jason Merrill <jason@cygnus.com> wrote:
>
> >>>>> Mark Mitchell <mark@markmitchell.com> writes:
> 
>  >   o Of course, we don't want the `.globl' bit for functions
> 
> Why not?  assemble_function_start uses ASM_GLOBALIZE_LABEL.  I think
the
> right fix is probably
> 
> Wed Sep 23 18:44:58 1998  Jason Merrill  <jason@yorick.cygnus.com>
> 
> 	* varasm.c (assemble_start_function, assemble_variable, weak_finish,
> 	assemble_alias): Do ASM_GLOBALIZE_LABEL for weak symbols, too.
> 
> Index: varasm.c
> ===================================================================
> RCS file: /egcs/carton/cvsfiles/egcs/gcc/varasm.c,v
> retrieving revision 1.39
> diff -c -p -r1.39 varasm.c
> *** varasm.c	1998/09/02 09:59:53	1.39
> --- varasm.c	1998/09/24 01:43:24
> *************** assemble_start_function (decl, fnname)
> *** 1022,1028 ****
>   #ifdef ASM_WEAKEN_LABEL
>         if (DECL_WEAK (decl))
>   	ASM_WEAKEN_LABEL (asm_out_file, fnname);
> -       else
>   #endif
>         ASM_GLOBALIZE_LABEL (asm_out_file, fnname);
>       }
> --- 1022,1027 ----
> *************** assemble_variable (decl, top_level, at_e
> *** 1443,1449 ****
>   #ifdef ASM_WEAKEN_LABEL
>         if (DECL_WEAK (decl))
>   	ASM_WEAKEN_LABEL (asm_out_file, name);
> -       else
>   #endif
>         ASM_GLOBALIZE_LABEL (asm_out_file, name);
>       }
> --- 1442,1447 ----
> *************** weak_finish ()
> *** 4302,4307 ****
> --- 4300,4306 ----
>         for (t = weak_decls; t; t = t->next)
>   	{
>   	  ASM_WEAKEN_LABEL (asm_out_file, t->name);
> + 	  ASM_GLOBALIZE_LABEL (asm_out_file, t->name);
>   	  if (t->value)
>   	    ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
>   	}
> *************** assemble_alias (decl, target)
> *** 4326,4334 ****
>   #ifdef ASM_WEAKEN_LABEL
>         if (DECL_WEAK (decl))
>   	ASM_WEAKEN_LABEL (asm_out_file, name);
> -       else
>   #endif
> ! 	ASM_GLOBALIZE_LABEL (asm_out_file, name);
>       }
>   
>     ASM_OUTPUT_DEF (asm_out_file, name, IDENTIFIER_POINTER (target));
> --- 4325,4332 ----
>   #ifdef ASM_WEAKEN_LABEL
>         if (DECL_WEAK (decl))
>   	ASM_WEAKEN_LABEL (asm_out_file, name);
>   #endif
> !       ASM_GLOBALIZE_LABEL (asm_out_file, name);
>       }
>   
>     ASM_OUTPUT_DEF (asm_out_file, name, IDENTIFIER_POINTER (target));
> 

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com



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