public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Richard Earnshaw <rearnsha@arm.com>
Cc: Richard Sandiford <rdsandiford@googlemail.com>,
	    Jie Zhang <jie@codesourcery.com>,
	Catherine Moore <clm@codesourcery.com>,
	    binutils@sourceware.org
Subject: Re: [PATCH 2.5/4 v2] GAS: Make new fake labels when cloning a symbol
Date: Thu, 02 Dec 2010 23:19:00 -0000	[thread overview]
Message-ID: <alpine.DEB.1.10.1012022256550.14129@tp.orcam.me.uk> (raw)
In-Reply-To: <1291309254.9299.9.camel@e102346-lin.cambridge.arm.com>

Hi Richard,

> > > Sounds good, but please don't let it get in the way of applying this patch
> > > (when the time comes).  The change above seems entirely in keeping with
> > > the way that abs_symbol is initialised.
> > 
> >  This is the version I applied.
> > 
> > 2010-12-01  Maciej W. Rozycki  <macro@codesourcery.com>
> > 
> > 	* symbols.h (dot_symbol): New declaration.
> > 	(dot_symbol_init): New prototype.
> > 	* symbols.c (dot_symbol): New variable.
> > 	(symbol_clone): Assert it's not dot_symbol being cloned.
> > 	(dot_symbol_init): New function.
> > 	(symbol_clone_if_forward_ref): Create a new temporary symbol
> > 	when trying to clone dot_symbol.
> > 	* expr.c (current_location): Refer to dot_symbol instead of
> > 	making a new temporary symbol.
> > 	* read.c (read_a_source_file): Update dot_symbol as we go.
> > 	* as.c (main): Call dot_symbol_init.
> 
> So I'm not entirely sure that this patch is responsible, but it does
> look a likely candidate...
> 
> 	.section	.text._ZnajPv,"axG",%progbits,_ZnajPv,comdat
> 	.fnstart
> 	.fnend
> 
> /arm/scratch/rearnsha/gnu/gcc-results/trunk/gcc/../gas/as-new
> -o /tmp/x.o test.s
> test.s: Assembler messages:
> test.s:3: Error: redefined symbol cannot be used on reloc
> /arm/scratch/rearnsha/gnu/gcc-results/trunk/gcc/../gas/as-new: /tmp/x.o:
> symbol `.' required but not present
> test.s:3: Fatal error: can't close /tmp/x.o: No symbols
> 
> This is on arm-eabi.

 Thanks for reducing the test case.  Below I'm including a change that is 
supposed to fix it.  The original change indeed is what triggered the 
problem, but from the code I have modified I infer it is more related to 
the issue with equated symbols not being handled correctly that I have 
fixed as well.  This function counts as a symbol reference and as such 
should resolve any equated symbols by making a clone.  Chances are code 
could have been crafted that would trigger a problem here even before my 
fixes, but I found no justification to spend time investigating that.

 The change below fixes the problem with your test case as well as one 
attached to PR gas/12282.  I have regression-tested it with the 
arm-none-eabi and mips-sde-elf targets.

2010-12-02  Maciej W. Rozycki  <macro@codesourcery.com>

	PR gas/12282
	* expr.c (make_expr_symbol): Make a clone if handling an
	equated symbol.

 OK to apply?

  Maciej

binutils-gas-dot-fix.diff
Index: binutils-fsf-trunk-quilt/gas/expr.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/expr.c	2010-12-02 22:10:55.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/expr.c	2010-12-02 22:11:31.000000000 +0000
@@ -76,7 +76,7 @@ make_expr_symbol (expressionS *expressio
 
   if (expressionP->X_op == O_symbol
       && expressionP->X_add_number == 0)
-    return expressionP->X_add_symbol;
+    return symbol_clone_if_forward_ref (expressionP->X_add_symbol);
 
   if (expressionP->X_op == O_big)
     {

  reply	other threads:[~2010-12-02 23:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 10:47 [PATCH 2/4] " Maciej W. Rozycki
2010-07-31  8:59 ` Richard Sandiford
2010-08-27 12:11   ` Maciej W. Rozycki
2010-08-30 17:53     ` Richard Sandiford
2010-10-29 14:37 ` [PATCH 2.0/4 v2] GAS: Only clone equated symbols on a final reference Maciej W. Rozycki
2010-10-30  9:56   ` Richard Sandiford
2010-12-01 20:35     ` Maciej W. Rozycki
2010-10-29 14:38 ` [PATCH 2.5/4 v2] GAS: Make new fake labels when cloning a symbol Maciej W. Rozycki
2010-10-30 10:01   ` Richard Sandiford
2010-11-01 12:23     ` Maciej W. Rozycki
2010-11-01 21:32       ` Richard Sandiford
2010-12-01 21:34         ` Maciej W. Rozycki
2010-12-02 10:00           ` Jie Zhang
2010-12-02 17:01           ` Richard Earnshaw
2010-12-02 23:19             ` Maciej W. Rozycki [this message]
2010-12-03 10:58               ` Richard Sandiford
2010-12-03 16:20                 ` Maciej W. Rozycki
2010-12-03 16:47                   ` Richard Sandiford

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=alpine.DEB.1.10.1012022256550.14129@tp.orcam.me.uk \
    --to=macro@codesourcery.com \
    --cc=binutils@sourceware.org \
    --cc=clm@codesourcery.com \
    --cc=jie@codesourcery.com \
    --cc=rdsandiford@googlemail.com \
    --cc=rearnsha@arm.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).