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]

[PATCHv3 4/7] arc: Remove EF_ARC_CPU_GENERIC constant.


The constant EF_ARC_CPU_GENERIC is defined in the include/elf/arc.h
file, and is used in a few places in binutils, however, this constant
should never make it into the elf header flags; we always set a valid
cpu type in the assembler, which should then be copied over during
linking.

In order to simplify the code this commit remove EF_ARC_CPU_GENERIC.

bfd/ChangeLog:

	* elf32-arc.c (arc_elf_print_private_bfd_data): Remove use of
	EF_ARC_CPU_GENERIC.
	(arc_elf_final_write_processing): Don't bother setting cpu field
	in e_flags, this will have been set elsewhere.

binutils/ChangeLog:

	* readelf.c (get_machine_flags): Remove use of EF_ARC_CPU_GENERIC.

gas/ChangeLog:

	* config/tc-arc.c (arc_select_cpu): Remove use of
	EF_ARC_CPU_GENERIC.

include/ChangeLog:

	* elf/arc.h (EF_ARC_CPU_GENERIC): Delete.  Update related comment.
---
 bfd/ChangeLog       |  7 +++++++
 bfd/elf32-arc.c     | 10 ----------
 binutils/ChangeLog  |  4 ++++
 binutils/readelf.c  |  3 ---
 gas/ChangeLog       |  5 +++++
 gas/config/tc-arc.c |  7 +++----
 include/ChangeLog   |  4 ++++
 include/elf/arc.h   |  6 ++----
 8 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d2532f0..20c1904 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
 2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* elf32-arc.c (arc_elf_print_private_bfd_data): Remove use of
+	EF_ARC_CPU_GENERIC.
+	(arc_elf_final_write_processing): Don't bother setting cpu field
+	in e_flags, this will have been set elsewhere.
+
+2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* elf32-arc.c (arc_elf_final_write_processing): Switch to using
 	EF_ARC_MACH_MSK.
 
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 7c856d0..ec81852 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -415,7 +415,6 @@ arc_elf_print_private_bfd_data (bfd *abfd, void * ptr)
 
   switch (flags & EF_ARC_MACH_MSK)
     {
-    case EF_ARC_CPU_GENERIC : fprintf (file, " -mcpu=generic"); break;
     case EF_ARC_CPU_ARCV2HS : fprintf (file, " -mcpu=ARCv2HS");    break;
     case EF_ARC_CPU_ARCV2EM : fprintf (file, " -mcpu=ARCv2EM");    break;
     case E_ARC_MACH_ARC600  : fprintf (file, " -mcpu=ARC600");     break;
@@ -647,34 +646,25 @@ static void
 arc_elf_final_write_processing (bfd * abfd,
 				bfd_boolean linker ATTRIBUTE_UNUSED)
 {
-  unsigned long val;
   unsigned long emf;
 
   switch (bfd_get_mach (abfd))
     {
     case bfd_mach_arc_arc600:
-      val = E_ARC_MACH_ARC600;
       emf = EM_ARC_COMPACT;
       break;
     case bfd_mach_arc_arc601:
-      val = E_ARC_MACH_ARC601;
       emf = EM_ARC_COMPACT;
       break;
     case bfd_mach_arc_arc700:
-      val = E_ARC_MACH_ARC700;
       emf = EM_ARC_COMPACT;
       break;
     case bfd_mach_arc_arcv2:
-      val = EF_ARC_CPU_GENERIC;
       emf = EM_ARC_COMPACT2;
-      /* TODO: Check validity of this.  It can also be ARCV2EM here.
-	 Previous version sets the e_machine here.  */
       break;
     default:
       abort ();
     }
-  if ((elf_elfheader (abfd)->e_flags & EF_ARC_MACH_MSK) == EF_ARC_CPU_GENERIC)
-    elf_elfheader (abfd)->e_flags |= val;
 
   elf_elfheader (abfd)->e_machine = emf;
 
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9328815..1ac9384 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,9 @@
 2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* readelf.c (get_machine_flags): Remove use of EF_ARC_CPU_GENERIC.
+
+2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* testsuite/binutils-all/objdump.exp (cpus_expected): Add ARC700
 	to the architecture list.
 
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 7deac04..b764234 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -2776,9 +2776,6 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
 	    case EF_ARC_CPU_ARCV2HS:
 	      strcat (buf, ", ARC HS");
 	      break;
-	    case EF_ARC_CPU_GENERIC:
-	      strcat (buf, ", ARC generic");
-	      break;
 	    case E_ARC_MACH_ARC600:
 	      strcat (buf, ", ARC600");
 	      break;
diff --git a/gas/ChangeLog b/gas/ChangeLog
index fc026ea..16d7f34 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
 2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* config/tc-arc.c (arc_select_cpu): Remove use of
+	EF_ARC_CPU_GENERIC.
+
+2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* config/tc-arc.c (arc_target): Delay initialisation until
 	arc_select_cpu.
 	(arc_target_name): Likewise.
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 5633905..65eb0e9 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -573,7 +573,7 @@ md_number_to_chars_midend (char *buf, valueT val, int n)
 static void
 arc_select_cpu (const char *arg)
 {
-  int cpu_flags = EF_ARC_CPU_GENERIC;
+  int cpu_flags = 0;
   int i;
 
   for (i = 0; cpu_types[i].name; ++i)
@@ -591,9 +591,8 @@ arc_select_cpu (const char *arg)
 
   if (!cpu_types[i].name)
     as_fatal (_("unknown architecture: %s\n"), arg);
-
-  if (cpu_flags != EF_ARC_CPU_GENERIC)
-    arc_eflag = (arc_eflag & ~EF_ARC_MACH_MSK) | cpu_flags;
+  gas_assert (cpu_flags != 0);
+  arc_eflag = (arc_eflag & ~EF_ARC_MACH_MSK) | cpu_flags;
 }
 
 /* Here ends all the ARCompact extension instruction assembling
diff --git a/include/ChangeLog b/include/ChangeLog
index b083a8d..102d1c0 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,9 @@
 2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* elf/arc.h (EF_ARC_CPU_GENERIC): Delete.  Update related comment.
+
+2016-03-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* elf/arc.h (EF_ARC_MACH): Delete.
 	(EF_ARC_MACH_MSK): Remove out of date comment.
 
diff --git a/include/elf/arc.h b/include/elf/arc.h
index 0b75465..47381f3 100644
--- a/include/elf/arc.h
+++ b/include/elf/arc.h
@@ -43,13 +43,11 @@ END_RELOC_NUMBERS (R_ARC_max)
 #define EF_ARC_OSABI_MSK 0x00000f00
 #define EF_ARC_ALL_MSK	 (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
 
-/* Various CPU types.  */
+/* Various CPU types.  These numbers are exposed in the ELF header flags
+   (e_flags field), and so must never change.  */
 #define E_ARC_MACH_ARC600	0x00000002
 #define E_ARC_MACH_ARC601	0x00000004
 #define E_ARC_MACH_ARC700	0x00000003
-
-/* Processor specific flags for the ELF header e_flags field.  */
-#define EF_ARC_CPU_GENERIC      0x00000000
 #define EF_ARC_CPU_ARCV2EM      0x00000005
 #define EF_ARC_CPU_ARCV2HS      0x00000006
 
-- 
2.5.1


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