This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed: fix cris-aout testsuite, disable --pic. RFC: remove emulations?


I set out to change the CRIS port(s) to single-object-format,
which of course implies a clean baseline for all object
variants, represented by the abbreviated targets cris-aout,
cris-elf and cris-linux.  My autotester asserts clean results
for cris-elf and cris-linux, but I don't usually care for
cris-aout, so it seems cris-aout has either regressed or I never
ran the gas testsuite for it, when adding the gas PIC support or
adding the PIC test-cases.  Anyway, the three adjusted
test-cases below failed for cris-aout before this commit and
PASS as applicable after; as.info inspected too.

Rather than trying to handle --pic with all the special-casing
of symbols that comes with PIC *and* a.out, I just turned it off
for a.out; nothing downstream (read: the linker) is supposed to
generate a.out shared libraries or does anything else for a.out
PIC.  That is, assuming in the first place there's people out
there actually assembling for CRIS a.out.  Also, the adjusted
test-case assume pre-crisv32 code, so better gate just on cris-*
(not cris*-*).

On a related note, are there any known serious users of the gas
"emulations" support (gas support generating multiple object
formats, with one selected on the command-line)?  It seems the
CRIS port is the only default user, with other usage requiring
--enable-targets=all and only supporting i386-* and x86_64-*
targets.  Is it desirable to remove this support?  ISTR a shared
sentiment among those lines...  It easily breaks like in
<http://sourceware.org/ml/binutils/2010-10/msg00391.html>.

gas:
	* config/tc-cris.c (md_parse_option) <OPTION_PIC>: Error if not
	emitting ELF object.
	(md_show_usage): Only mention --pic if the assembler can generate
	ELF objects.
	* doc/c-cris.texi (CRIS-Opt): Mention that generating ELF is a
	prerequisite for --pic being a valid option.

gas/testsuite:
	* gas/cris/rd-brokw-pic-1.d, gas/cris/rd-brokw-pic-2.d,
	gas/cris/rd-fragtest-pic.d: Gate on targets cris-*-*elf* and
	cris-*-linux-gnu.
	* gas/cris/pic-err-2.s, gas/cris/pic-err-3.s: New tests.

Index: config/tc-cris.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cris.c,v
retrieving revision 1.50
diff -p -u -r1.50 tc-cris.c
--- config/tc-cris.c	28 Jun 2010 14:06:57 -0000	1.50
+++ config/tc-cris.c	16 May 2011 03:22:32 -0000
@@ -3811,6 +3811,8 @@ md_parse_option (int arg, char *argp ATT
       break;
 
     case OPTION_PIC:
+      if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+	as_bad (_("--pic is invalid for this object format"));
       pic = TRUE;
       if (cris_arch != arch_crisv32)
 	md_long_jump_size = cris_any_v0_v10_long_jump_size_pic;
@@ -4008,8 +4010,10 @@ md_show_usage (FILE *stream)
 	   _("  --no-underscore         User symbols do not have any prefix.\n"));
   fprintf (stream, "%s",
 	   _("                          Registers will require a `$'-prefix.\n"));
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
   fprintf (stream, "%s",
 	   _("  --pic			Enable generation of position-independent code.\n"));
+#endif
   fprintf (stream, "%s",
 	   _("  --march=<arch>		Generate code for <arch>.  Valid choices for <arch>\n\
 				are v0_v10, v10, v32 and common_v10_v32.\n"));
Index: doc/c-cris.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-cris.texi,v
retrieving revision 1.4
diff -p -u -r1.4 c-cris.texi
--- doc/c-cris.texi	3 Mar 2005 01:29:53 -0000	1.4
+++ doc/c-cris.texi	16 May 2011 03:22:32 -0000
@@ -67,7 +67,8 @@ order to recognize the symbol syntax use
 position-independent-code (@pxref{crispic}).  This will also
 affect expansion of instructions.  The expansion with
 @option{--pic} will use PC-relative rather than (slightly
-faster) absolute addresses in those expansions.
+faster) absolute addresses in those expansions.  This option is only
+valid when generating ELF format object files.
 
 @cindex @option{--march=@var{architecture}} command line option, CRIS
 @cindex CRIS @option{--march=@var{architecture}} command line option
Index: testsuite/gas/cris/pic-err-2.s
===================================================================
RCS file: testsuite/gas/cris/pic-err-2.s
diff -N testsuite/gas/cris/pic-err-2.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/cris/pic-err-2.s	16 May 2011 03:22:33 -0000
@@ -0,0 +1,6 @@
+; Check that --pic isn't recognized for a.out files, specified by emulation.
+
+; { dg-do assemble { target cris-*-* } }
+; { dg-options "--pic --em=crisaout" }
+; { dg-error ".* --pic is invalid" "" { target cris-*-* } 0 }
+ nop
Index: testsuite/gas/cris/pic-err-3.s
===================================================================
RCS file: testsuite/gas/cris/pic-err-3.s
diff -N testsuite/gas/cris/pic-err-3.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/cris/pic-err-3.s	16 May 2011 03:22:33 -0000
@@ -0,0 +1,6 @@
+; Check that --pic isn't recognized for a.out files, with a.out the default.
+
+; { dg-do assemble { target cris-*-*aout* } }
+; { dg-options "--pic" }
+; { dg-error ".* --pic is invalid" "" { target cris-*-* } 0 }
+ nop
Index: testsuite/gas/cris/rd-brokw-pic-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cris/rd-brokw-pic-1.d,v
retrieving revision 1.1
diff -p -u -r1.1 rd-brokw-pic-1.d
--- testsuite/gas/cris/rd-brokw-pic-1.d	7 Dec 2005 06:43:17 -0000	1.1
+++ testsuite/gas/cris/rd-brokw-pic-1.d	16 May 2011 03:22:33 -0000
@@ -1,5 +1,6 @@
 #objdump: -dr
 #as: --pic
+#target: cris-*-*elf* cris-*-linux-gnu
 #source: brokw-1.s
 
 .*:     file format .*-cris
Index: testsuite/gas/cris/rd-brokw-pic-2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cris/rd-brokw-pic-2.d,v
retrieving revision 1.1
diff -p -u -r1.1 rd-brokw-pic-2.d
--- testsuite/gas/cris/rd-brokw-pic-2.d	7 Dec 2005 06:43:17 -0000	1.1
+++ testsuite/gas/cris/rd-brokw-pic-2.d	16 May 2011 03:22:33 -0000
@@ -1,5 +1,6 @@
 #objdump: -dr
 #as: --pic
+#target: cris-*-*elf* cris-*-linux-gnu
 #source: brokw-2.s
 
 .*:     file format .*-cris
Index: testsuite/gas/cris/rd-fragtest-pic.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cris/rd-fragtest-pic.d,v
retrieving revision 1.1
diff -p -u -r1.1 rd-fragtest-pic.d
--- testsuite/gas/cris/rd-fragtest-pic.d	7 Dec 2005 06:43:17 -0000	1.1
+++ testsuite/gas/cris/rd-fragtest-pic.d	16 May 2011 03:22:33 -0000
@@ -1,5 +1,6 @@
 #objdump: -dr
 #as: --pic
+#target: cris-*-*elf* cris-*-linux-gnu
 #source: fragtest.s
 
 .*:     file format .*-cris


brgds, H-P


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