[PATCH] SH/readelf: Correct EF_SH_PIC and EF_SH_FDPIC handling

Maciej W. Rozycki macro@codesourcery.com
Mon Nov 12 23:53:00 GMT 2012


Hi,

 While working on some MIPS features I have noticed a piece of SH code has 
been applied to the MIPS section in the function that dumps ELF file 
header flags in `readelf'.  The following obvious change corrects that.  

 This functionality is regrettably not covered in regression testing 
anywhere, the update below does not cause any test result changes 
whatsoever.  I suggest adding suitable test cases at your earliest 
convenience.

 Meanwhile OK to apply?

2012-11-12  Maciej W. Rozycki  <macro@codesourcery.com>

	binutils/
	* readelf.c (get_machine_flags) <EM_MIPS, EM_MIPS_RS3_LE>: Move
	code to handle EF_SH_PIC and EF_SH_FDPIC...
	<EM_SH>: ... here.

  Maciej

binutils-sh-readelf-e-flags.diff
Index: binutils-fsf-trunk-quilt/binutils/readelf.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/binutils/readelf.c	2012-11-06 15:37:09.000000000 +0000
+++ binutils-fsf-trunk-quilt/binutils/readelf.c	2012-11-10 00:50:24.570968400 +0000
@@ -2529,12 +2529,6 @@ get_machine_flags (unsigned e_flags, uns
 	    case E_MIPS_ARCH_64R2: strcat (buf, ", mips64r2"); break;
 	    default: strcat (buf, _(", unknown ISA")); break;
 	    }
-
-	  if (e_flags & EF_SH_PIC)
-	    strcat (buf, ", pic");
-
-	  if (e_flags & EF_SH_FDPIC)
-	    strcat (buf, ", fdpic");
 	  break;
 
 	case EM_SH:
@@ -2564,6 +2558,11 @@ get_machine_flags (unsigned e_flags, uns
 	    default: strcat (buf, _(", unknown ISA")); break;
 	    }
 
+	  if (e_flags & EF_SH_PIC)
+	    strcat (buf, ", pic");
+
+	  if (e_flags & EF_SH_FDPIC)
+	    strcat (buf, ", fdpic");
 	  break;
 
 	case EM_SPARCV9:



More information about the Binutils mailing list