Remove i386_elf_emit_arch_note

This x86 assembler patch:

https://sourceware.org/ml/binutils/2001-11/msg00344.html

generates a .note section for .arch directive so that GDB can tell which
architecture an i386 binary belongs:

https://sourceware.org/ml/binutils/2001-11/msg00271.html

However, x86 assembly code can have any instructions.  A .note section
doesn't help.  This patch removes it.

gas/

	* config/tc-i386.c (i386_elf_emit_arch_note): Removed.
	* config/tc-i386.h (md_end): Likewise.
	(i386_elf_emit_arch_note): Likewise.

gas/testsuite/

	* gas/i386/i386.exp: Run note.
	* gas/i386/note.d: New file.
	* gas/i386/note.s: Likewise.
This commit is contained in:
H.J. Lu 2015-05-01 08:29:16 -07:00
parent b633b7258d
commit 00923338de
7 changed files with 23 additions and 47 deletions

View file

@ -1,3 +1,9 @@
2015-05-01 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (i386_elf_emit_arch_note): Removed.
* config/tc-i386.h (md_end): Likewise.
(i386_elf_emit_arch_note): Likewise.
2015-05-01 H.J. Lu <hongjiu.lu@intel.com>
* configure.tgt: Support i386-*-elf*.

View file

@ -10077,48 +10077,6 @@ i386_target_format (void)
}
#endif /* OBJ_MAYBE_ more than one */
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
void
i386_elf_emit_arch_note (void)
{
if (IS_ELF && 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
symbolS *
md_undefined_symbol (char *name)

View file

@ -104,11 +104,6 @@ extern const char *i386_target_format (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 (void);
#endif
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
/* '$' may be used as immediate prefix. */

View file

@ -1,3 +1,9 @@
2015-05-01 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Run note.
* gas/i386/note.d: New file.
* gas/i386/note.s: Likewise.
2015-04-30 Nick Clifton <nickc@redhat.com>
PR gas/18347

View file

@ -392,6 +392,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "size-2"
run_dump_test "size-3"
run_dump_test "size-4"
run_dump_test "note"
}
# This is a PE specific test.

View file

@ -0,0 +1,7 @@
#as: -march=i686
#readelf: -SW
#failif
#...
[ ]*\[.*\][ ]+\.note[ ]+NOTE.*
#...

View file

@ -0,0 +1,2 @@
.text
nop