This is the mail archive of the 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]

Re: PATCH: PR binutils/12639: nm/readelf failed to detect corrupted symtab

On Tue, Apr 5, 2011 at 11:58 PM, Alan Modra <> wrote:
> On Tue, Apr 05, 2011 at 11:02:06PM -0700, H.J. Lu wrote:
>> d) nm/readelf reports error on those bad input files.
>> That is what my patch implements.
> Not exactly. ?Your elfcode.h:elf_slurp_symbol_table patch issues a
> message but doesn't return an error. ?I think you ought to call
> bfd_set_error and exit the function via error_return.

Then we got

[hjl@gnu-6 cq167859]$ make
./ld -o bad tr70098.bad.o start.o
start.o: In function `_start':
(.text+0x1): undefined reference to `main'
make: *** [bad] Error 1
[hjl@gnu-6 cq167859]$ ./nm tr70098.bad.o
BFD: tr70098.bad.o: corrupted local symbol `main'
./nm: tr70098.bad.o: No symbols
[hjl@gnu-6 cq167859]$

"nm" won't display any symbols. I don't think it is very helpful.

> On the readelf patch, I'd be inclined to report "Bad symtab" at the
> end of the symbol table and not special case mips.

readelf displays many "<corrupt>" without something like
"Bad XXXX" at the end.  I don't think symtab is that special.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]