From 6afdfa61bd9972c7811ccf8be2703d00a86510f8 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 10 Nov 2006 07:47:14 +0000 Subject: [PATCH] PR gas/3456: * config/obj-elf.c (obj_elf_version): Do not include the name field's padding in the namesz value. --- gas/ChangeLog | 6 ++++++ gas/config/obj-elf.c | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 1a60ca0320f..db41f6861f1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2006-11-10 Nick Clifton + + PR gas/3456: + * config/obj-elf.c (obj_elf_version): Do not include the name + field's padding in the namesz value. + 2006-11-09 Thiemo Seufer * config/tc-mips.c: Fix outdated comment. diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index d7a0ff2a382..16d4e82b596 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1419,11 +1419,12 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) Elf_Internal_Note i_note; Elf_External_Note e_note; asection *note_secp = NULL; - int len; SKIP_WHITESPACE (); if (*input_line_pointer == '\"') { + unsigned int len; + ++input_line_pointer; /* -> 1st char of string. */ name = input_line_pointer; @@ -1434,19 +1435,19 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) *(input_line_pointer - 1) = '\0'; *input_line_pointer = c; - /* create the .note section */ - + /* Create the .note section. */ note_secp = subseg_new (".note", 0); bfd_set_section_flags (stdoutput, note_secp, SEC_HAS_CONTENTS | SEC_READONLY); - /* process the version string */ - - len = strlen (name); + /* Process the version string. */ + len = strlen (name) + 1; - i_note.namesz = ((len + 1) + 3) & ~3; /* round this to word boundary */ - i_note.descsz = 0; /* no description */ + /* PR 3456: Although the name field is padded out to an 4-byte + boundary, the namesz field should not be adjusted. */ + i_note.namesz = len; + i_note.descsz = 0; /* No description. */ i_note.type = NT_VERSION; p = frag_more (sizeof (e_note.namesz)); md_number_to_chars (p, i_note.namesz, sizeof (e_note.namesz)); @@ -1454,7 +1455,7 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) md_number_to_chars (p, i_note.descsz, sizeof (e_note.descsz)); p = frag_more (sizeof (e_note.type)); md_number_to_chars (p, i_note.type, sizeof (e_note.type)); - p = frag_more (len + 1); + p = frag_more (len); strcpy (p, name); frag_align (2, 0, 0); @@ -1462,9 +1463,8 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) subseg_set (seg, subseg); } else - { - as_bad (_("expected quoted string")); - } + as_bad (_("expected quoted string")); + demand_empty_rest_of_line (); } -- 2.30.2