* config/tc-i386.h (md_end): Define.
authorAlan Modra <amodra@gmail.com>
Thu, 15 Nov 2001 13:19:46 +0000 (13:19 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 15 Nov 2001 13:19:46 +0000 (13:19 +0000)
(i386_elf_emit_arch_note): Declare.
(CpuUnknown): Delete.
* config/tc-i386.c (default_arch): Constify.
(smallest_imm_type): Remove CpuUnknown test.
(md_assemble): Don't bother checking cpu_arch_flags non-zero.
(i386_elf_emit_arch_note): New function.

gas/ChangeLog
gas/config/tc-i386.c
gas/config/tc-i386.h

index f1a251a8e54c11e6616e4fc23f09b585e5fe1360..eeb59dd05eef22853041f06a2d49537d829f63d2 100644 (file)
@@ -1,5 +1,13 @@
 2001-11-15  Alan Modra  <amodra@bigpond.net.au>
 
+       * config/tc-i386.h (md_end): Define.
+       (i386_elf_emit_arch_note): Declare.
+       (CpuUnknown): Delete.
+       * config/tc-i386.c (default_arch): Constify.
+       (smallest_imm_type): Remove CpuUnknown test.
+       (md_assemble): Don't bother checking cpu_arch_flags non-zero.
+       (i386_elf_emit_arch_note): New function.
+
        * po/POTFILES.in: Regenerate.
 
 2001-11-15  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
index 105bc8eae7c994e59c64b0a67c21dfe22dfd1e6b..b8585d5a2cae3ad3b897a8eab6f312c861b3f375 100644 (file)
@@ -77,7 +77,7 @@ static bfd_reloc_code_real_type reloc
 #ifndef DEFAULT_ARCH
 #define DEFAULT_ARCH "i386"
 #endif
-static char *default_arch = DEFAULT_ARCH;
+static const char *default_arch = DEFAULT_ARCH;
 
 /* 'md_assemble ()' gathers together information and puts it into a
    i386_insn.  */
@@ -539,8 +539,7 @@ static int
 smallest_imm_type (num)
      offsetT num;
 {
-  if (cpu_arch_flags != (Cpu086 | Cpu186 | Cpu286 | Cpu386 | Cpu486 | CpuNo64)
-      && !(cpu_arch_flags & (CpuUnknown)))
+  if (cpu_arch_flags != (Cpu086 | Cpu186 | Cpu286 | Cpu386 | Cpu486 | CpuNo64))
     {
       /* This code is disabled on the 486 because all the Imm1 forms
         in the opcode table are slower on the i486.  They're the
@@ -1393,18 +1392,15 @@ md_assemble (line)
       }
 
     /* Check if instruction is supported on specified architecture.  */
-    if (cpu_arch_flags != 0)
+    if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64))
+       & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64)))
       {
-       if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64))
-           & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64)))
-         {
-           as_warn (_("`%s' is not supported on `%s'"),
-                    current_templates->start->name, cpu_arch_name);
-         }
-       else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT))
-         {
-           as_warn (_("use .code16 to ensure correct addressing mode"));
-         }
+       as_warn (_("`%s' is not supported on `%s'"),
+                current_templates->start->name, cpu_arch_name);
+      }
+    else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT))
+      {
+       as_warn (_("use .code16 to ensure correct addressing mode"));
       }
 
     /* Check for rep/repne without a string instruction.  */
@@ -4661,6 +4657,48 @@ i386_target_format ()
 }
 
 #endif /* OBJ_MAYBE_ more than one  */
+
+#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
+void i386_elf_emit_arch_note ()
+{
+  if (OUTPUT_FLAVOR == bfd_target_elf_flavour
+      && cpu_arch_name != NULL)
+    {
+      char *p;
+      asection *seg = now_seg;
+      subsegT subseg = now_subseg;
+      Elf_Internal_Note i_note;
+      Elf_External_Note e_note;
+      asection *note_secp;
+      int len;
+
+      /* Create the .note section.  */
+      note_secp = subseg_new (".note", 0);
+      bfd_set_section_flags (stdoutput,
+                            note_secp,
+                            SEC_HAS_CONTENTS | SEC_READONLY);
+
+      /* Process the arch string.  */
+      len = strlen (cpu_arch_name);
+
+      i_note.namesz = len + 1;
+      i_note.descsz = 0;
+      i_note.type = NT_ARCH;
+      p = frag_more (sizeof (e_note.namesz));
+      md_number_to_chars (p, (valueT) i_note.namesz, sizeof (e_note.namesz));
+      p = frag_more (sizeof (e_note.descsz));
+      md_number_to_chars (p, (valueT) i_note.descsz, sizeof (e_note.descsz));
+      p = frag_more (sizeof (e_note.type));
+      md_number_to_chars (p, (valueT) i_note.type, sizeof (e_note.type));
+      p = frag_more (len + 1);
+      strcpy (p, cpu_arch_name);
+
+      frag_align (2, 0, 0);
+
+      subseg_set (seg, subseg);
+    }
+}
+#endif
 #endif /* BFD_ASSEMBLER  */
 \f
 symbolS *
index cea225be3aaeb15543f01af55f3ae4c7986af26a..aff5980d5dd237b0093ce8e9f6f065e2326cf925 100644 (file)
@@ -111,6 +111,11 @@ extern const char *i386_target_format PARAMS ((void));
 #endif
 #endif
 
+#if (defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF))
+#define md_end i386_elf_emit_arch_note
+extern void i386_elf_emit_arch_note PARAMS ((void));
+#endif
+
 #else /* ! BFD_ASSEMBLER */
 
 /* COFF STUFF */
@@ -293,7 +298,6 @@ typedef struct
 #define CpuSSE        0x1000   /* Streaming SIMD extensions required */
 #define CpuSSE2               0x2000   /* Streaming SIMD extensions 2 required */
 #define Cpu3dnow       0x4000  /* 3dnow! support required */
-#define CpuUnknown     0x8000  /* The CPU is unknown,  be on the safe side.  */
 
   /* These flags are set by gas depending on the flag_code.  */
 #define Cpu64       0x4000000   /* 64bit support required  */
This page took 0.037067 seconds and 4 git commands to generate.