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]

[PATCH] MIPS/GAS: Make .aent set function symbol type


Hello,

 This is a fix to a problem that I noticed a while ago with the .aent 
MIPS/GAS directive.  The .aent directive is used to mark 
additional/alternative entry points to a function within its body.

 The directive keeps the function flag clear on the symbol referred, 
effectively marking code that follows as data.  This is inconsistent with 
.ent, that sets the flag, and breaks `objdump' and potentially other tools 
(execution is unaffected).  The change below makes the flag be set by both 
directives.  Without the change the testcase included disassembles as 
below:

$ objdump -t dump.o

dump.o:     file format elf32-tradbigmips

SYMBOL TABLE:
00000000 l    d  .text	00000000 .text
00000000 l    d  .data	00000000 .data
00000000 l    d  .bss	00000000 .bss
00000000 l    d  .reginfo	00000000 .reginfo
00000000 l    d  .pdr	00000000 .pdr
00000000 g     F .text	00000010 foo
00000008 g     O .text	00000000 bar


$ objdump -dr --prefix-addresses dump.o

dump.o:     file format elf32-tradbigmips


Disassembly of section .text:
00000000 <foo> sllv	v0,a0,a2
00000004 <foo+0x4> srav	t0,t2,t4
00000008 <bar> ......@.........

2009-12-14  Maciej W. Rozycki  <macro@codesourcery.com>

	gas/
	* config/tc-mips.c (s_mips_ent): Also set BSF_FUNCTION for .aent.

	gas/testsuite/
	* gas/mips/aent.d: New test.
	* gas/mips/aent.s: Source for the new test.
	* gas/mips/mips.exp: Run it.

 OK to apply?

  Maciej

binutils-2.20.51-20091212-mips-aent-2.patch
Index: gas/testsuite/gas/mips/aent.d
===================================================================
--- gas/testsuite/gas/mips/aent.d	(revision 0)
+++ gas/testsuite/gas/mips/aent.d	(revision 0)
@@ -0,0 +1,14 @@
+#objdump: -dr --prefix-addresses
+#name: MIPS .aent directive
+#as: -32
+
+# Test the .aent directive retains function symbol type annotation.
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <foo[^>]*> sllv	v0,a0,a2
+[0-9a-f]+ <foo[^>]*> srav	t0,t2,t4
+[0-9a-f]+ <bar[^>]*> sllv	v0,a0,a2
+[0-9a-f]+ <bar[^>]*> srav	t0,t2,t4
+	\.\.\.
Index: gas/testsuite/gas/mips/aent.s
===================================================================
--- gas/testsuite/gas/mips/aent.s	(revision 0)
+++ gas/testsuite/gas/mips/aent.s	(revision 0)
@@ -0,0 +1,19 @@
+	.text
+
+	.globl	foo
+	.ent	foo
+foo:
+	sllv	$2, $4, $6
+	srav	$8, $10, $12
+
+	.globl	bar
+	.aent	bar
+bar:
+	sllv	$2, $4, $6
+	srav	$8, $10, $12
+
+	.end	foo
+	.size	foo, . - foo
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.space  8
Index: gas/testsuite/gas/mips/mips.exp
===================================================================
--- gas/testsuite/gas/mips/mips.exp	(revision 270856)
+++ gas/testsuite/gas/mips/mips.exp	(working copy)
@@ -841,4 +841,6 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "mips32-sync"
 
     if $has_newabi { run_dump_test "cfi-n64-1" }
+
+    run_dump_test_arches "aent"		[mips_arch_list_matching mips1]
 }
Index: gas/config/tc-mips.c
===================================================================
--- gas/config/tc-mips.c	(revision 270856)
+++ gas/config/tc-mips.c	(working copy)
@@ -15051,8 +15051,6 @@ s_mips_ent (int aent)
 
       cur_proc_ptr->func_sym = symbolP;
 
-      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
-
       ++numprocs;
 
       if (debug_type == DEBUG_STABS)
@@ -15060,6 +15058,8 @@ s_mips_ent (int aent)
 				 S_GET_NAME (symbolP));
     }
 
+  symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;
+
   demand_empty_rest_of_line ();
 }
 


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