Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [SH] .8byte directive (for DWARF data)
@ 2012-03-20 15:11 Thomas Schwinge
  2012-03-21  3:11 ` Kaz Kojima
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Schwinge @ 2012-03-20 15:11 UTC (permalink / raw)
  To: binutils, Alexandre Oliva, Kaz Kojima; +Cc: gdb-patches, Kevin Buettner

[-- Attachment #1: Type: text/plain, Size: 3027 bytes --]

Hi!

On SH, GDB's gdb.dwarf2/dw2-intermix.exp currently fails as follows:

    Running [GDB]/testsuite/gdb.dwarf2/dw2-intermix.exp ...
    gdb compile failed, [GDB]/testsuite/gdb.dwarf2/dw2-intermix.S: Assembler messages:
    [GDB]/testsuite/gdb.dwarf2/dw2-intermix.S:139: Error: unsupported BFD relocation size 8
    [GDB]/testsuite/gdb.dwarf2/dw2-intermix.S:142: Error: unsupported BFD relocation size 8

gdb.dwarf2/dw2-intermix.S:

    [...]
        18	/* Test a minimal file containing intermixed 32-bit and 64-bit DWARF
        19	   formats.  This is not allowed by the (draft) DWARF-3 standard, but
        20	   GDB should handle it gracefully nevertheless.  */
    [...]
       135	/* Line table */
       136		.section .debug_line
       137	.Lline1_begin:
       138		.4byte		0xffffffff
       139		.8byte		.Lline1_end - .Lline1_start	/* Initial length */
       140	.Lline1_start:
       141		.2byte		2			/* Version */
       142		.8byte		.Lline1_lines - .Lline1_hdr	/* header_length */
       143	.Lline1_hdr:
       144		.byte		1			/* Minimum insn length */
    [...]

Here is a patch for the assembler, OK to commit?

gas/
	[SH] Support the .8byte directive also for non-sh64 configurations.

	* config/tc-sh.c (sh_cons_fix_new, md_apply_fix) [!HAVE_SH64]: Handle
	BFD_RELOC_64.

Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.139
diff -u -p -r1.139 tc-sh.c
--- gas/config/tc-sh.c	28 Jun 2010 14:06:57 -0000	1.139
+++ gas/config/tc-sh.c	15 Mar 2012 12:00:13 -0000
@@ -789,11 +789,9 @@ sh_cons_fix_new (fragS *frag, int off, i
 	r_type = BFD_RELOC_32;
 	break;
 
-#ifdef HAVE_SH64
       case 8:
 	r_type = BFD_RELOC_64;
 	break;
-#endif
 
       default:
 	goto error;
@@ -3968,6 +3966,11 @@ md_apply_fix (fixS *fixP, valueT *valP, 
      the other symbol.  We have to adjust the relocation type here.  */
   if (fixP->fx_pcrel)
     {
+#ifndef HAVE_SH64
+      /* Safeguard; this must not occur for non-sh64 configurations.  */
+      gas_assert (fixP->fx_r_type != BFD_RELOC_64);
+#endif
+
       switch (fixP->fx_r_type)
 	{
 	default:
@@ -4166,6 +4169,12 @@ md_apply_fix (fixS *fixP, valueT *valP, 
       buf[highbyte] |= (val >> 8) & 0xf;
       break;
 
+#ifndef HAVE_SH64
+    case BFD_RELOC_64:
+      apply_full_field_fix (fixP, buf, *valP, 8);
+      break;
+#endif
+
     case BFD_RELOC_32:
     case BFD_RELOC_32_PCREL:
       apply_full_field_fix (fixP, buf, val, 4);

This obviously doesn't change anything for sh64 configurations, and
causes no regressions all of sh-linux-gnu toolchain testing (SH4a), and
the GDB testresults then look as follows:

    Running [GDB]/testsuite/gdb.dwarf2/dw2-intermix.exp ...
    PASS: gdb.dwarf2/dw2-intermix.exp: set listsize 1
    PASS: gdb.dwarf2/dw2-intermix.exp: list func_cu1
    PASS: gdb.dwarf2/dw2-intermix.exp: ptype func_cu1


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [SH] .8byte directive (for DWARF data)
  2012-03-20 15:11 [SH] .8byte directive (for DWARF data) Thomas Schwinge
@ 2012-03-21  3:11 ` Kaz Kojima
  2012-03-21  9:01   ` Thomas Schwinge
  0 siblings, 1 reply; 3+ messages in thread
From: Kaz Kojima @ 2012-03-21  3:11 UTC (permalink / raw)
  To: thomas; +Cc: binutils, aoliva, gdb-patches, kevinb

Thomas Schwinge <thomas@codesourcery.com> wrote:
> On SH, GDB's gdb.dwarf2/dw2-intermix.exp currently fails as follows:
> 
>     Running [GDB]/testsuite/gdb.dwarf2/dw2-intermix.exp ...
>     gdb compile failed, [GDB]/testsuite/gdb.dwarf2/dw2-intermix.S: Assembler messages:
>     [GDB]/testsuite/gdb.dwarf2/dw2-intermix.S:139: Error: unsupported BFD relocation size 8
>     [GDB]/testsuite/gdb.dwarf2/dw2-intermix.S:142: Error: unsupported BFD relocation size 8
> 
> gdb.dwarf2/dw2-intermix.S:
> 
>     [...]
>         18	/* Test a minimal file containing intermixed 32-bit and 64-bit DWARF
>         19	   formats.  This is not allowed by the (draft) DWARF-3 standard, but
>         20	   GDB should handle it gracefully nevertheless.  */
>     [...]
>        135	/* Line table */
>        136		.section .debug_line
>        137	.Lline1_begin:
>        138		.4byte		0xffffffff
>        139		.8byte		.Lline1_end - .Lline1_start	/* Initial length */
>        140	.Lline1_start:
>        141		.2byte		2			/* Version */
>        142		.8byte		.Lline1_lines - .Lline1_hdr	/* header_length */
>        143	.Lline1_hdr:
>        144		.byte		1			/* Minimum insn length */
>     [...]
> 
> Here is a patch for the assembler, OK to commit?

OK.  Thanks for the patch!

Regards,
	kaz


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [SH] .8byte directive (for DWARF data)
  2012-03-21  3:11 ` Kaz Kojima
@ 2012-03-21  9:01   ` Thomas Schwinge
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2012-03-21  9:01 UTC (permalink / raw)
  To: Kaz Kojima; +Cc: binutils, aoliva, gdb-patches, kevinb

[-- Attachment #1: Type: text/plain, Size: 4301 bytes --]

Hi!

Here is the patch I committed -- I figured I might as well update the
documentation, too.

gas/
	[SH] Support the .uaquad and .8byte directives also for non-sh64
	configurations.

	* config/tc-sh.c (sh_cons_fix_new, md_apply_fix) [!HAVE_SH64]: Handle
	BFD_RELOC_64.
	* doc/c-sh64.texi (SH64 Machine Directives): Move .uaquad
	description...
	* doc/c-sh.texi (SH Machine Directives): ... here.

Index: config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.139
diff -u -p -r1.139 tc-sh.c
--- config/tc-sh.c	28 Jun 2010 14:06:57 -0000	1.139
+++ config/tc-sh.c	21 Mar 2012 08:55:44 -0000
@@ -1,6 +1,6 @@
 /* tc-sh.c -- Assemble code for the Renesas / SuperH SH
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -789,11 +789,9 @@ sh_cons_fix_new (fragS *frag, int off, i
 	r_type = BFD_RELOC_32;
 	break;
 
-#ifdef HAVE_SH64
       case 8:
 	r_type = BFD_RELOC_64;
 	break;
-#endif
 
       default:
 	goto error;
@@ -3968,6 +3966,11 @@ md_apply_fix (fixS *fixP, valueT *valP, 
      the other symbol.  We have to adjust the relocation type here.  */
   if (fixP->fx_pcrel)
     {
+#ifndef HAVE_SH64
+      /* Safeguard; this must not occur for non-sh64 configurations.  */
+      gas_assert (fixP->fx_r_type != BFD_RELOC_64);
+#endif
+
       switch (fixP->fx_r_type)
 	{
 	default:
@@ -4166,6 +4169,12 @@ md_apply_fix (fixS *fixP, valueT *valP, 
       buf[highbyte] |= (val >> 8) & 0xf;
       break;
 
+#ifndef HAVE_SH64
+    case BFD_RELOC_64:
+      apply_full_field_fix (fixP, buf, *valP, 8);
+      break;
+#endif
+
     case BFD_RELOC_32:
     case BFD_RELOC_32_PCREL:
       apply_full_field_fix (fixP, buf, val, 4);
Index: doc/c-sh.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-sh.texi,v
retrieving revision 1.14
diff -u -p -r1.14 c-sh.texi
--- doc/c-sh.texi	18 Jan 2011 13:37:39 -0000	1.14
+++ doc/c-sh.texi	21 Mar 2012 08:55:44 -0000
@@ -1,5 +1,5 @@
 @c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2003, 2004,
-@c 2005, 2008, 2010, 2011  Free Software Foundation, Inc.
+@c 2005, 2008, 2010, 2011, 2012  Free Software Foundation, Inc.
 @c This is part of the GAS manual.
 @c For copying conditions, see the file as.texinfo.
 @page
@@ -210,13 +210,16 @@ conventional architectures at the same f
 @cindex machine directives, SH
 @cindex @code{uaword} directive, SH
 @cindex @code{ualong} directive, SH
+@cindex @code{uaquad} directive, SH
 
 @table @code
 @item uaword
 @itemx ualong
-@code{@value{AS}} will issue a warning when a misaligned @code{.word} or
-@code{.long} directive is used.  You may use @code{.uaword} or
-@code{.ualong} to indicate that the value is intentionally misaligned.
+@itemx uaquad
+@code{@value{AS}} will issue a warning when a misaligned @code{.word},
+@code{.long}, or @code{.quad} directive is used.  You may use
+@code{.uaword}, @code{.ualong}, or @code{.uaquad} to indicate that the
+value is intentionally misaligned.
 @end table
 
 @node SH Opcodes
Index: doc/c-sh64.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-sh64.texi,v
retrieving revision 1.11
diff -u -p -r1.11 c-sh64.texi
--- doc/c-sh64.texi	18 Jan 2011 13:37:39 -0000	1.11
+++ doc/c-sh64.texi	21 Mar 2012 08:55:44 -0000
@@ -1,4 +1,4 @@
-@c Copyright (C) 2002, 2003, 2008, 2011 Free Software Foundation, Inc.
+@c Copyright (C) 2002, 2003, 2008, 2011, 2012 Free Software Foundation, Inc.
 @c This is part of the GAS manual.
 @c For copying conditions, see the file as.texinfo.
 @page
@@ -188,10 +188,6 @@ Specify the ABI for the following instru
 this directive unless you specified an ABI on the command line, and the 
 ABIs specified must match.
 
-@item .uaquad
-Like .uaword and .ualong, this allows you to specify an intentionally
-unaligned quadword (64 bit word).
-
 @end table
 
 @node SH64 Opcodes


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-21  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-20 15:11 [SH] .8byte directive (for DWARF data) Thomas Schwinge
2012-03-21  3:11 ` Kaz Kojima
2012-03-21  9:01   ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox