bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gas 2.20.1 assertion failure when .file directive empty and .stabs direc


From: Raymes Khoury
Subject: gas 2.20.1 assertion failure when .file directive empty and .stabs directive present
Date: Thu, 26 Aug 2010 15:19:23 -0700

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.
Note that this issue is present in earlier versions of gas (at least
2.19.1) however assertions seem to be switched off by default in this
version and so the issue does not present itself.

A potential fix is to allow empty string values for stab sections as
in the patch attached, however I don't know the full implications of
this (what problems it might cause).

Attachment: stabs.c.diff
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]