From: Alan Modra Date: Thu, 15 Nov 2001 13:19:46 +0000 (+0000) Subject: * config/tc-i386.h (md_end): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a847613f7489967c9bf31c82fab3fb44e5d9d7e2;p=binutils-gdb.git * 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index f1a251a8e54..eeb59dd05ee 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ 2001-11-15 Alan Modra + * 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 diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 105bc8eae7c..b8585d5a2ca 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -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 */ symbolS * diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index cea225be3aa..aff5980d5dd 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -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 */