This is the mail archive of the
mailing list for the binutils project.
Re: PATCH: PR binutils/12639: nm/readelf failed to detect corrupted symtab
On Tue, Apr 5, 2011 at 10:01 PM, Alan Modra <email@example.com> wrote:
> On Tue, Apr 05, 2011 at 08:13:48PM -0700, H.J. Lu wrote:
>> Linker will treat main as local no matter what symtab says.
>> For all practical purposes, any symbol before sh_info is
>> a local symbol.
>> > What created this bad object file?
>> They should remain nameless if possible :-).
> :-) ?I think you have three options:
> a) Issue an error, and refuse to link the bad object file, or
We do get a linker error today:
[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
since main is treated as local. But the output of "nm/readelf" looks normal.
My change makes "nm/readelf" to flag the bad symtab.
> b) Create a new target with elf_bad_symtab set for the target, or
> c) Provide some other means of setting elf_bad_symtab.
> I really don't like (b). ?(c) is a pain, since it isn't just ld, but
> objcopy, objdump, etc.
I don't want (b) nor (c). I want
d) nm/readelf reports error on those bad input files.
That is what my patch implements.