[Bug gas/6878] '% found after symbol for non-H-TICK-HEX tokens

2008-09-18 Thread nickc at redhat dot com

--- Additional Comments From nickc at redhat dot com  2008-09-18 07:52 
---
Created an attachment (id=2956)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2956&action=view)
Only enable tick warning message when tick syntax is supported.  Do not use a
line number of 0 in warning messages


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6878

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/6878] '% found after symbol for non-H-TICK-HEX tokens

2008-09-18 Thread nickc at redhat dot com

--- Additional Comments From nickc at redhat dot com  2008-09-18 07:54 
---
Hi Bernhard,

  Please could you try out the uploaded patch.  I think that it will resolve the
issue for you.  It makes two changes - the warning message about the tick syntax
is now only issued if the target supports the syntax, and line numbers of 0 are
now ignored when displaying warning messages.  (There is no easy way to get an
accurate line number at the point where this warning message is generated, so I
elected to just suppress line numbers of 0).

Cheers
  Nick


-- 
   What|Removed |Added

 Status|NEW |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=6878

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: assertion failure with gas and broken syntax

2008-09-18 Thread Nick Clifton

Hi Per, Hi H.J.,

H.J. - this email is in response to a x86 assembler bug report from Per 
that was posted here:


  http://lists.gnu.org/archive/html/bug-binutils/2008-09/msg6.html

I have a patch to fix the problem (attached) but I am not sure if you 
will like it.  Possibly the error should be caught earlier, before the 
attempt to apply the fixup ?


The patch includes a new test to cover the example in the original email 
and a tweak to an existing test that is altered by the patch.  If you 
are OK with it please let me know and I will apply the patch to the sources.


Cheers
  Nick

gas/ChangeLog
2008-09-18  Nick Clifton  <[EMAIL PROTECTED]>

* config/tc-i386.c (md_apply_fix): Refuse fixups against register
symbols.

gas/testsuite/ChangeLog
2008-09-18  Nick Clifton  <[EMAIL PROTECTED]>

* gas/i386/inval-symbol.s: New test.
* gas/i386/inval-symbol.l: Expected listing.
* gas/i386/i386.exp: Run new test.
* gas/i386/inval-equ-2.l: Update expecting listing output.

Index: gas/config/tc-i386.c
===
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.352
diff -c -3 -p -r1.352 tc-i386.c
*** gas/config/tc-i386.c3 Sep 2008 15:44:33 -   1.352
--- gas/config/tc-i386.c18 Sep 2008 11:35:53 -
*** md_apply_fix (fixP, valP, seg)
*** 7644,7649 
--- 7644,7658 
char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
valueT value = *valP;
  
+   if (fixP->fx_addsy != NULL
+   && S_GET_SEGMENT (fixP->fx_addsy) == reg_section)
+ {
+   as_bad_where (fixP->fx_file, fixP->fx_line,
+   _("cannot use a register name as symbolic value"));
+   fixP->fx_done = 1;
+   return;
+ }
+   
  #if !defined (TE_Mach)
if (fixP->fx_pcrel)
  {
Index: gas/testsuite/gas/i386/i386.exp
===
RCS file: /cvs/src/src/gas/testsuite/gas/i386/i386.exp,v
retrieving revision 1.105
diff -c -3 -p -r1.105 i386.exp
*** gas/testsuite/gas/i386/i386.exp 28 Aug 2008 09:42:11 -  1.105
--- gas/testsuite/gas/i386/i386.exp 18 Sep 2008 11:35:53 -
*** if [expr ([istarget "i*86-*-*"] ||  [ist
*** 28,33 
--- 28,34 
  run_list_test "inval" "-al"
  run_list_test "segment" "-al"
  run_list_test "inval-seg" "-al"
+ run_list_test "inval-symbol" "-al"
  run_list_test "modrm" "-al --listing-lhs-width=2"
  run_dump_test "naked"
  run_dump_test "opcode"
Index: gas/testsuite/gas/i386/inval-equ-2.l
===
RCS file: /cvs/src/src/gas/testsuite/gas/i386/inval-equ-2.l,v
retrieving revision 1.1
diff -c -3 -p -r1.1 inval-equ-2.l
*** gas/testsuite/gas/i386/inval-equ-2.l3 Mar 2008 15:28:58 -   
1.1
--- gas/testsuite/gas/i386/inval-equ-2.l18 Sep 2008 11:35:53 -
***
*** 1,4 
--- 1,7 
  .*: Assembler messages:
+ .*:3: Error: .*
+ .*:5: Error: .*
+ .*:8: Error: .*
  .*:8: Error: .*
  .*:8: Error: .*
  .*:8: Error: .*
*** GAS LISTING .*
*** 7,19 
  
  [ ]*1[]+\.globl  bar1
  [ ]*2[]+\.setbar1,\(%eax\+1\)
! [ ]*3[]+\?\?\?\? A12A mov bar1,%eax
  [ ]*3[]+00
  [ ]*4[]+\.setbar2,\(%eax\+1\)
! [ ]*5[]+\?\?\?\? A12A mov bar2,%eax
  [ ]*5[]+00
  [ ]*6[]+\.globl  bar2
  [ ]*7[]+\.setbar3,\(%eax\+1\)
! [ ]*8[]+\?\?\?\? A12A mov bar3,%eax
  \*\*\*\*  Error:can't make global register symbol `bar3'
  [ ]*8[]+00
--- 10,22 
  
  [ ]*1[]+\.globl  bar1
  [ ]*2[]+\.setbar1,\(%eax\+1\)
! [ ]*3[]+\?\?\?\? A1.. mov bar1,%eax
  [ ]*3[]+00
  [ ]*4[]+\.setbar2,\(%eax\+1\)
! [ ]*5[]+\?\?\?\? A1.. mov bar2,%eax
  [ ]*5[]+00
  [ ]*6[]+\.globl  bar2
  [ ]*7[]+\.setbar3,\(%eax\+1\)
! [ ]*8[]+\?\?\?\? A1.. mov bar3,%eax
  \*\*\*\*  Error:can't make global register symbol `bar3'
  [ ]*8[]+00
*** /dev/null   2008-09-18 08:05:37.567254421 +0100
--- gas/testsuite/gas/i386/inval-symbol.s   2008-09-18 11:33:38.0 
+0100
***
*** 0 
--- 1,2 
+   .text
+   cmp (%ax)-1, %ax
*** /dev/null   2008-09-18 08:05:37.567254421 +0100
--- gas/testsuite/gas/i386/inval-symbol.l   2008-09-18 11:39:06.0 
+0100
***
*** 0 
--- 1,9 
+ .*: Assembler messages:
+ .*:2: Error: .*
+ GAS LISTING .*
+ 
+ 
+1 []*  .text
+2 .*   cmp \(%ax\)-1, %ax
+ .*Error:cannot use a register name as symbolic value
+2 .*0+0
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/6878] '% found after symbol for non-H-TICK-HEX tokens

2008-09-18 Thread rep dot dot dot nop at gmail dot com

--- Additional Comments From rep dot dot dot nop at gmail dot com  
2008-09-18 16:13 ---
The patch disables the warning for me, yes.
Shouldn't the warning only be issued if (the arch supports it and the param was
given and) "H'" was seen as opposed to any occurance of "'"?

thanks,

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6878

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: assertion failure with gas and broken syntax

2008-09-18 Thread H.J. Lu
On Thu, Sep 18, 2008 at 4:44 AM, Nick Clifton <[EMAIL PROTECTED]> wrote:
> Hi Per, Hi H.J.,
>
> H.J. - this email is in response to a x86 assembler bug report from Per that
> was posted here:
>
>  http://lists.gnu.org/archive/html/bug-binutils/2008-09/msg6.html
>
> I have a patch to fix the problem (attached) but I am not sure if you will
> like it.  Possibly the error should be caught earlier, before the attempt to
> apply the fixup ?
>
> The patch includes a new test to cover the example in the original email and
> a tweak to an existing test that is altered by the patch.  If you are OK
> with it please let me know and I will apply the patch to the sources.
> Cheers
>  Nick
>
> gas/ChangeLog
> 2008-09-18  Nick Clifton  <[EMAIL PROTECTED]>
>
>* config/tc-i386.c (md_apply_fix): Refuse fixups against register
>symbols.
>
> gas/testsuite/ChangeLog
> 2008-09-18  Nick Clifton  <[EMAIL PROTECTED]>
>
>* gas/i386/inval-symbol.s: New test.
>* gas/i386/inval-symbol.l: Expected listing.
>* gas/i386/i386.exp: Run new test.
>* gas/i386/inval-equ-2.l: Update expecting listing output.
>
>

Hi Nick,

I think it is another form of

http://sourceware.org/bugzilla/show_bug.cgi?id=5543

We fixed it in generic assembler. If we want to fix this
one in x86 backend, should we revert the fix for PR 5543?



-- 
H.J.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/6878] '% found after symbol for non-H-TICK-HEX tokens

2008-09-18 Thread dj at redhat dot com

--- Additional Comments From dj at redhat dot com  2008-09-18 16:45 ---
Subject: Re:  '% found after symbol for non-H-TICK-HEX tokens


The warning is for people who use the ' character without realizing
exactly how it will work.  It does not do what most people expect,
unless they've carefully read the documentation.  For example, the
string hello'there gets converted to hello116here, which is rarely
useful, and thus should generate a warning.

It's more useful like this:

.byte   'h, 0x07, '$, 0x0a

Where there would be no warning anyway.

Ports that support h' hex use it like this:

.byte   H'07, H'FE, H'0A


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6878

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: assertion failure with gas and broken syntax

2008-09-18 Thread Alan Modra
On Thu, Sep 18, 2008 at 07:19:15AM -0700, H.J. Lu wrote:
> I think it is another form of
> 
> http://sourceware.org/bugzilla/show_bug.cgi?id=5543
> 
> We fixed it in generic assembler. If we want to fix this
> one in x86 backend, should we revert the fix for PR 5543?

It's really a result of md_register_arithmetic being defined to 0 for
x86 and ia64.  Without that you'd get an error from fix_new_exp,
"register value used as expression".

Index: gas/write.c
===
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.118
diff -u -p -r1.118 write.c
--- gas/write.c 20 Aug 2008 13:43:32 -  1.118
+++ gas/write.c 15 Sep 2008 13:24:12 -
@@ -54,8 +54,13 @@
   (! SEG_NORMAL (SEG))
 #endif
 
+#ifndef md_register_arithmetic
+# define md_register_arithmetic 1
+#endif
+
 #ifndef TC_FORCE_RELOCATION_SUB_ABS
-#define TC_FORCE_RELOCATION_SUB_ABS(FIX)   0
+#define TC_FORCE_RELOCATION_SUB_ABS(FIX, SEG)  \
+  (!md_register_arithmetic && (SEG) == reg_section)
 #endif
 
 #ifndef TC_FORCE_RELOCATION_SUB_LOCAL
@@ -924,7 +929,7 @@ fixup_segment (fixS *fixP, segT this_seg
 #endif
}
  else if (sub_symbol_segment == absolute_section
-  && !TC_FORCE_RELOCATION_SUB_ABS (fixP))
+  && !TC_FORCE_RELOCATION_SUB_ABS (fixP, add_symbol_segment))
{
  add_number -= S_GET_VALUE (fixP->fx_subsy);
  fixP->fx_offset = add_number;
Index: gas/config/tc-sh.h
===
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.50
diff -u -p -r1.50 tc-sh.h
--- gas/config/tc-sh.h  6 Aug 2008 15:42:15 -   1.50
+++ gas/config/tc-sh.h  15 Sep 2008 13:24:13 -
@@ -211,8 +211,9 @@ extern bfd_boolean sh_fix_adjustable (st
 
 /* This keeps the subtracted symbol around, for use by PLT_PCREL
relocs.  */
-#define TC_FORCE_RELOCATION_SUB_ABS(FIX)   \
-  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL)
+#define TC_FORCE_RELOCATION_SUB_ABS(FIX, SEG)  \
+  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL  \
+   || (!md_register_arithmetic && (SEG) == reg_section))
 
 /* Don't complain when we leave fx_subsy around.  */
 #undef TC_VALIDATE_FIX_SUB


-- 
Alan Modra
Australia Development Lab, IBM


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils