From 00923338dec84505addaf9cdeca2e9c844757824 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 1 May 2015 08:29:16 -0700 Subject: [PATCH] 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. --- gas/ChangeLog | 6 ++++++ gas/config/tc-i386.c | 42 ----------------------------------------- gas/config/tc-i386.h | 5 ----- gas/testsuite/ChangeLog | 6 ++++++ gas/testsuite/gas/i386/i386.exp | 2 ++ gas/testsuite/gas/i386/note.d | 7 +++++++ gas/testsuite/gas/i386/note.s | 2 ++ 7 files changed, 23 insertions(+), 47 deletions(-) create mode 100644 gas/testsuite/gas/i386/note.d create mode 100644 gas/testsuite/gas/i386/note.s diff --git a/gas/ChangeLog b/gas/ChangeLog index e494ab1..8259f05 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,11 @@ 2015-05-01 H.J. Lu + * 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 + * configure.tgt: Support i386-*-elf*. 2015-04-30 DJ Delorie diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 4bcf416..50f9cb4 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -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) diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index f645754..deea9c2 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -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. */ diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 6608a80..e1fda77 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-05-01 H.J. Lu + + * gas/i386/i386.exp: Run note. + * gas/i386/note.d: New file. + * gas/i386/note.s: Likewise. + 2015-04-30 Nick Clifton PR gas/18347 diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 26cb7ac..e1fdd18 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -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. diff --git a/gas/testsuite/gas/i386/note.d b/gas/testsuite/gas/i386/note.d new file mode 100644 index 0000000..e7ad71d --- /dev/null +++ b/gas/testsuite/gas/i386/note.d @@ -0,0 +1,7 @@ +#as: -march=i686 +#readelf: -SW + +#failif +#... +[ ]*\[.*\][ ]+\.note[ ]+NOTE.* +#... diff --git a/gas/testsuite/gas/i386/note.s b/gas/testsuite/gas/i386/note.s new file mode 100644 index 0000000..1ff7c29 --- /dev/null +++ b/gas/testsuite/gas/i386/note.s @@ -0,0 +1,2 @@ + .text + nop -- 2.7.4