This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
That works. But it seems to me that get_stab_string_offset should still return 1 rather than 0 in this case (for the first NULL value that gets set). This would also make the assertion correct. *** stabs.c Fri Aug 20 17:27:26 2010 --- stabs.c.patched Tue Aug 31 09:13:29 2010 *************** get_stab_string_offset (const char *stri *** 119,126 **** seg_info (seg)->stabu.stab_string_size += length + 1; } - else - retval = 0; subseg_set (save_seg, save_subseg); --- 119,124 ---- On Mon, Aug 30, 2010 at 10:33 PM, Alan Modra <amodra@gmail.com> wrote: > On Thu, Aug 26, 2010 at 03:19:23PM -0700, Raymes Khoury wrote: >> This error can be easily reproduced by executing the following with >> binutils 2.20.1 (I'm using gcc 4.4.3). >> >> $ echo "int main() { return 0; }" | gcc -x c - -gstabs >> /tmp/ccautrgB.s: Assembler messages: >> /tmp/ccautrgB.s:2: Internal error! >> Assertion failure in obj_elf_init_stab_section at >> ../../gas/config/obj-elf.c line 1782. >> Please report this bug. >> >> When the program is passed from stdin, gcc uses an empty string as the >> value of the .file directive. The assembler output is as follows: >> ?? ? ? ?.file ? "" >> ?? ? ? ?.stabs ?"",100,0,2,.Ltext0 >> ?? ? ? ?.text >> ? ? ? ? ... >> >> The assertion fails in?obj_elf_init_stab_section which calls >> get_stab_string_offset (stabs.c) with the value of the .file >> directive. When this is an empty string,?get_stab_string_offset >> returns 0 which appears to be a failure value as the offset is >> actually 1 (and in all other cases it will return a value >= 1). >> obj_elf_init_stab_section asserts the return value is 1 and thus >> fails. > [snip] > > Let's just fix the assertion. ?There isn't much point in adding > another NUL to the stab string section. ?The first one will do fine. > > ? ? ? ?* config/obj-elf.c (obj_elf_init_stab_section): Fix assertion. > > Index: gas/config/obj-elf.c > =================================================================== > RCS file: /cvs/src/src/gas/config/obj-elf.c,v > retrieving revision 1.129 > diff -u -p -r1.129 obj-elf.c > --- gas/config/obj-elf.c ? ? ? ?17 Aug 2010 20:03:40 -0000 ? ? ?1.129 > +++ gas/config/obj-elf.c ? ? ? ?31 Aug 2010 05:31:33 -0000 > @@ -1795,7 +1795,7 @@ obj_elf_init_stab_section (segT seg) > ? strcpy (stabstr_name, segment_name (seg)); > ? strcat (stabstr_name, "str"); > ? stroff = get_stab_string_offset (file, stabstr_name); > - ?know (stroff == 1); > + ?know (stroff == 1 || (stroff == 0 && file[0] == '\0')); > ? md_number_to_chars (p, stroff, 4); > ? seg_info (seg)->stabu.p = p; > ?} > > -- > Alan Modra > Australia Development Lab, IBM >
Attachment:
stabs.c.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |